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

systemd-userdbd cannot be disabled #15175

Closed
maklor78 opened this issue Mar 20, 2020 · 13 comments · Fixed by #15109
Closed

systemd-userdbd cannot be disabled #15175

maklor78 opened this issue Mar 20, 2020 · 13 comments · Fixed by #15109
Labels

Comments

@maklor78
Copy link

systemd version the issue has been seen with

245.2

Used distribution

arch linux

Expected behaviour you didn't see

The service systemd-userdbd should not run after using 'systemctl disable systemd-userdbd' and rebooting

Unexpected behaviour you saw

systemd-userdbd cannot be disabled. When masking the service everything runs well again but this error appears in the logs due to the socket being blocked:
systemd-userdbd.socket: Socket service systemd-userdbd.service not loaded, refusing.
Failed to listen on User Database Manager Socket.

Steps to reproduce the problem

  1. Run 'systemctl disable systemd-userdbd' and reboot.
  2. Run 'systemctl status systemd-userdbd'

Why is this service running in the first place?
I have no use for it and therefore it should be disabled by default until the user activates it.

@arvidjaar
Copy link
Contributor

I have no use for it

It is used by logind.

@maklor78
Copy link
Author

maklor78 commented Mar 20, 2020

I have no use for it

It is used by logind.

I am using Logind, but every feature of it that i am using, is running perfectly fine without
systemd-userdbd. If the service is getting activated without being actively used, this is a design falw.
The systemd-userdbd should only be run when e.g. logind actively requests it or it is manually estarted/enabled.

But even if this design is a choice for whatever reson, shouldt there be a warning when is try to disable systemd-userdbd. It could say that the service will be started by logind anyway. Instead it teslls me that the service will not be started at the next boot, even though this is not true.

@marcosfrm
Copy link
Contributor

#15109

@mmonaco
Copy link
Contributor

mmonaco commented Mar 25, 2020

It is socket activated so you need to disable the socket too. But since the socket is currently enabled by default in socket.target.wants what you really need to do is mask both the socket and service.

keszybz added a commit to keszybz/systemd that referenced this issue Mar 26, 2020
It's lightweight and generally useful, so it should be enabled by default. But
users might want to disable it for whatever reason, and things should be fine
without it, so let's make it installable so it can be disabled if wanted.

Fixes systemd#15175.
@poettering
Copy link
Member

not sure I get this? why disable this at all? it's a tiny daemon, and shouldn't matter at all...

Disable it during compilation if you don't want this. Or use "systemctl mask" on the service and its socket unit. But I see no point in supporting "systemctl disable" for it, it's a low-level system component, and not supposed to something configurable?

@poettering poettering added the needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer label Mar 30, 2020
@mmonaco
Copy link
Contributor

mmonaco commented Mar 30, 2020

