I had the same issue, but I believe I was already on 24.04 when the
issue happened through an automatic update on May 1st. From then on, all
updates failed due to this.

Linux machine_name 6.17.0-19-generic #19~24.04.2-Ubuntu SMP
PREEMPT_DYNAMIC Fri Mar  6 23:08:46 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

grep -E "install|upgrade" /var/log/dpkg.log | grep ssh
2026-05-01 06:36:50 upgrade openssh-sftp-server:amd64 1:9.6p1-3ubuntu13.15 
1:9.6p1-3ubuntu13.16
2026-05-01 06:36:50 status half-installed openssh-sftp-server:amd64 
1:9.6p1-3ubuntu13.15
2026-05-01 06:36:50 upgrade openssh-server:amd64 1:9.6p1-3ubuntu13.15 
1:9.6p1-3ubuntu13.16
2026-05-01 06:36:50 status half-installed openssh-server:amd64 
1:9.6p1-3ubuntu13.15
2026-05-01 06:36:50 upgrade openssh-client:amd64 1:9.6p1-3ubuntu13.15 
1:9.6p1-3ubuntu13.16
2026-05-01 06:36:50 status half-installed openssh-client:amd64 
1:9.6p1-3ubuntu13.15
2026-05-01 06:36:50 status installed openssh-client:amd64 1:9.6p1-3ubuntu13.16
2026-05-01 06:36:50 status installed openssh-sftp-server:amd64 
1:9.6p1-3ubuntu13.16

And every single unattended-upgrade since then just broke and wouldn't work:
(Many of these:)
Start-Date: 2026-05-08  06:41:14
Commandline: /usr/bin/unattended-upgrade
Remove: linux-headers-6.17.0-22-generic:amd64 (6.17.0-22.22~24.04.1)
Error: Sub-process /usr/bin/dpkg returned an error code (1)
End-Date: 2026-05-08  06:41:16

I am VERY LUCKY that I was able to get a console on the server and fix it. I 
first tried to fix it with "sudo apt --fix-broken install"
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up openssh-server (1:9.6p1-3ubuntu13.16) ...
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 148.
dpkg: error processing package openssh-server (--configure):
 installed openssh-server package post-installation script subprocess returned 
error exit status 1
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)


So that didn't work, and the sshd status was still:
sudo systemctl status sshd
○ ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/usr/lib/systemd/system/ssh.service; enabled; preset: 
enabled)
     Active: inactive (dead) since Fri 2026-05-01 06:36:50 EDT; 1 week 1 day ago
   Duration: 1month 1w 18h 5min 19.150s
TriggeredBy: × ssh.socket
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 515961 (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 38191)
     Memory: 4.4M (peak: 13.8M swap: 232.0K swap peak: 280.0K)
        CPU: 476ms
     CGroup: /system.slice/ssh.service
             └─491138 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

May 06 12:47:29 machine_name sshd[1472843]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:47:38 machine_name sshd[1472844]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:49:08 machine_name sshd[1472866]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:49:19 machine_name sshd[1472867]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:55:42 machine_name sshd[1472931]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:57:29 machine_name sshd[1472943]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:57:35 machine_name sshd[1472944]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 13:00:00 machine_name sshd[1472960]: fatal: Missing privilege separation 
directory: /run/sshd
May 08 18:02:12 machine_name sshd[1512439]: fatal: Missing privilege separation 
directory: /run/sshd
May 09 14:42:48 machine_name sshd[1528337]: fatal: Missing privilege separation 
directory: /run/sshd


Note that I can add information to Anders Wenhaug's fix above. I did NOT add 
the /run/sshd directory back in yet, but I only did "sudo systemctl stop 
ssh.socket" then "sudo systemctl stop ssh.service", and then "sudo apt upgrade 
openssh-server" which seemed to have upgrade just fine (until it killed all my 
terminals during the upgrade). But this did NOT fix the issue. There was still 
no /run/sshd. 

So then I tried mkdir -p /run/sshd && chmod 755 /run/sshd

And then I tried to restart it:
sudo systemctl status sshd
○ ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/usr/lib/systemd/system/ssh.service; enabled; preset: 
enabled)
     Active: inactive (dead) since Fri 2026-05-01 06:36:50 EDT; 1 week 1 day ago
   Duration: 1month 1w 18h 5min 19.150s
TriggeredBy: × ssh.socket
       Docs: man:sshd(8)
             man:sshd_config(5)
   Main PID: 515961 (code=exited, status=0/SUCCESS)
      Tasks: 1 (limit: 38191)
     Memory: 4.4M (peak: 13.8M swap: 232.0K swap peak: 280.0K)
        CPU: 483ms
     CGroup: /system.slice/ssh.service
             └─491138 "sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups"

May 06 12:47:38 machine_name sshd[1472844]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:49:08 machine_name sshd[1472866]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:49:19 machine_name sshd[1472867]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:55:42 machine_name sshd[1472931]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:57:29 machine_name sshd[1472943]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 12:57:35 machine_name sshd[1472944]: fatal: Missing privilege separation 
directory: /run/sshd
May 06 13:00:00 machine_name sshd[1472960]: fatal: Missing privilege separation 
directory: /run/sshd
May 08 18:02:12 machine_name sshd[1512439]: fatal: Missing privilege separation 
directory: /run/sshd
May 09 14:42:48 machine_name sshd[1528337]: fatal: Missing privilege separation 
directory: /run/sshd
May 09 15:29:44 machine_name sshd[1546005]: fatal: Missing privilege separation 
directory: /run/sshd

