Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User defined units work whenever systemctl wants. #32768

Open
VentGrey opened this issue May 12, 2024 · 2 comments
Open

User defined units work whenever systemctl wants. #32768

VentGrey opened this issue May 12, 2024 · 2 comments
Labels
bug 🐛 Programming errors, that need preferential fixing needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer systemctl

Comments

@VentGrey
Copy link

systemd version the issue has been seen with

254

Used distribution

Debian 12

Linux kernel version used

6.6.13+bpo-amd64

CPU architectures issue was seen on

x86_64

Component

systemctl

Expected behaviour you didn't see

User defined units working perfectly. Like they should since version 239 🤦

These unprivileged unit-files work when they want, no matter the method used to generate them.

Unexpected behaviour you saw

You tell me:

~$ systemctl --user daemon-reload
~$ systemctl --user start podmandemo

Failed to start podmandemo.service: Unit podmandemo.service not found.

# Okay, let's test if file exists...
~$ [ -f ~/.config/systemd/user/podmandemo.service ] && echo 1 || echo 0
1

Steps to reproduce the problem

  1. Create a systemd unit file in $HOME/.config/systemd/user
  2. Do a systemctl --user daemon-reload
  3. Try to enable or activate your unit file
  4. Enjoy failing

// Alternatively

  1. Create a podman container
  2. Generate your container/pod unit file with podman generate systemd --new enable-sysadmin > ~/.config/systemd/user/podmandemo.service
  3. Perform a systemctl --user daemon-reload
  4. Try starting/enabling your service
  5. Pray that systemctl wants to enable your service this time.
  6. Enjoy success or failure

This also happens when:

  • Expanding the XDG_RUNTIME_DIR=/run/user/$UID is used before the systemctl command
  • Direct sessions (e.g: ssh) into the user where you wish to create the unprivileged unit-file.

Additional program output to the terminal or log subsystem illustrating the issue

For: systemctl --user daemon-reload

Cannot stat /proc/1/root: Permiso denegado
running_in_chroot(): Permiso denegado
Bus n/a: changing state UNSET → OPENING
sd-bus: starting bus by connecting to /run/user/1091/systemd/private...
Bus n/a: changing state OPENING → AUTHENTICATING
Bus n/a: changing state AUTHENTICATING → RUNNING
Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=Reload cookie=1 reply_cookie=0 signature=n/a error-name=n/a error-message=n/a
Got message type=method_return sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a  cookie=323 reply_cookie=1 signature=n/a error-name=n/a error-message=n/a
Bus n/a: changing state RUNNING → CLOSED

For systemctl --user enable podmandemo.service:

Cannot stat /proc/1/root: Permiso denegado
running_in_chroot(): Permiso denegado
Bus n/a: changing state UNSET → OPENING
sd-bus: starting bus by connecting to /run/user/1091/systemd/private...
Bus n/a: changing state OPENING → AUTHENTICATING
Executing dbus call org.freedesktop.systemd1.Manager StartUnit(podmandemo.service, replace)
Bus n/a: changing state AUTHENTICATING → RUNNING
Sent message type=method_call sender=n/a destination=org.freedesktop.systemd1 path=/org/freedesktop/systemd1 interface=org.freedesktop.systemd1.Manager member=StartUnit cookie=1 reply_cookie=0 signature=ss error-name=n/a error-message=n/a
Got message type=error sender=org.freedesktop.systemd1 destination=n/a path=n/a interface=n/a member=n/a  cookie=1 reply_cookie=1 signature=s error-name=org.freedesktop.systemd1.NoSuchUnit error-message=Unit podmandemo.service not found.
@VentGrey VentGrey added the bug 🐛 Programming errors, that need preferential fixing label May 12, 2024
@yuwata
Copy link
Member

yuwata commented May 12, 2024

Please provide the result of cat ~/.config/systemd/user/podmandemo.service.

@yuwata yuwata added the needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer label May 12, 2024
@poettering
Copy link
Member

also do "systemd-analyze --user log-level debug", and then reproduce the issue and provide logs around the issue from journalctl here, otherwise this is not actionable to us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Programming errors, that need preferential fixing needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer systemctl
Development

No branches or pull requests

3 participants