It still takes up lines in ps output :) It doesn't matter if it's small on resources, I'm not using userdbd or homed right now so I prefer to spare brain cycles seeing them when I'm checking up on a system, including a bunch of nspawn containers in boot mode. (At the expense of seeing them masked or disabled in /etc/systemd/system/.

@poettering
Copy link
Member

@mmonaco then disable userdb during build?

@poettering
Copy link
Member

or mask socket and service?

@mmonaco
Copy link
Contributor

mmonaco commented Mar 30, 2020

To be clear, I am masking. I stumbled across this issue and was trying to help and wasn't really looking for an upstream change -- however I do think it would be nicer if these services were opt-in like most others. I don't think build-time changes are a reasonable suggestion for most people who are using distro packages.

@poettering
Copy link
Member

it's very low-level stuff. I mean systemd-tmpfiles or systemd-logind or so are not something you can eanble/disable either. For low level stuff there's mask/unmask, if you feel like it. Only for high level stuff we do enable/disable...

keszybz added a commit to keszybz/systemd that referenced this issue Mar 31, 2020
It's lightweight and generally useful, so it should be enabled by default. But
users might want to disable it for whatever reason, and things should be fine
without it, so let's make it installable so it can be disabled if wanted.

Fixes systemd#15175.
@maklor78
Copy link
Author

not sure I get this? why disable this at all? it's a tiny daemon, and shouldn't matter at all...

This is the exact opposite of a good design reason. It even checks out as a violation of "security by design", considering that any well designed system should only run the minimal number of services needed. Having systemd run this by default on billions of devices without good reason is a really bad choice.

Disabling at compile time is also not a solution for distros, as some user will want to use these services even though most won't.

it's very low-level stuff. I mean systemd-tmpfiles or systemd-logind or so are not something you can eanble/disable either. For low level stuff there's mask/unmask, if you feel like it. Only for high level stuff we do enable/disable...

If this is a design choice it should be communicated as such and above all else, the systemctl command should give a reasonable feedback if it is used to disabled such a service.
At the moment, the user will get the feedback that the service has been successfully disabled even when it is not. There should be a warning if "systemctl disable xxx" is used on a service that does not support this command.

But this bug report is rather about this unnecessary service being enabled by default, which as said, is a bad design choice and a waste of ressources.

Considering this service will be running on a lot of devices, even with only minimal ressources used, this is a waste of a lot of enery. Since systemd seems to enable more and more services by default like homed (which I am generally a fan of) we could sooner or later probably turn of a power plant or two if systemd were to turn stuff like this off by default.

Please do not underestimate the consequences of having a service that only few user have a use case for, be enabled by default on pretty much all linux systems.

There is not a system design guide out there that does not recommend disableing all unnecessary service. Systemd should respect this as well.

@keszybz keszybz removed the needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer label Apr 20, 2020
@ghost
Copy link

ghost commented Jun 15, 2021

If this is a design choice it should be communicated as such and above all else, the systemctl command should give a reasonable feedback if it is used to disabled such a service.
At the moment, the user will get the feedback that the service has been successfully disabled even when it is not. There should be a warning if "systemctl disable xxx" is used on a service that does not support this command.

But this bug report is rather about this unnecessary service being enabled by default, which as said, is a bad design choice and a waste of ressources.

Honestly, the only reason I can agree with this, is because there's one place where systemd either can't(yet) or won't be implemented in, and that's user-facing router devices and other embedded low-ram/resource devices.

Excluding shared memory size, and the fact I didn't compile systemd with uclibc;
The residential size of systemd-userdb is 6048KiB, +/- 5776KiB times 3 for the 3 processes it spawns.
That's around 22.8 MiB which is 1/4th of ram of some N/AC routers, for a simple service(checked at 1 hour uptime, I only run ssh and lighttpd).
A lot of those simple services take 6-11 MiB on x86(obviously a router would run arm64/arm32/mips).

I did heard somewhere that some notable developers of systemd don't see point in daemons that were created by openwrt that are fit for their purpose of running on low ram low performance routers(namely, ubus, init system etc.), but I can't really put enough of a confidence in whether my memory serves me right, so while I will keep this post as is.
I apologize deeply for any kind of misinformation and misrepresentation, or any that I have just parroted back.
I will fix this very paragraph on request, and tone down the tone of the post.

The other alternative is well "just buy a router with at least 256MiB of ram instead of 64MiB", but that doesn't work for repurposing old routers or for running an up-to-date 3rd party firmware secure home router.
I just never digged into it.

Well I just stumbled on userdbd when looking up what runs on my vps, wondered what it is noticed what it is, what it does and then stumbled upon this here. And as I typed it all out it has long been closed.

@poettering
Copy link
Member

@kubast2 on a router you'd turn off userdb at compile-time. Services in systemd can be turned off on multiple level: at compile time, via "systemctl disable" and via "systemctl mask". For userdb the first and the last is implemented, this bug report is about getting the middle one ("systemctl disable") implemented. I am not convinced that's necessary, and in particular your router usecase is better served with disabling it at build time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

7 participants