systemctl doesn't work when running from `docker run $image chroot` command (Bionic)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
Invalid
|
Undecided
|
Unassigned |
Bug Description
1) Tested on fresh installed system using http://
Description: Ubuntu 18.04.4 LTS
Release: 18.04
2) The version of the systemd package via 'apt-cache policy systemd'
systemd:
Installed: 237-3ubuntu10.33
Candidate: 237-3ubuntu10.42
Version table:
237-
500 http://
237-
500 http://
*** 237-3ubuntu10.33 100
100 /var/lib/
237-3ubuntu10 500
500 http://
3) Steps to reproduce the problem
$ sudo su
$ apt update
$ apt install docker.io
$ docker pull ubuntu:latest
$ docker run -it -v /:/host_root:ro ubuntu:latest chroot /host_root/ systemctl -a
4) What you expected to happen: a list of all systemd units is expected to be displayed, e.g.
UNIT LOAD ACTIVE SUB DESCRIPTION
proc-
dev-cdrom.device loaded active plugged VBOX_CD-ROM
dev-disk-
....[cut out]....
5) What happened instead: get the following error message
Failed to connect to bus: No data available
6) The same steps tested on fresh installed Ubuntu Xenial OS using http://
And in this environment the `systemctl -a` command works well.
$ lsb_release -rd
Description: Ubuntu 16.04.6 LTS
Release: 16.04
$ apt-cache policy systemd
systemd:
Installed: 229-4ubuntu21.16
Candidate: 229-4ubuntu21.29
Version table:
229-
500 http://
229-
500 http://
*** 229-4ubuntu21.16 100
100 /var/lib/
229-4ubuntu4 500
500 http://
7) Additional notes: I tried to add `--privileged` options to `docker run` command but it didn't help.
Changed in systemd (Ubuntu): | |
status: | New → Invalid |
I found a solution that works for me: it is needed to add option `--pid host` option to `docker run` command.