Public bug reported:

### Summary

`openssh-server` fails to configure during installation on Ubuntu 24.04
due to a mismatch between systemd socket activation and post-
installation script expectations.

---

### Description

During installation of `openssh-server`, the package fails to configure
with the following error:

```
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)
```

The failure occurs during the post-installation phase.

---

### System State

* OS: Ubuntu 24.04
* init system: systemd
* `ssh.socket` is enabled
* `ssh.service` is inactive (dead)

Output of `systemctl status ssh`:

```
○ ssh.service - OpenBSD Secure Shell server
     Loaded: loaded (/usr/lib/systemd/system/ssh.service; enabled; preset: 
enabled)
     Active: inactive (dead)
TriggeredBy: × ssh.socket
```

However, previous logs show that the SSH server was able to start and
listen correctly:

```
Server listening on 0.0.0.0 port 22.
Server listening on :: port 22.
```

---

### Verification

* SSH configuration is valid:

```
sudo sshd -t
# (no output, no errors)
```

* The issue is not caused by configuration errors

---

### Expected Behavior

`openssh-server` should install and configure successfully regardless of
whether the system uses:

* traditional service mode (`ssh.service` active), or
* systemd socket activation (`ssh.socket` enabled)

---

### Actual Behavior

The installation fails because the post-installation script appears to
assume that `ssh.service` must be in an active (running) state after
startup.

This assumption does not hold when `ssh.socket` is enabled, since in
that mode:

* `ssh.socket` handles listening on port 22
* `ssh.service` may remain inactive until triggered

---

### Analysis

This appears to be a mismatch between:

* systemd socket activation behavior
* `openssh-server` post-installation script expectations

Even though SSH is functionally operational and correctly configured,
the package installation fails due to service state validation.

---

### Workaround

Disabling socket activation resolves the issue:

```
sudo systemctl disable --now ssh.socket
sudo systemctl enable --now ssh.service
sudo dpkg --configure -a
```

---

### Impact

This issue may affect users who:

* rely on systemd socket activation
* or have systems where `ssh.socket` is enabled by default or manually

It prevents successful installation/configuration of `openssh-server`
even when the service is otherwise functional.

---

### Suggestion

The post-installation script of `openssh-server` should be updated to:

* correctly handle socket-activated setups, or
* avoid assuming that `ssh.service` must be actively running

---

### Additional Notes

This does not appear to be caused by user misconfiguration, as:

* SSH configuration is valid
* SSH has previously started successfully
* Failure occurs specifically during package configuration

ProblemType: Package
DistroRelease: Ubuntu 24.04
Package: openssh-server 1:9.6p1-3ubuntu13.15
ProcVersionSignature: Ubuntu 6.17.0-14.14~24.04.1-generic 6.17.9
Uname: Linux 6.17.0-14-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.28.1-0ubuntu3.8
AptOrdering:
 sublime-text:amd64: Install
 NULL: ConfigurePending
Architecture: amd64
CasperMD5CheckResult: pass
Date: Mon Apr 13 11:32:47 2026
DpkgHistoryLog:
 Start-Date: 2026-04-13  11:32:45
 Commandline: apt-get install sublime-text
 Requested-By: nemo (1000)
 Install: sublime-text:amd64 (4200)
ErrorMessage: 已安装 openssh-server 软件包 post-installation 脚本 子进程返回错误状态 1
InstallationDate: Installed on 2025-03-28 (381 days ago)
InstallationMedia: Ubuntu 24.04.1 LTS "Noble Numbat" - Release amd64 
(20240827.1)
Python3Details: /usr/bin/python3.12, Python 3.12.3, python3-minimal, 
3.12.3-0ubuntu2.1
PythonDetails: N/A
RelatedPackageVersions:
 dpkg 1.22.6ubuntu6.5
 apt  2.8.3
SourcePackage: openssh
Title: package openssh-server 1:9.6p1-3ubuntu13.15 failed to install/upgrade: 
已安装 openssh-server 软件包 post-installation 脚本 子进程返回错误状态 1
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: openssh (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-package noble third-party-packages

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

Title:
  package openssh-server 1:9.6p1-3ubuntu13.15 failed to install/upgrade:
  已安装 openssh-server 软件包 post-installation 脚本 子进程返回错误状态 1

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


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

Reply via email to