Guido Schmidt
2017-Dec-05 13:24 UTC
[Libguestfs] virt-builder: --ssh-inject fails because it is executed before --firstboot-command?
Version 1.34.6 (on Debian Stretch) Using virt-builder I tried to create a user and inject my ssh key: virt-builder -v -x centos-7.4 --output testimage --format qcow2 --selinux-relabel --hostname testimage --firstboot-command 'useradd -m -p "" dummy' --firstboot-command 'chage -d 0 dummy' --ssh-inject dummy ... [ 16.1] Installing firstboot command: useradd -m -p "" dummy [ 16.1] Installing firstboot command: chage -d 0 dummy [ 16.1] SSH key inject: dummy virt-builder: error: ssh-inject: the user dummy does not exist on the guest (Full debug output attached) Seems like this can never work as the injection is carried out before the first boot. Is this a bug in my version? Or is this limited to users that are already in the image? Guido
Pino Toscano
2017-Dec-05 14:01 UTC
Re: [Libguestfs] virt-builder: --ssh-inject fails because it is executed before --firstboot-command?
Hi, On Tuesday, 5 December 2017 14:24:42 CET Guido Schmidt wrote:> Version 1.34.6 (on Debian Stretch) > > Using virt-builder I tried to create a user and inject my ssh key: > > virt-builder -v -x centos-7.4 --output testimage --format qcow2 > --selinux-relabel --hostname testimage --firstboot-command 'useradd -m > -p "" dummy' --firstboot-command 'chage -d 0 dummy' --ssh-inject dummy > > ... > > [ 16.1] Installing firstboot command: useradd -m -p "" dummy > [ 16.1] Installing firstboot command: chage -d 0 dummy > [ 16.1] SSH key inject: dummy > virt-builder: error: ssh-inject: the user dummy does not exist on the guest > > (Full debug output attached) > > Seems like this can never work as the injection is carried out before > the first boot. Is this a bug in my version? Or is this limited to users > that are already in the image?The injection of SSH keys (using --ssh-inject) is performed during the image customization process, i.e. while virt-builder/virt-customize run. Theoretically it should be possible to create the user directly in this phase, so the SSH injection works, and then force the password change on first login (with chage, as you used already). -- Pino Toscano
Possibly Parallel Threads
- Re: virt-customize fail to inject firstboot script when running it from script.
- Re: virt-customize fail to inject firstboot script when running it from script.
- Re: virt-customize fail to inject firstboot script when running it from script.
- Re: virt-customize fail to inject firstboot script when running it from script.
- Re: [PATCH 2/2] firstboot: schedule firstboot as delayed task