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

systemctl disable [--now] someunit@* gives wrong error message #32599

Closed
PenelopeFudd opened this issue May 1, 2024 · 2 comments · Fixed by #32600
Closed

systemctl disable [--now] someunit@* gives wrong error message #32599

PenelopeFudd opened this issue May 1, 2024 · 2 comments · Fixed by #32600
Labels
bug 🐛 Programming errors, that need preferential fixing systemctl

Comments

@PenelopeFudd
Copy link

PenelopeFudd commented May 1, 2024

systemd version the issue has been seen with

255.4-1.fc40

Used distribution

Fedora 40

Linux kernel version used

6.8.7-300.fc40.x86_64

CPU architectures issue was seen on

x86_64

Component

systemctl

Expected behaviour you didn't see

# systemctl disable [--now] stunnel@\*

Glob pattern passed to disable, but globs are not supported for this.
Invalid unit name "stunnel@*" escaped as "stunnel@\x2a".

Unexpected behaviour you saw

# systemctl disable [--now] stunnel@\*

Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "stunnel@*" escaped as "stunnel@\x2a".

It says "enable", but it should have said "disable".

Note, this is probably just a cosmetic issue.
The issue #15620 (now closed) is about why it gives an error at all.

Steps to reproduce the problem

  1. Enable a templated service one or more times.
  2. Try to disable all of them with a wildcard, with or without the --now flag.

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

# systemctl enable --now stunnel@localhost4
 
Created symlink /etc/systemd/system/multi-user.target.wants/stunnel@localhost4.service → /usr/lib/systemd/system/stunnel@.service.
Job for stunnel@localhost4.service failed because the control process exited with error code.
See "systemctl status stunnel@localhost4.service" and "journalctl -xeu stunnel@localhost4.service" for details.

# systemctl disable --now stunnel@\*

Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "stunnel@*" escaped as "stunnel@\x2a".

# systemctl --version

systemd 255 (255.4-1.fc40)
+PAM +AUDIT +SELINUX -APPARMOR +IMA +SMACK +SECCOMP -GCRYPT +GNUTLS +OPENSSL +ACL +BLKID +CURL +ELFUTILS +FIDO2 +IDN2 -IDN -IPTC +KMOD +LIBCRYPTSETUP +LIBFDISK +PCRE2 +PWQUALITY +P11KIT +QRENCODE +TPM2 +BZIP2 +LZ4 +XZ +ZLIB +ZSTD +BPF_FRAMEWORK +XKBCOMMON +UTMP +SYSVINIT default-hierarchy=unified

# uname -r

6.8.7-300.fc40.x86_64

# systemctl disable --now xyzzy@\*

Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "xyzzy@*" escaped as "xyzzy@\x2a".
Failed to disable unit: Unit file xyzzy@\x2a.service does not exist.

# systemctl stop stunnel@\*

Warning: The unit file, source configuration file or drop-ins of stunnel@localhost4.service changed on disk. Run 'systemctl daemon-reload' to reload units.

# systemctl disable stunnel@\*

Glob pattern passed to enable, but globs are not supported for this.
Invalid unit name "stunnel@*" escaped as "stunnel@\x2a".

# systemctl | grep stunnel

● stunnel@localhost4.service                                                                                    loaded failed failed    TLS tunnel for localhost4
  system-stunnel.slice                                                                                          loaded active active    Slice /system/stunnel

# systemctl disable --now stunnel@localhost4

Removed "/etc/systemd/system/multi-user.target.wants/stunnel@localhost4.service".

-- Any idea why daemon-reload was suggested?

@PenelopeFudd PenelopeFudd added the bug 🐛 Programming errors, that need preferential fixing label May 1, 2024
@PenelopeFudd PenelopeFudd changed the title systemctl disable --now someunit@* gives wrong error message systemctl disable someunit@* gives wrong error message May 1, 2024
@PenelopeFudd PenelopeFudd changed the title systemctl disable someunit@* gives wrong error message systemctl disable [--now] someunit@* gives wrong error message May 1, 2024
yuwata added a commit to yuwata/systemd that referenced this issue May 1, 2024
@yuwata
Copy link
Member

yuwata commented May 1, 2024

-> #32600

@PenelopeFudd
Copy link
Author

As for the glob pattern not being supported, here's a workaround:

systemctl stop --now $(systemctl show -P Id servicename@\*)

yuwata added a commit that referenced this issue May 1, 2024
BtbN pushed a commit to BtbN/systemd that referenced this issue May 14, 2024
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 systemctl
Development

Successfully merging a pull request may close this issue.

2 participants