[Bug 1995294] Re: rmdir: failed to remove '/etc/systemd/system/ssh.socket.d': Directory not empty

Nick Rosbrook 1995294 at bugs.launchpad.net
Thu Nov 3 10:12:39 UTC 2022


I have verified the fix using openssh-server from kinetic-proposed:

root at jammy:~# grep "^ListenAddress" /etc/ssh/sshd_config
ListenAddress 0.0.0.0
ListenAddress ::
root at jammy:~# systemctl edit ssh.socket
root at jammy:~# cat /etc/systemd/system/ssh.socket.d/override.conf 
[Unit]
Description=SRU verification
root at jammy:~# systemctl daemon-reload
root at jammy:~# systemctl status ssh.socket
○ ssh.socket - SRU verification
     Loaded: loaded (/lib/systemd/system/ssh.socket; disabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/ssh.socket.d
             └─override.conf
     Active: inactive (dead)
     Listen: [::]:22 (Stream)
   Accepted: 0; Connected: 0;
root at jammy:~# vi /etc/apt/sources.list
root at jammy:~# cat /etc/apt/sources.list
# Generated by distrobuilder
deb http://archive.ubuntu.com/ubuntu kinetic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu kinetic-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu kinetic-security main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu kinetic-proposed main restricted universe multiverse
root at jammy:~# apt update && apt dist-upgrade
[ ... ]
root at jammy:~# apt-cache policy openssh-server
openssh-server:
  Installed: 1:9.0p1-1ubuntu7.1
  Candidate: 1:9.0p1-1ubuntu7.1
  Version table:
 *** 1:9.0p1-1ubuntu7.1 500
        500 http://security.ubuntu.com/ubuntu kinetic-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     1:9.0p1-1ubuntu7 500
        500 http://archive.ubuntu.com/ubuntu kinetic/main amd64 Packages

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

Title:
  rmdir: failed to remove '/etc/systemd/system/ssh.socket.d': Directory
  not empty

Status in openssh package in Ubuntu:
  Triaged
Status in openssh source package in Kinetic:
  Fix Committed

Bug description:
  [Impact]

  If a user a has an existing drop-in config for ssh.socket in
  /etc/systemd/system/ssh.socket.d upgrades to kinetic, and openssh-
  server.postint determines it should *not* perform migration to socket-
  activated ssh, they will receive an error from dpkg:

  Errors were encountered while processing:
   openssh-server
  Exception during pm.DoInstall():  E:Sub-process /usr/bin/dpkg returned an error code (1)

  Could not install the upgrades

  The upgrade has aborted. Your system could be in an unusable state. A 
  recovery will run now (dpkg --configure -a). 

  Please report this bug in a browser at 
  http://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+filebug 
  and attach the files in /var/log/dist-upgrade/ to the bug report. 
  E:Sub-process /usr/bin/dpkg returned an error code (1) 

  Setting up openssh-server (1:9.0p1-1ubuntu7) ...
  rmdir: failed to remove '/etc/systemd/system/ssh.socket.d': Directory not empty
  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

  [Test Plan]

  * On a Jammy machine, install openssh-server if necessary. Edit
  /etc/ssh/sshd_config to contain the following:

  $ cat /etc/ssh/sshd_config
  [... defaults everywhere else ...]

  #Port 22
  #AddressFamily any
  ListenAddress 0.0.0.0
  ListenAddress ::

  [... defaults everywhere else ...]

  * Create a trivial drop-in override for ssh.socket:

  $ systemctl edit ssh.socket
  $ cat /etc/systemd/system/ssh.socket.d/override.conf 
  [Unit]
  Description=Testing

  * Now perform an upgrade to Kinetic, and observe the dpkg error.

  [Where problems could occur]
  The solution should be to use rmdir's --ignore-fail-on-empty flag. If the flag was mis-spelled, that would produce a new error.

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




More information about the foundations-bugs mailing list