[lxc-users] sshd-keygen fails during container boot

Peter Steele pwsteele at gmail.com
Tue Dec 8 22:21:34 UTC 2015


On 12/08/2015 11:10 AM, Peter Steele wrote:
> On 12/08/2015 08:00 AM, Serge Hallyn wrote:
>> Ok, can you change the launch command in the scripts to
>>
>> lxc-start -n $containername -L /tmp/$containername.cout -l trace -o 
>> /tmp/$containername.dout -- /sbin/init log_target=console 
>> log_level=debug
>>
>> The console output will go into the .cout file and lxc debug output 
>> into .dout.
>>
>
I did another test and hit the original sshd-keygen error on one of my 
containers. The /var/log/messages file for that container reported the 
following:

Dec  8 11:58:13 pws-vm-04 systemd: Starting OpenSSH Server Key Generation...
Dec  8 11:58:13 pws-vm-04 systemd: Failed at step CGROUP spawning 
/usr/sbin/sshd-keygen: No such file or directory
Dec  8 11:58:13 pws-vm-04 systemd: sshd-keygen.service: main process 
exited, code=exited, status=219/CGROUP
Dec  8 11:58:13 pws-vm-04 systemd: Failed to start OpenSSH Server Key 
Generation.
Dec  8 11:58:13 pws-vm-04 systemd: Unit sshd-keygen.service entered 
failed state.
Dec  8 11:58:16 pws-vm-04 systemd: Starting OpenSSH server daemon...
Dec  8 11:58:16 pws-vm-04 systemd: Started OpenSSH server daemon.
Dec  8 11:58:16 pws-vm-04 sshd: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:58:16 pws-vm-04 sshd: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:58:16 pws-vm-04 sshd: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key
Dec  8 11:58:58 pws-vm-04 sshd[722]: error: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:58:58 pws-vm-04 sshd[722]: error: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:58:58 pws-vm-04 sshd[722]: error: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key
Dec  8 11:59:00 pws-vm-04 sshd[724]: error: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:59:00 pws-vm-04 sshd[724]: error: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:59:00 pws-vm-04 sshd[724]: error: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key
Dec  8 11:59:00 pws-vm-04 sshd[726]: error: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:59:00 pws-vm-04 sshd[726]: error: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:59:00 pws-vm-04 sshd[726]: error: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key
Dec  8 11:59:00 pws-vm-04 sshd[728]: error: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:59:00 pws-vm-04 sshd[728]: error: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:59:00 pws-vm-04 sshd[728]: error: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key
Dec  8 11:59:00 pws-vm-04 sshd[730]: error: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:59:00 pws-vm-04 sshd[730]: error: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:59:00 pws-vm-04 sshd[730]: error: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key
Dec  8 11:59:02 pws-vm-04 sshd[831]: error: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:59:02 pws-vm-04 sshd[831]: error: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:59:02 pws-vm-04 sshd[831]: error: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key
Dec  8 11:59:02 pws-vm-04 sshd[833]: error: Could not load host key: 
/etc/ssh/ssh_host_rsa_key
Dec  8 11:59:02 pws-vm-04 sshd[833]: error: Could not load host key: 
/etc/ssh/ssh_host_ecdsa_key
Dec  8 11:59:02 pws-vm-04 sshd[833]: error: Could not load host key: 
/etc/ssh/ssh_host_ed25519_key

The .cout file for this container looked normal except, of course, for 
some ssh related messages:

Starting OpenSSH Server Key Generation...
FAILED Failed to start OpenSSH Server Key Generation.
See 'systemctl status sshd-keygen.service' for details.
Starting OpenSSH server daemon...

The .dout file had no errors related to sshd in this particular test.

In another test, I tried creating several containers with the command

lxc-create -n testN -t download -- -d centos -r 7 -a amd64

and then started them all in the same manner as my other tests using:

for vm in `lxc-ls`; do lxc-start -n $vm -L /tmp/$vm.cout -l trace -o 
/tmp/$vm.dout -- /sbin/init log_target=console log_level=debug; done

In this case of course the containers are using the stock downloaded 
CentOS 7 image instead of my custom image. I was unable to reproduce the 
systemd error through multiple start/stop tests of my containers. They 
always started up without any complaints. Granted, these stock images 
are simpler than my custom images, but this seems to point to something 
in my image that's causing this issue. At least that gives me a bit to 
go on, although it's hard to understand what additional rpm modules 
would cause systemd to behave this way during bootup.

Peter

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20151208/7177d354/attachment.html>


More information about the lxc-users mailing list