package openssh-server 1:9.0p1-1ubuntu8.5 failed to install/upgrade: installed openssh-server package post-installation script subprocess returned error exit status 1

Bug #2039752 reported by Markle Liu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
openssh (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

I don't known, but the system report the bug

ProblemType: Package
DistroRelease: Ubuntu 23.04
Package: openssh-server 1:9.0p1-1ubuntu8.5
ProcVersionSignature: Ubuntu 6.2.0-34.34-generic 6.2.16
Uname: Linux 6.2.0-34-generic x86_64
ApportVersion: 2.26.1-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Thu Oct 19 09:27:02 2023
ErrorMessage: installed openssh-server package post-installation script subprocess returned error exit status 1
InstallationDate: Installed on 2023-10-18 (0 days ago)
InstallationMedia: Ubuntu 23.04 "Lunar Lobster" - Release amd64 (20230418)
Python3Details: /usr/bin/python3.11, Python 3.11.4, python3-minimal, 3.11.2-1
PythonDetails: N/A
RelatedPackageVersions:
 dpkg 1.21.21ubuntu1
 apt 2.6.0ubuntu0.1
SourcePackage: openssh
Title: package openssh-server 1:9.0p1-1ubuntu8.5 failed to install/upgrade: installed openssh-server package post-installation script subprocess returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Markle Liu (markle61) wrote :
Revision history for this message
Mitchell Dzurick (mitchdz) wrote (last edit ):

Relevant Dpkg errors:

openssh-server (1:9.0p1-1ubuntu8.5) over (1:9.0p1-1ubuntu8)
...
Setting up openssh-server (1:9.0p1-1ubuntu8.5) ...
rescue-ssh.target is a disabled or a static unit not running, not starting it.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 145.
dpkg: error processing package openssh-server (--configure):
 installed openssh-server package post-installation script subprocess returned error exit status 1

So this error was seen when upgrading from the release version of openssh in Lunar to the current latest version in updates.

I tried to reproduce in an lxc container. Had to downgrade 2 packages like so:
$ lxc launch ubuntu:lunar l
$ lxc shell l
# apt install -y openssh-client=1:9.0p1-1ubuntu8 -y --allow-downgrades
# apt install -y openssh-sftp-server=1:9.0p1-1ubuntu8 -y --allow-downgrades

upon downgrading openssh-server I see this error

Selecting previously unselected package openssh-server.
(Reading database ... 33940 files and directories currently installed.)
Preparing to unpack .../openssh-server_1%3a9.0p1-1ubuntu8_amd64.deb ...
Unpacking openssh-server (1:9.0p1-1ubuntu8) ...
Setting up openssh-server (1:9.0p1-1ubuntu8) ...
rescue-ssh.target is a disabled or a static unit not running, not starting it.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 145.
dpkg: error processing package openssh-server (--configure):
 installed openssh-server package post-installation script subprocess returned error exit stat
us 1
dmesg: read kernel buffer failed: Operation not permitted
                                                         Processing triggers for man-db (2.11.
2-1) ...
Processing triggers for ufw (0.36.1-4.1ubuntu0.1) ...
Errors were encountered while processing:
 openssh-server
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Attempting to upgrade to 8.5 I see:

root@l:~# apt-cache policy openssh-server
Setting up openssh-client (1:9.0p1-1ubuntu8.5) ...
Setting up openssh-sftp-server (1:9.0p1-1ubuntu8.5) ...
Setting up openssh-server (1:9.0p1-1ubuntu8.5) ...
rescue-ssh.target is a disabled or a static unit not running, not starting it.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 145.
dpkg: error processing package openssh-server (--configure):
 installed openssh-server package post-installation script subprocess returned error exit stat
us 1
dmesg: read kernel buffer failed: Operation not permitted
                                                         Processing triggers for man-db (2.11.
2-1) ...
Processing triggers for ufw (0.36.1-4.1ubuntu0.1) ...
Errors were encountered while processing:
 openssh-server
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

Revision history for this message
Mitchell Dzurick (mitchdz) wrote :

I only see those errors in a container. When I launch a VM to try this, I see no errors.

$ lxc launch ubuntu:lunar l-vm --vm
$ lxc shell l-vm
# apt install -y openssh-client=1:9.0p1-1ubuntu8 -y --allow-downgrades
# apt install -y openssh-sftp-server=1:9.0p1-1ubuntu8 -y --allow-downgrades
# apt install -y openssh-server=1:9.0p1-1ubuntu8 -y --allow-downgrades
# apt install -y openssh-server=1:9.0p1-1ubuntu8.5
...
Setting up openssh-client (1:9.0p1-1ubuntu8.5) ...
Setting up openssh-sftp-server (1:9.0p1-1ubuntu8.5) ...
Setting up openssh-server (1:9.0p1-1ubuntu8.5) ...
rescue-ssh.target is a disabled or a static unit not running, not starting it.
Processing triggers for man-db (2.11.2-1) ...
Processing triggers for ufw (0.36.1-4.1ubuntu0.1) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

No VM guests are running outdated hypervisor (qemu) binaries on this host.

Revision history for this message
Mitchell Dzurick (mitchdz) wrote (last edit ):

Interesting, I tried in a new LXC container and I see it working now.
$ lxc launch ubuntu:lunar l
$ lxc shell l
# apt install -y openssh-client=1:9.0p1-1ubuntu8 -y --allow-downgrades
# apt install -y openssh-sftp-server=1:9.0p1-1ubuntu8 -y --allow-downgrades
# apt install -y openssh-server=1:9.0p1-1ubuntu8 -y --allow-downgrades
# apt install -y openssh-server=1:9.0p1-1ubuntu8.5 -y

In my original container, the upgrade failed because tinysshd.socket was using port 22 so when openssh-server.postinst attempted to run `deb-systemd-invoke restart ssh.socket` it failed due to resource issues (port 22 already being used) which caused dpkg to fail. I assume this is the same case in the bug report

Revision history for this message
Mitchell Dzurick (mitchdz) wrote (last edit ):

@Markle Liu if you still have your system in the affected state, could you please give the output of these following commands?

# systemctl status ssh.{socket,service} tinysshd.socket
# lsof -i :22
# systemctl list-units | grep ssh

Changed in openssh (Ubuntu):
status: New → Incomplete
Revision history for this message
Steve Langasek (vorlon) wrote :

Why did you have tinysshd installed in your container? That's not part of a default Ubuntu system.

Bryce Harrington (bryce)
Changed in openssh (Ubuntu):
status: Incomplete → New
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for openssh (Ubuntu) because there has been no activity for 60 days.]

Changed in openssh (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.