[Vmdebootstrap-devel] Bug#786767: vmdebootstrap: i386 arch kernel package not found

Lars Wirzenius liw at liw.fi
Sat Jun 27 20:13:27 UTC 2015


On Mon, May 25, 2015 at 07:44:40AM -0400, James Valleroy wrote:
> linux-image-486 isn't available in sid. It appears to have been replaced
> with linux-image-586.
> 
> The attached patch will change the kernel_arch to 586 for i386 builds.
> After this change, i386 image builds are successful.

This solves the problem if you're targeting unstable (or anything
after jessie), but breaks it for wheezy. As I need to support wheezy
for my own stuff, I offer the attached patch, which also adds a
--kernel-package option to override frail logic in the future.

Neil, also available as liw/kernel-package-name in git.

-- 
sic transit disci mundi, ergo obnam
-------------- next part --------------
diff --git a/vmdebootstrap b/vmdebootstrap
index 49c21c8..31fb7ec 100755
--- a/vmdebootstrap
+++ b/vmdebootstrap
@@ -120,6 +120,10 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
         self.settings.boolean(
             ['no-kernel'],
             'do not install a linux package')
+        self.settings.string(
+            ['kernel-package'],
+            'install PACKAGE instead of the default kernel package',
+            metavar='PACKAGE')
         self.settings.boolean(
             ['enable-dhcp'],
             'enable DHCP on eth0')
@@ -423,13 +427,29 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
             include.append('grub-pc')
 
         if not self.settings['no-kernel']:
-            if self.settings['arch'] == 'i386':
-                kernel_arch = '486'
-            elif self.settings['arch'] == 'armhf':
-                kernel_arch = 'armmp'
+            if self.settings['kernel-package']:
+                kernel_image = self.settings['kernel-package']
             else:
-                kernel_arch = self.settings['arch']
-            kernel_image = 'linux-image-%s' % kernel_arch
+                if self.settings['arch'] == 'i386':
+                    # Wheezy has linux-image-486. Jessie and later
+                    # have linux-image-586. When stretch gets released,
+                    # this code needs to change the detection logic.
+                    # FIXME: This is too fugly and needs a better logic,
+                    # but I can't find a better way.
+                    dist = self.settings['distribution']
+                    jessie_or_later = dist in [
+                        'stable', 'jessie',
+                        'testing', 'stretch',
+                        'unstable', 'sid']
+                    if jessie_or_later:
+                        kernel_arch = '586'
+                    else:
+                        kernel_arch = '486'
+                elif self.settings['arch'] == 'armhf':
+                    kernel_arch = 'armmp'
+                else:
+                    kernel_arch = self.settings['arch']
+                kernel_image = 'linux-image-%s' % kernel_arch
             include.append(kernel_image)
 
         if self.settings['sudo'] and 'sudo' not in include:


More information about the Vmdebootstrap-devel mailing list