Skip to content

systemd fails to enable certain units when /etc/systemd/system is a symlink #22961

@mrc0mmand

Description

@mrc0mmand

systemd version the issue has been seen with

v250.4

Used distribution

Fedora Rawhide

Fedora Rawhide:

# systemctl disable cups
Removed /etc/systemd/system/multi-user.target.wants/cups.path.
Removed /etc/systemd/system/sockets.target.wants/cups.socket.
# systemctl enable cups
Created symlink /etc/systemd/system/printer.target.wants/cups.service → /usr/lib/systemd/system/cups.service.
Created symlink /etc/systemd/system/multi-user.target.wants/cups.service → /usr/lib/systemd/system/cups.service.
Created symlink /etc/systemd/system/sockets.target.wants/cups.socket → /usr/lib/systemd/system/cups.socket.
Created symlink /etc/systemd/system/multi-user.target.wants/cups.path → /usr/lib/systemd/system/cups.path.
# mv /etc/systemd/system /etc/systemd/system.old
# ln -s /etc/systemd/system.old/ /etc/systemd/system
# systemctl daemon-reload
# systemctl disable cups
Removed /etc/systemd/system/multi-user.target.wants/cups.service.
Removed /etc/systemd/system/multi-user.target.wants/cups.path.
Removed /etc/systemd/system/printer.target.wants/cups.service.
Removed /etc/systemd/system/sockets.target.wants/cups.socket.
# systemctl enable cups
Failed to enable unit: Unit file /etc/systemd/system/printer.target.wants/cups.service does not exist.

This, however, works in F35 (after fixing the printers.target -> printer.target in cups.service):

# mv /etc/systemd/system /etc/systemd/system.old
# ln -s /etc/systemd/system.old /etc/systemd/system
# systemctl disable cups
Removed /etc/systemd/system/multi-user.target.wants/cups.path.
Removed /etc/systemd/system/multi-user.target.wants/cups.service.
Removed /etc/systemd/system/sockets.target.wants/cups.socket.
Removed /etc/systemd/system/printer.target.wants/cups.service.
# systemctl enable cups
Created symlink /etc/systemd/system/printer.target.wants/cups.service → /usr/lib/systemd/system/cups.service.
Created symlink /etc/systemd/system/multi-user.target.wants/cups.service → /usr/lib/systemd/system/cups.service.
Created symlink /etc/systemd/system/sockets.target.wants/cups.socket → /usr/lib/systemd/system/cups.socket.
Created symlink /etc/systemd/system/multi-user.target.wants/cups.path → /usr/lib/systemd/system/cups.path.

The behavior is the same with SELinux both in enforcing and permissive modes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    pid1regression ⚠️A bug in something that used to work correctly and broke through some recent commit

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions