You are not logged in.
Pages: 1
I've tried creating a logind.conf.d/override.conf, tried systemctl edit logind.
the systemctl gives an error that "no files found for logind.service.
I've resorted to editing the /etc/systemd/logind.conf file, but this isn't recommended in the documentation and it annoys me.
Offline
`systemctl edit logind` is of course not going to work as there is no logind.service. There is a systemd-logind.service, and `systemctl edit systemd-logind` would work.
However, you can / should just edit the logind.conf file. Which documentation recommends against that?
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
https://man.archlinux.org/man/logind.conf.5
End of the first paragraph recommends drop-in over modification of conf file.
Last edited by jsmith1092 (2023-04-19 16:20:37)
Offline
There is a systemd-logind.service, and `systemctl edit systemd-logind` would work.
This does generate a drop-in file, but it does not override the /etc/systemd/logind.conf file.
I want to modify the HandleLidSwitch event, and editing the logind.conf file is the only way that has worked for me.
Running the 'systemclt edit systemd-logind' command generates a file at /etc/systemd/system/systemd-logind.service.d/<drop-in>.conf
The drop-in file does not override the /etc/systemd/logind.conf
EDIT: I ran 'systemctl restart systemd-logind' after creating the drop-in file
Last edited by jsmith1092 (2023-04-19 17:20:45)
Offline
https://man.archlinux.org/man/logind.conf.5
End of the first paragraph recommends drop-in over modification of conf file.
That has nothing to do w/ the service augmentation.
The suggestion is to have a /etc/systemd/logind.conf.d/mystuff.conf to augment your local config rather than editing /etc/systemd/logind.conf
This is NOT related to "systemclt edit" and a common concept also used by eg. Xorg.
Online
Trilby wrote:There is a systemd-logind.service, and `systemctl edit systemd-logind` would work.
This does generate a drop-in file, but it does not override the /etc/systemd/logind.conf file.
I want to modify the HandleLidSwitch event, and editing the logind.conf file is the only way that has worked for me.Running the 'systemclt edit systemd-logind' command generates a file at /etc/systemd/system/systemd-logind.service.d/<drop-in>.conf
The drop-in file does not override the /etc/systemd/logind.confEDIT: I ran 'systemctl restart systemd-logind' after creating the drop-in file
I think the path of the drop in file is incorrect according to the logind.conf man page.
In addition to the "main" configuration file, drop-in configuration snippets are read from /usr/lib/systemd/*.conf.d/, /usr/local/lib/systemd/*.conf.d/, and /etc/systemd/*.conf.d/.
The main advantage of using a drop-in over editing the pre-packaged logind.conf file in my opinion is that your settings will remain even if future package updates overwrite the /etc/systemd/logind.conf file. I think you're probably best served to add something like /usr/lib/systemd/logind.conf.d/10-handlelidswitch.conf with the contents specifying the setting you want. To check that your drop-in is being read and applied you can try
systemd-analyze cat-config systemd/logind.confLast edited by branthebuilder (2023-04-19 19:06:27)
Offline
`systemctl edit logind` is of course not going to work as there is no logind.service. There is a systemd-logind.service, and `systemctl edit systemd-logind` would work.
However, you can / should just edit the logind.conf file. Which documentation recommends against that?
The included default logind.conf itself includes the comment "Local configuration should be created by either modifying this file, or by creating "drop-ins" in the logind.conf.d/ subdirectory. The latter is generally recommended."
Offline
I think the path of the drop in file is incorrect according to the logind.conf man page
i believe there's an ongoing misunderstanding between the OP and others in this thread about what the underlying goal is.
if the OP wished to edit the systemd-logind service from a service execution standpoint, then 'systemctl edit systemd-logind' is the way to go. this will create a drop-in replacement file for the invocation of systemd-logind from the service manager. if the OP wished to edit the runtime behavior of systemd-logind, then editing the logind.conf file and/or creating drop-in overrides in /etc/systemd/logind.conf.d/ is the way to go.
both of these goals are not mutually exclusive, and one could conceivably have both service-level overrides and process config-level overrides at the same time. however, i'd posit that it's easy to conflate the two goals and think one tool can accomplish both tasks. this is not the case as seth has already suggested.
Offline
The main advantage of using a drop-in over editing the pre-packaged logind.conf file in my opinion is that your settings will remain even if future package updates overwrite the /etc/systemd/logind.conf file
Future updates will not overwrite that file. The only benefit would be that you don't need to deal with a .pacnew file if there ever is an update.
Last edited by Trilby (2023-04-19 19:50:04)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
branthebuilder wrote:The main advantage of using a drop-in over editing the pre-packaged logind.conf file in my opinion is that your settings will remain even if future package updates overwrite the /etc/systemd/logind.conf file
Future updates will not overwrite that file. The only benefit would be that you don't need to deal with a .pacnew file if there ever is an update.
Fair enough. Either way updates have to potentially be dealt with more actively by editing the file directly rather than using drop-in files.
Offline
branthebuilder wrote:I think the path of the drop in file is incorrect according to the logind.conf man page
i believe there's an ongoing misunderstanding between the OP and others in this thread about what the underlying goal is.
if the OP wished to edit the systemd-logind service from a service execution standpoint, then 'systemctl edit systemd-logind' is the way to go. this will create a drop-in replacement file for the invocation of systemd-logind from the service manager. if the OP wished to edit the runtime behavior of systemd-logind, then editing the logind.conf file and/or creating drop-in overrides in /etc/systemd/logind.conf.d/ is the way to go.
both of these goals are not mutually exclusive, and one could conceivably have both service-level overrides and process config-level overrides at the same time. however, i'd posit that it's easy to conflate the two goals and think one tool can accomplish both tasks. this is not the case as seth has already suggested.
I think it's pretty clear what the OP wants.
I want to modify the HandleLidSwitch event
which is the runtime behavior. This is supported by OP's statement that editing logind.conf accomplished the goal but is not OP's preferred method if alternate paths are possible.
Offline
Generally the *.d architecture allows the config to be fed from multiple sources and simplify dynamic config organization and effectively overload it.
Eg. if conditions "foo" and "bar" require the config "sna=fu", you can have snafu.d/foo.conf and snafu.d/bar.conf that both set it and can apply independently (so if "foo" doesn't apply, but "bar" does, you can move foo.conf away and bar.conf will still provide sna=fu)
The downside is that it obfuscates the effective configuration and you might have a forgotton snafu.d/xxx.conf that sets "fu=bar" and leaves you wondering why itsbroken™
The reason to prefer drop-ins for logind is
Those drop-ins have higher precedence and override the main configuration file.
Alterations to the central config file might be voided by some existing drop-in.
The constellation puts the mere existence of logind.conf into question an the purpose seems indeed to be
Initially, the main configuration file in /etc/systemd/ contains commented out entries showing the defaults as a guide to the administrator.
That being said: for the fistful of logind options the architecture seems complete overkill and I've yet to see drop-ins in /usr/lib/systemd/logind.conf.d and therefore simply edit logind.conf
Any potential .pacnew requiring update would have only documentary character anyway.
Online
Pages: 1