[Bug 2068909] [NEW] systemctl disable, unmask, enable, restart ssh fail
lgourvenec
2068909 at bugs.launchpad.net
Mon Jun 10 14:25:25 UTC 2024
Public bug reported:
Bug observed on Ubuntu Jammy (22.04) only (not on 20.04 or 24.04) with
systemd 249 (249.11-0ubuntu3.12 and 249.11-0ubuntu3.9)
Steps to reproduce :
1. Download ISO image at https://releases.ubuntu.com/22.04.4/ubuntu-22.04.4-live-server-amd64.iso
2. Create a VM (I use VirtualBox) with this image
3. During install, don't forget to install sshd
4. After log in, become root and enter the following commands:
```
systemctl disable ssh
systemctl unmask ssh
systemctl enable ssh
systemctl restart ssh
```
You should get the following error message:
```
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xeu ssh.service" for details.
```
"journalctl -u ssh":
```
juin 07 16:04:10 zephir systemd[1]: Starting OpenBSD Secure Shell server...
juin 07 16:04:10 zephir systemd[1]: ssh.service: Found left-over process 3775 (sshd) in control group while starting unit. Ignoring.
juin 07 16:04:10 zephir systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
juin 07 16:04:10 zephir sshd[4380]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
juin 07 16:04:10 zephir sshd[4380]: fatal: Cannot bind any address.
juin 07 16:04:10 zephir systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
juin 07 16:04:10 zephir systemd[1]: ssh.service: Failed with result 'exit-code'.
juin 07 16:04:10 zephir systemd[1]: ssh.service: Unit process 3775 (sshd) remains running after unit stopped.
juin 07 16:04:10 zephir systemd[1]: Failed to start OpenBSD Secure Shell server.
```
What happened is that systemd didn't stop sshd. Doing a "systemctl stop
ssh" and the "ps aux | grep sshd" shows that the process isn't killed.
Note: I know, it is dumb to disable then unmask, then enable then
restart a service. But, it should not fail. And, as you can guess, these
4 commands are a small extract from multiple scripts run on servers to
set/reset the configuration of these servers.
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: systemd 249.11-0ubuntu3.9
ProcVersionSignature: Ubuntu 5.15.0-112.122-generic 5.15.152
Uname: Linux 5.15.0-112-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckMismatches: ./boot/grub/grub.cfg
CasperMD5CheckResult: fail
CloudArchitecture: x86_64
CloudID: none
CloudName: none
CloudPlatform: none
CloudSubPlatform: config
Date: Mon Jun 10 13:47:28 2024
InstallationDate: Installed on 2024-06-10 (0 days ago)
InstallationMedia: Ubuntu-Server 22.04.3 LTS "Jammy Jellyfish" - Release amd64 (20230810)
Lsusb:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Lsusb-t:
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/12p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/12p, 480M
MachineType: innotek GmbH VirtualBox
ProcEnviron:
TERM=linux
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-5.15.0-112-generic root=/dev/mapper/ubuntu--vg-ubuntu--lv ro
SourcePackage: systemd
SystemdFailedUnits:
Error: command ['systemctl', 'status', '--full', '●'] failed with exit code 4: Invalid unit name "●" escaped as "\xe2\x97\x8f" (maybe you should use systemd-escape?).
Unit \xe2\x97\x8f.service could not be found.
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 12/01/2006
dmi.bios.vendor: innotek GmbH
dmi.bios.version: VirtualBox
dmi.board.name: VirtualBox
dmi.board.vendor: Oracle Corporation
dmi.board.version: 1.2
dmi.chassis.type: 1
dmi.chassis.vendor: Oracle Corporation
dmi.modalias: dmi:bvninnotekGmbH:bvrVirtualBox:bd12/01/2006:svninnotekGmbH:pnVirtualBox:pvr1.2:rvnOracleCorporation:rnVirtualBox:rvr1.2:cvnOracleCorporation:ct1:cvr:sku:
dmi.product.family: Virtual Machine
dmi.product.name: VirtualBox
dmi.product.version: 1.2
dmi.sys.vendor: innotek GmbH
** Affects: systemd (Ubuntu)
Importance: Undecided
Status: New
** Tags: amd64 apport-bug jammy uec-images
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2068909
Title:
systemctl disable, unmask, enable, restart ssh fail
Status in systemd package in Ubuntu:
New
Bug description:
Bug observed on Ubuntu Jammy (22.04) only (not on 20.04 or 24.04) with
systemd 249 (249.11-0ubuntu3.12 and 249.11-0ubuntu3.9)
Steps to reproduce :
1. Download ISO image at https://releases.ubuntu.com/22.04.4/ubuntu-22.04.4-live-server-amd64.iso
2. Create a VM (I use VirtualBox) with this image
3. During install, don't forget to install sshd
4. After log in, become root and enter the following commands:
```
systemctl disable ssh
systemctl unmask ssh
systemctl enable ssh
systemctl restart ssh
```
You should get the following error message:
```
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xeu ssh.service" for details.
```
"journalctl -u ssh":
```
juin 07 16:04:10 zephir systemd[1]: Starting OpenBSD Secure Shell server...
juin 07 16:04:10 zephir systemd[1]: ssh.service: Found left-over process 3775 (sshd) in control group while starting unit. Ignoring.
juin 07 16:04:10 zephir systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
juin 07 16:04:10 zephir sshd[4380]: error: Bind to port 22 on 0.0.0.0 failed: Address already in use.
juin 07 16:04:10 zephir sshd[4380]: fatal: Cannot bind any address.
juin 07 16:04:10 zephir systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
juin 07 16:04:10 zephir systemd[1]: ssh.service: Failed with result 'exit-code'.
juin 07 16:04:10 zephir systemd[1]: ssh.service: Unit process 3775 (sshd) remains running after unit stopped.
juin 07 16:04:10 zephir systemd[1]: Failed to start OpenBSD Secure Shell server.
```
What happened is that systemd didn't stop sshd. Doing a "systemctl
stop ssh" and the "ps aux | grep sshd" shows that the process isn't
killed.
Note: I know, it is dumb to disable then unmask, then enable then
restart a service. But, it should not fail. And, as you can guess,
these 4 commands are a small extract from multiple scripts run on
servers to set/reset the configuration of these servers.
ProblemType: Bug
DistroRelease: Ubuntu 22.04
Package: systemd 249.11-0ubuntu3.9
ProcVersionSignature: Ubuntu 5.15.0-112.122-generic 5.15.152
Uname: Linux 5.15.0-112-generic x86_64
ApportVersion: 2.20.11-0ubuntu82.5
Architecture: amd64
CasperMD5CheckMismatches: ./boot/grub/grub.cfg
CasperMD5CheckResult: fail
CloudArchitecture: x86_64
CloudID: none
CloudName: none
CloudPlatform: none
CloudSubPlatform: config
Date: Mon Jun 10 13:47:28 2024
InstallationDate: Installed on 2024-06-10 (0 days ago)
InstallationMedia: Ubuntu-Server 22.04.3 LTS "Jammy Jellyfish" - Release amd64 (20230810)
Lsusb:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Lsusb-t:
/: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ohci-pci/12p, 12M
|__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 12M
/: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/12p, 480M
MachineType: innotek GmbH VirtualBox
ProcEnviron:
TERM=linux
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-5.15.0-112-generic root=/dev/mapper/ubuntu--vg-ubuntu--lv ro
SourcePackage: systemd
SystemdFailedUnits:
Error: command ['systemctl', 'status', '--full', '●'] failed with exit code 4: Invalid unit name "●" escaped as "\xe2\x97\x8f" (maybe you should use systemd-escape?).
Unit \xe2\x97\x8f.service could not be found.
UpgradeStatus: No upgrade log present (probably fresh install)
dmi.bios.date: 12/01/2006
dmi.bios.vendor: innotek GmbH
dmi.bios.version: VirtualBox
dmi.board.name: VirtualBox
dmi.board.vendor: Oracle Corporation
dmi.board.version: 1.2
dmi.chassis.type: 1
dmi.chassis.vendor: Oracle Corporation
dmi.modalias: dmi:bvninnotekGmbH:bvrVirtualBox:bd12/01/2006:svninnotekGmbH:pnVirtualBox:pvr1.2:rvnOracleCorporation:rnVirtualBox:rvr1.2:cvnOracleCorporation:ct1:cvr:sku:
dmi.product.family: Virtual Machine
dmi.product.name: VirtualBox
dmi.product.version: 1.2
dmi.sys.vendor: innotek GmbH
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2068909/+subscriptions
More information about the foundations-bugs
mailing list