[Bug 1959475] [NEW] "machinectl shell" connections immediately terminated

Launchpad Bug Tracker 1959475 at bugs.launchpad.net
Thu Sep 15 15:35:14 UTC 2022


You have been subscribed to a public bug by Matthieu Clemenceau (mclemenceau):

[Impact]

This bug prevents users on Impish and newer from connecting to Focal
systemd containers using `machinectl shell`. This limits users ability
to manage containers spawned with systemd-nspawn.

[Test Plan]

On a Jammy host, do the following:

* Install systemd-container and debootstrap if necessary:

  $ sudo apt install debootstrap systemd-container

* Create a Focal filesystem for the container:

  $ sudo debootstrap --arch=<arch> focal /var/lib/containers/lp1959475/

* Launch the container:

  $ sudo systemd-nspawn -D /var/lib/containers/lp1959475/ --machine
test-container

* Inside the container, set a password for root and then exit:

  $ passwd # Enter password when prompted
  $ exit

* Re-launch the container with -b option:

  $ sudo systemd-nspawn -D /var/lib/containers/lp1959475/ --machine
test-container -b

* In a separate terminal window, try to connect to the container:

  $ sudo machinectl shell test-container

* Observe the "Connection to machine test-container terminated" error
message.

[Where problems could occur]

The patch expands the case where the TERM variable is inherited from PID
1 when building an execution environment, e.g. for a container. If
problems were to occur, it would be related to the value of TERM in
environments forked off of PID 1.

[Other Info]

This bug occurs when trying to connect to a Focal container from e.g. a Jammy host. For SRU verification, the container
should be Focal, and the host should be Jammy. The -proposed package should be installed in the Focal container.

[Original Description]

The command "machinectl shell" does not work in systemd 249.9-0ubuntu2:

$ sudo machinectl shell ns-xxx
Connected to machine ns-xxx. Press ^] three times within 1s to exit session.

Connection to machine ns-xxx terminated.

The issue seems to be described here:
https://forum.manjaro.org/t/the-machinectl-shell-command-stopped-working-after-systemd-upgrade-to-250-2-1/99899
https://github.com/systemd/systemd/issues/22234

and solved here:

https://github.com/systemd/systemd/commit/e8cf09b2a2ad0d48e5493050d54251d5f512d9b6

** Affects: systemd (Ubuntu)
     Importance: Medium
         Status: Fix Released

** Affects: systemd (Ubuntu Focal)
     Importance: Medium
         Status: Fix Committed


** Tags: focal foundations-todo fr-2315 verification-done verification-done-focal
-- 
"machinectl shell" connections immediately terminated
https://bugs.launchpad.net/bugs/1959475
You received this bug notification because you are a member of Ubuntu Foundations Bugs, which is subscribed to the bug report.



More information about the foundations-bugs mailing list