$ sudo systemctl restart sshd
A dependency job for ssh.service failed. See 'journalctl -xe' for details.

$ sudo journalctl -xe
May 09 15:32:18 machine_name sudo[1546352]: pam_unix(sudo:session): session 
closed for user root
May 09 15:32:24 machine_name sudo[1546356]:      user_name : TTY=pts/3 ; 
PWD=/home/user_name ; USER=root ; COMMAND=/usr/bin/systemct>
May 09 15:32:24 machine_name sudo[1546356]: pam_unix(sudo:session): session 
opened for user root(uid=0) by user_name(uid=1000)
May 09 15:32:24 machine_name (sd-listen)[1546360]: ssh.socket: Failed to create 
listening socket (0.0.0.0:22): Address a>
May 09 15:32:24 machine_name systemd[1]: ssh.socket: Failed to receive 
listening socket (0.0.0.0:22): Input/output error
May 09 15:32:24 machine_name systemd[1]: ssh.socket: Failed to listen on 
sockets: Input/output error
May 09 15:32:24 machine_name systemd[1]: ssh.socket: Failed with result 
'resources'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ The unit ssh.socket has entered the 'failed' state with result 'resources'.
May 09 15:32:24 machine_name systemd[1]: Failed to listen on ssh.socket - 
OpenBSD Secure Shell server socket.
░░ Subject: A start job for unit ssh.socket has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit ssh.socket has finished with a failure.
░░ 
░░ The job identifier is 2089513 and the job result is failed.
May 09 15:32:24 machine_name systemd[1]: Dependency failed for ssh.service - 
OpenBSD Secure Shell server.
░░ Subject: A start job for unit ssh.service has failed
░░ Defined-By: systemd
░░ Support: http://www.ubuntu.com/support
░░ 
░░ A start job for unit ssh.service has finished with a failure.
░░ 
░░ The job identifier is 2089416 and the job result is dependency.
May 09 15:32:24 machine_name systemd[1]: ssh.service: Job ssh.service/start 
failed with result 'dependency'.
May 09 15:32:24 machine_name sudo[1546356]: pam_unix(sudo:session): session 
closed for user root
May 09 15:32:38 machine_name sudo[1546362]:      user_name : TTY=pts/3 ; 
PWD=/home/user_name ; USER=root ; COMMAND=/usr/bin/journalc>
May 09 15:32:38 machine_name sudo[1546362]: pam_unix(sudo:session): session 
opened for user root(uid=0) by user_name(uid=1000)

I tried to sudo apt upgrade openssh-server again now, but this time I got the 
same:
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up openssh-server (1:9.6p1-3ubuntu13.16) ...
Could not execute systemctl:  at /usr/bin/deb-systemd-invoke line 148.
dpkg: error processing package openssh-server (--configure):
 installed openssh-server package post-installation script subprocess returned 
error exit status 1
Errors were encountered while processing:
 openssh-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

Nothing seemed to work until I did:

sudo systemctl stop ssh.service ssh.socket
sudo pkill -9 sshd
sudo dpkg --purge --force-all openssh-server
sudo dpkg -r --force-remove-reinstreq openssh-server
sudo rm -rf /run/sshd
sudo rm -rf /var/lib/dpkg/info/openssh-server.*
sudo dpkg --remove --force-remove-reinstreq openssh-server
sudo dpkg --purge openssh-server
sudo apt clean
sudo apt update
sudo dpkg --audit
Which didn't show anything broken (although the linux-hwe and linux-tools were 
missing the md5sums!?)

In any case, then I could reinstall:
cd /tmp
wget 
http://archive.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-server_9.6p1-3ubuntu13.16_amd64.deb
wget 
http://archive.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-client_9.6p1-3ubuntu13.16_amd64.deb
wget 
http://archive.ubuntu.com/ubuntu/pool/main/o/openssh/openssh-sftp-server_9.6p1-3ubuntu13.16_amd64.deb
sudo apt install --reinstall openssh-client openssh-sftp-server
sudo dpkg -i --ignore-depends=openssh-server /tmp/openssh-server_*.deb
sudo mkdir -p /run/sshd
sudo chmod 0755 /run/sshd
sudo /usr/sbin/sshd
sudo systemctl enable ssh.service
sudo systemctl start ssh.service
dpkg -l openssh-server
sudo systemctl status ssh.service
and at that point I could ssh localhost and it worked.


sudo apt remove --purge linux-hwe-6.17-tools-6.17.0-22 
linux-tools-6.17.0-22-generic
sudo dpkg --purge --force-all linux-hwe-6.17-tools-6.17.0-22 
linux-tools-6.17.0-22-generic
sudo dpkg --configure -a
sudo apt autoremove


I did this locally on the machine in a terminal since I wasn't able to get into 
the machine remotely. If the server had been installed remotely, it would have 
been lost. I'm not sure what happened here, but I have a fully standard / stock 
config that I have barely modified at all other than installing some VM's (and 
virtmanager) onto. Seems like others had this issue, but it's still happening 
and is fairly important. Thanks for looking into it further.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2078461

Title:
  package openssh-server 1:9.6p1-3ubuntu13.5 failed to install/upgrade:
  installed openssh-server package post-installation script subprocess
  returned error exit status 1

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openssh/+bug/2078461/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to