Hi,

thanks for taking care of this, but I think the fix you use is wrong:
it just checks for Wheezy, instead of checking for sysvinit. Problem
being that there are other sysvinit-based systems: Squeeze for the one
part, which has LTS until February; but also Jessie and Sid if you
include the package sysvinit-core at debootstrap time. Also, if you run
vmdebootstrap on a derivative, they might also use sysvinit as the init
system, so this change could hurt those.

Instead of checking the distribution, you should rather check whether
sysvinit is installed, i.e. if /etc/inttab exists in the system (I
already mentioned that in my original bug report.)

I've attached a patch that updates the check to be properly generic and
not Wheezy-specific.

I've tested it with Squeeze, Wheezy, Jessie and Sid; Jessie and Sid
both with systemd and sysvinit, and I with the patch attached to this
email applied I get the following (correct) behavior:

 - Squeeze, Wheezy, Jessie+sysvinit-core, Sid+sysvinit-core:
    /etc/inittab gets updated with a serial console, VM boots in Qemu
    with sysvinit as init system, serial console shows up

 - Jessie, Sid (defaults, i.e. systemd):
    /etc/inittab doesn't exist and isn't created by vmdeboostrap, VM
    boots in Qemu with systemd as init system, serial console shows up

Without my patch, Squeeze, Jessie+sysvinit-core and Sid+sysvinit-core
don't get a serial console anymore (they did before you applied the
patch that was to take care of the bug I reported, i.e. in 1.1).

Regards,
Christian

Steps to reproduce:

vmdebootstrap --sparse --log=sid-sysvinit.log --package=sysvinit-core \
              --verbose --serial-console --distribution=sid \
              --size=10000000000 --grub --image=sid-sysvinit.img
vmdebootstrap --sparse --log=sid-systemd.log \
              --verbose --serial-console --distribution=sid \
              --size=10000000000 --grub --image=sid-systemd.img
vmdebootstrap --sparse --log=jessie-sysvinit.log --package=sysvinit-core \
              --verbose --serial-console --distribution=jessie \
              --size=10000000000 --grub --image=jessie-sysvinit.img
vmdebootstrap --sparse --log=jessie-systemd.log \
              --verbose --serial-console --distribution=jessie \
              --size=10000000000 --grub --image=jessie-systemd.img

vmdebootstrap --sparse --log=wheezy.log \
              --verbose --serial-console --distribution=wheezy \
              --size=10000000000 --grub --image=wheezy.img
vmdebootstrap --sparse --log=squeeze.log \
              --verbose --serial-console --distribution=squeeze \
              --size=10000000000 --grub --image=squeeze.img

Run the images with:

qemu-system-x86_64 -enable-kvm -drive file=$IMAGE.img,if=virtio \
                   -serial stdio
From ba83da61283502d732a60a70f94facba82f0bc68 Mon Sep 17 00:00:00 2001
From: Christian Seiler <christ...@iwakd.de>
Date: Wed, 11 Nov 2015 20:42:22 +0100
Subject: [PATCH] Add serial console for all sysvinit-based systems

Don't just check for Wheezy (oldstable), but for all sysvinit-based
systems (Squeeze, debootstrap --include=sysvinit-core in Jessie and
beyond, etc.).
---
 bin/vmdebootstrap | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap
index 909c8eb..c87b02c 100755
--- a/bin/vmdebootstrap
+++ b/bin/vmdebootstrap
@@ -280,11 +280,11 @@ class VmDebootstrap(cliapp.Application):  # pylint: disable=too-many-public-meth
                 extlinux.install_extlinux(rootdev, rootdir)
         elif self.settings['extlinux']:
             extlinux.install_extlinux(rootdev, rootdir)
-        # only append for wheezy (which became oldstable on 2015.04.25)
-        if distro.was_oldstable(datetime.date(2015, 4, 26)):
+        # only append for systems with sysvinit (e.g. Wheezy)
+        if os.path.exists(os.path.join(rootdir, 'etc', 'inittab')):
             base.append_serial_console(rootdir)
         elif self.settings['serial-console']:
-            base.message("Skipping setting serial console- wheezy only.")
+            base.message("Skipping setting serial console- sysvinit systems only.")
         self.optimize_image(rootdir)
 
     def start_ops(self):
-- 
2.1.4

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to