nerdctl icon indicating copy to clipboard operation
nerdctl copied to clipboard

[CentOS 7] cannot install containerd-rootless-setuptool.sh (`[ERROR] Needs systemd (systemctl --user)`)

Open LGinC opened this issue 2 years ago • 5 comments

[opc@instance-20200628-1517 ~]$ containerd-rootless-setuptool.sh install
[ERROR] Needs systemd (systemctl --user)

my install step

wget https://github.com/containerd/nerdctl/releases/download/v0.15.0/nerdctl-full-0.15.0-linux-amd64.tar.gz
sudo tar Cxzvf /usr/local/ nerdctl-full-0.15.0-linux-amd64.tar.gz
sudo cp /usr/local/lib/systemd/system/*.service /etc/systemd/system/
sudo systemctl enable buildkit containerd
sudo systemctl start buildkit containerd

os info

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
[opc@instance-20200628-1517 ~]$ systemctl --user show-environment
Failed to get D-Bus connection: No such file or directory

LGinC avatar Jan 10 '22 03:01 LGinC

The setup tool doesn’t support CentOS 7. Please upgrade to Rocky 8 or Alma 8.

AkihiroSuda avatar Jan 10 '22 07:01 AkihiroSuda

But probably you can directly run containerd-rootless.sh w/o setuptool on CentOS7

AkihiroSuda avatar Jan 10 '22 07:01 AkihiroSuda

But probably you can directly run containerd-rootless.sh w/o setuptool on CentOS7 yes, just run /usr/local/bin/containerd-rootless.sh and get log

INFO[2022-01-10T07:56:01.872203924Z] Connect containerd service
INFO[2022-01-10T07:56:01.872256885Z] Get image filesystem path "/var/lib/containerd/io.containerd.snapshotter.v1.overlayfs"
WARN[2022-01-10T07:56:01.872264298Z] Running containerd in a user namespace typically requires disable_cgroup, disable_apparmor, restrict_oom_score_adj set to be true
INFO[2022-01-10T07:56:01.872771898Z] loading plugin "io.containerd.grpc.v1.introspection"...  type=io.containerd.grpc.v1
INFO[2022-01-10T07:56:01.873070913Z] serving...                                    address=/run/containerd/containerd.sock.ttrpc
INFO[2022-01-10T07:56:01.873144943Z] serving...                                    address=/run/containerd/containerd.sock
INFO[2022-01-10T07:56:01.873171134Z] containerd successfully booted in 0.109181s
INFO[2022-01-10T07:56:01.874657354Z] Start subscribing containerd event
INFO[2022-01-10T07:56:01.880781377Z] Start recovering state
INFO[2022-01-10T07:56:01.880899831Z] Start event monitor
INFO[2022-01-10T07:56:01.880915951Z] Start snapshots syncer
INFO[2022-01-10T07:56:01.880924669Z] Start cni network conf syncer
INFO[2022-01-10T07:56:01.880935639Z] Start streaming server

but no permitted when I run nerdctl run --rm -it alpine

FATA[0003] failed to mount /run/user/1000/containerd-mount3927543818: operation not permitted

LGinC avatar Jan 10 '22 08:01 LGinC

I've found some workaround for this:

  1. Create a file /etc/systemd/system/user@YOUR_NON-ROOT_USER_ID.service with next content: ---------Start file---------

[Unit] Description=User Manager for UID %i After=systemd-user-sessions.service

After=user-runtime-dir@%i.service Wants=user-runtime-dir@%i.service

[Service] LimitNOFILE=infinity LimitNPROC=infinity User=%i PAMName=systemd-user Type=notify

PermissionsStartOnly=true ExecStartPre=/bin/loginctl enable-linger %i ExecStart=-/lib/systemd/systemd --user Slice=user-%i.slice KillMode=mixed Delegate=yes TasksMax=infinity Restart=always RestartSec=15

[Install] WantedBy=default.target ---------End file---------

  1. Run next commands: systemctl daemon-reload systemctl enable user@YOUR_NON-ROOT_USER_ID.service systemctl start user@YOUR_NON-ROOT_USER_ID.service

  2. Export XDG_RUNTIME: export XDG_RUNTIME_DIR=/run/user/$(id -ru)

Now you can communicate with dbus.

alff avatar May 04 '22 18:05 alff

@alff thinks

thinkgos avatar Jul 25 '22 12:07 thinkgos