rtkit icon indicating copy to clipboard operation
rtkit copied to clipboard

sd_notify does not work with chroot

Open dasJ opened this issue 3 years ago • 1 comments

Inspecting systemctl status rtkit-daemon shows no Status: line. This is because the daemon cannot access the notify socket after chroot():

[pid  1777] sendmsg(7<UNIX:[186709]>, {msg_name={sa_family=AF_UNIX, sun_path="/run/systemd/notify"}, msg_namelen=22, msg_iov=[{iov_base="STATUS=Supervising 6 threads of 4 processes of 1 users.", iov_len=55}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_NOSIGNAL) = -1 ENOENT (No such file or directory)

The only solution I can think of is opening the socket before chrooting and writing to the existing socket rather than using sd_notify.

dasJ avatar Jul 04 '22 10:07 dasJ

Found this workaround in the systemd unit:

[Service]
TemporaryFileSystem=/proc/fs
BindPaths=/run/systemd/notify:/proc/fs/sd-notify
Environment=NOTIFY_SOCKET=/fs/sd-notify

We need to use the fs folder because we cannot create new folders in /proc and we need to mount a new tmpfs over it because we cannot create new files in the folder.

dasJ avatar Jul 04 '22 10:07 dasJ