Package: openssh-server Version: 1:7.4p1-10 Severity: important I'm attempting to create a minimal custom Debian stretch disk image to use as a template for VMs. I use packer to run debian-9.0.0-amd64-netinst.iso in a QEMU VM with a custom preseed file that runs noninteractively. However, the install dies toward the end because openssh-server configuruation returns an error. I can't include openssh-server in the install (via tasksel/first of ssh-server or standard, or including it in pkgsel/include) without the install failing.
Further investigation shows that openssh-server configuration is returning an error code during configuration, causing the install to abort: Setting up openssh-server (1:7.4p1-10) ... Creating config file /etc/ssh/sshd_config with new version Creating SSH2 RSA key; this may take some time ... 2048 SHA256:rTUS0h7zdLTuTFdpTWWf/TgbUJoZ5qP56ZgxY2dOqdg root@debian-stretch-template (RSA) Creating SSH2 ECDSA key; this may take some time ... /etc/ssh/ssh_host_ecdsa_key.pub is not a public key file. dpkg: error processing package openssh-server (--configure): subprocess installed post-installation script returned error exit status 255 Processing triggers for libc-bin (2.24-11+deb9u1) ... Processing triggers for systemd (232-25) ... Errors were encountered while processing: openssh-server E: Sub-process /usr/bin/dpkg returned an error code (1) This error says "reports failure", because while the message says that "/etc/ssh/ssh_host_ecdsa_key.pub is not a public key file". "file" says it is, and it looks OK to visual inspection. If I manually intervene and reinstall openssh-server, it works: Reading package lists... Building dependency tree... Reading state information... openssh-server is already the newest version (1:7.4p1-10). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 1 not fully installed or removed. After this operation, 0 B of additional disk space will be used. Setting up openssh-server (1:7.4p1-10) ... Creating SSH2 ED25519 key; this may take some time ... 256 SHA256:07VOIBlUhI4y89Ght5Bt04JqPj5In+mcpqwjgY8G7Rg root@debian-stretch-template (ED25519) Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service. Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service. Packer configuration and preseed available if those will help. There must be some environmental contribution, since I've been able to install stretch with openssh-server in other environments without any failures. But I can repeat the failure on demand, it happens every time. I can reproduce the problem in a normal (non-install) environment by configuring the install to not select openssh-server, letting the install succeed, then logging in to the VM via VNC while Packer is waiting for SSH to start running. So I could run the openssh-server install/config under strace or similar if desired. I'll note that the problem did *not* occur in mid-May when I was using the same configuration with stretch RC3, but going back to the RC3 netboot.iso doesn't fix the problem (as expected, since the openssh-server .deb is downloaded from Debian, not included in the ISO). -- System Information: Debian Release: 9.0 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 4.9.0-3-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages openssh-server depends on: ii adduser 3.115 ii debconf [debconf-2.0] 1.5.61 ii dpkg 1.18.24 ii init-system-helpers 1.48 ii libaudit1 1:2.6.7-2 ii libc6 2.24-11+deb9u1 ii libcomerr2 1.43.4-2 ii libgssapi-krb5-2 1.15-1 ii libkrb5-3 1.15-1 ii libpam-modules 1.1.8-3.6 ii libpam-runtime 1.1.8-3.6 ii libpam0g 1.1.8-3.6 ii libselinux1 2.6-3+b1 ii libssl1.0.2 1.0.2l-2 ii libsystemd0 232-25 ii libwrap0 7.6.q-26 ii lsb-base 9.20161125 ii openssh-client 1:7.4p1-10 ii openssh-sftp-server 1:7.4p1-10 ii procps 2:3.3.12-3 ii ucf 3.0036 ii zlib1g 1:1.2.8.dfsg-5 Versions of packages openssh-server recommends: ii libpam-systemd 232-25 ii ncurses-term 6.0+20161126-1 ii xauth 1:1.0.9-1+b2 Versions of packages openssh-server suggests: pn molly-guard <none> pn monkeysphere <none> pn rssh <none> pn ssh-askpass <none> pn ufw <none> -- debconf information: openssh-server/permit-root-login: true