[Libguestfs] [PATCH 1/2] builder/templates/debian.preseed: enable serial console

Florian Klink flokli at flokli.de
Sat Aug 26 23:21:38 UTC 2017


Also unify .index-fragment files
---
 builder/templates/debian-7.index-fragment |  7 -------
 builder/templates/debian-8.index-fragment |  7 -------
 builder/templates/debian-9.index-fragment | 18 ++++++------------
 builder/templates/debian.preseed          |  1 +
 builder/templates/make-template.ml        |  6 ------
 5 files changed, 7 insertions(+), 32 deletions(-)

diff --git a/builder/templates/debian-7.index-fragment b/builder/templates/debian-7.index-fragment
index 7d868e63c..37e72f7f5 100644
--- a/builder/templates/debian-7.index-fragment
+++ b/builder/templates/debian-7.index-fragment
@@ -19,13 +19,6 @@ notes=Debian 7 (Wheezy).
  builder/website/debian.preseed
  builder/website/debian.sh
  
- This image is so very minimal that it only includes an ssh
- server and no virtual consoles.  To enable virtual consoles
- use this virt-builder option:
- 
- virt-builder debian-7 \
-     --edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
- 
  This image does not contain SSH host keys.  To regenerate them use:
  
  --firstboot-command "dpkg-reconfigure openssh-server"
diff --git a/builder/templates/debian-8.index-fragment b/builder/templates/debian-8.index-fragment
index d8387c327..68017fbd0 100644
--- a/builder/templates/debian-8.index-fragment
+++ b/builder/templates/debian-8.index-fragment
@@ -21,10 +21,3 @@ notes=Debian 8 (Jessie).
  This image does not contain SSH host keys.  To regenerate them use:
  
  --firstboot-command "dpkg-reconfigure openssh-server"
- 
- The serial console is not working in this image.  To enable it, do:
- 
- --edit '/etc/default/grub:
-            s/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200n8"/' \
- --run-command update-grub
-
diff --git a/builder/templates/debian-9.index-fragment b/builder/templates/debian-9.index-fragment
index 293f9117f..5eb7146bc 100644
--- a/builder/templates/debian-9.index-fragment
+++ b/builder/templates/debian-9.index-fragment
@@ -10,20 +10,14 @@ compressed_size=203644432
 expand=/dev/sda1
 notes=Debian 9 (stretch)
  
- This is a minimal Debian install.
+ This is a default Debian install.
  
- This image is so very minimal that it only includes an ssh server
- and no virtual consoles.  To enable virtual consoles use this
- virt-builder option:
+ The preseed and virt-install scripts that produced this image
+ can be found in the libguestfs source tree:
  
-     --edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'
+ builder/website/debian.preseed
+ builder/website/debian.sh
  
  This image does not contain SSH host keys.  To regenerate them use:
  
-     --firstboot-command "dpkg-reconfigure openssh-server"
- 
- This template was generated by a script in the libguestfs source tree:
-     builder/templates/make-template.ml
- Associated files used to prepare this template can be found in the
- same directory.
-
+ --firstboot-command "dpkg-reconfigure openssh-server"
diff --git a/builder/templates/debian.preseed b/builder/templates/debian.preseed
index 3cffb3b9b..1f13eadbd 100644
--- a/builder/templates/debian.preseed
+++ b/builder/templates/debian.preseed
@@ -439,4 +439,5 @@ d-i finish-install/reboot_in_progress note
 # directly, or use the apt-install and in-target commands to easily install
 # packages and run commands in the target system.
 #d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
+d-i preseed/late_command string in-target sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200n8"/g; s/# *GRUB_TERMINAL=console/GRUB_TERMINAL=serial/g' /etc/default/grub; in-target update-grub
 
diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml
index 7b46bdacb..42ff48eb9 100755
--- a/builder/templates/make-template.ml
+++ b/builder/templates/make-template.ml
@@ -1027,14 +1027,8 @@ and notes_of_os os arch nvram =
       add ""
    | Debian ((8|9), _) ->
       reconfigure_ssh_host_keys_debian ();
-      fix_serial_console_debian ();
    | Debian _ ->
       add "This image is so very minimal that it only includes an ssh server";
-      add "and no virtual consoles.  To enable virtual consoles use this";
-      add "virt-builder option:";
-      add "";
-      add "    --edit '/etc/inittab: s,^#([1-9].*respawn.*/sbin/getty.*),$1,'";
-      add "";
       reconfigure_ssh_host_keys_debian ();
    | Ubuntu ("16.04", _) ->
       builder_account_warning ();
-- 
2.14.1




More information about the Libguestfs mailing list