Public bug reported:

Am developing some scripts using expect to automate builds/customised o/s 
containers and if I launch a container via a simple script -
#!/usr/bin/expect
spawn sudo systemd-nspawn -D /var/lib/machines/bother <- target is a vanilla 
Noble Numbat o/s
.. perform some basic cmds - adduser, moduser, set hostname etc

# then to exit the spawned container -
send "echo -ne  '/x1D/x1D/x1D'\r"
expect ":~$ "
send "\r"
exit

at the default bash shell - eharman@ubuntu-2604:~$ df
Filesystem                        1K-blocks     Used Available Use% Mounted on
tmpfs                                354252     1388    352864   1% /run
efivarfs                                128       74        50  61% 
/sys/firmware/efi/efivars
/dev/mapper/ubuntu--vg-ubuntu--lv 119595220 54127932  59969864  48% /
tmpfs                               1771256        0   1771256   0% /dev/shm
none                                   1024        0      1024   0% 
/run/credentials/systemd-journald.service
none                                   1024        0      1024   0% 
/run/credentials/systemd-resolved.service
/dev/sda2                           1992552   364604   1506708  20% /boot
tmpfs                               1771256        0   1771256   0% /tmp
/dev/sda1                           1098628     6452   1092176   1% /boot/efi
none                                   1024        0      1024   0% 
/run/credentials/systemd-networkd.service
none                                   1024        0      1024   0% 
/run/credentials/[email protected]
tmpfs                                354248        8    354240   1% 
/run/user/1000
tmpfs                                  4096        0      4096   0% 
/run/systemd/nspawn/unix-export/bother  <- the image is still referenced...
eharman@ubuntu-2604:~$ 
If I re-run my script it fails with -
Mount point '/run/systemd/nspawn/unix-export/bother' exists already, refusing.

Manualy unmounting this works so I assume a bug in systemd-mountfsd which is 
not cleaning up after my script exits.
If I manually invoke systemd-nspawn -D... it works as expected and unmounts the 
target upon exit, but obviously does not when called via expect + a spawned 
sub-process

ProblemType: Bug
DistroRelease: Ubuntu 26.04
Package: systemd-container 259.5-0ubuntu3
ProcVersionSignature: Ubuntu 7.0.0-15.15-generic 7.0.0
Uname: Linux 7.0.0-15-generic x86_64
ApportVersion: 2.34.0-0ubuntu2
Architecture: amd64
CasperMD5CheckResult: unknown
Date: Sat May 30 08:33:18 2026
InstallationDate: Installed on 2025-08-20 (283 days ago)
InstallationMedia: Ubuntu-Server 22.04.5 LTS "Jammy Jellyfish" - Release amd64 
(20240911.4)
ProcEnviron:
 LANG=en_GB.UTF-8
 PATH=(custom, no user)
 SHELL=/bin/bash
 TERM=xterm
 XDG_RUNTIME_DIR=<set>
SourcePackage: systemd
UpgradeStatus: Upgraded to resolute on 2026-05-13 (17 days ago)

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


** Tags: amd64 apport-bug resolute

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

Title:
  container has left an orphaned mount point

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


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

Reply via email to