On Sun, Apr 01, 2018 at 09:31:48PM -0400, Charles wrote:
I am running the stock libguestfs on latest Ubuntu 16.04
(1:1.32.2-4ubuntu2).
My guests are also Ubuntu 16.04.
I am running virt-sysprep with --firstboot-command 'dpkg-reconfigure
openssh-server'.
This works 90% of the time, but occasionally when a new guest first
starts it can't find the script:
~# cat virt-sysprep-firstboot.log
/etc/init.d/virt-sysprep-firstboot start
Scripts dir: /usr/lib/virt-sysprep/scripts
=== Running /usr/lib/virt-sysprep/scripts/0001-dpkg-reconfigure-openssh-server
===
/usr/lib/virt-sysprep/firstboot.sh start
Scripts dir: /usr/lib/virt-sysprep/scripts
/etc/init.d/virt-sysprep-firstboot: 35:
/etc/init.d/virt-sysprep-firstboot:
/usr/lib/virt-sysprep/scripts-done/0001-dpkg-reconfigure-openssh-server:
not found
As such, I cannot ssh into these guests without opening them manually
on the host and running the dpkg reconfigure command.
This bug seems similar, but I cannot find other reports or fixes:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=773106
Any suggestions to debug or workaround?
For debugging you'll need to run virt-sysprep with the -v -x
options and see what is being installed, and then compare that
to what runs when the guest boots.
Unfortunately the code for installing firstboot scripts on Debian
and Ubuntu guests is pretty complex:
https://github.com/libguestfs/libguestfs/blob/master/customize/firstboot.ml
More so, because it will install both systemd and SysV-init-style
scripts in some circumstances.
https://github.com/libguestfs/libguestfs/blob/e79286f71738d9385157d9e8721...
You could also try a more recent version of libguestfs, since 1.32 was
released over 2 years ago.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
virt-top is 'top' for virtual machines. Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top