Systemd-logind requires restart after reboot to recognize [Login] section drop-in is not invalid

I’m on Fedora 40; I created a drop-in for systemd-logind.service; after reboot, the drop fails to be used correctly with Unknown section 'Login'. Ignoring until I restart the service.


The drop-in file: /etc/systemd/system/systemd-logind.service.d/lid.conf

[Login]
HandleLidSwitch=suspend
HandleLidSwitchExternalPower=suspend
HandleLidSwitchDocked=ignore

After booting my machine, sudo systemctl status systemd-logind.service gives:

● systemd-logind.service - User Login Management
     Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static)
    Drop-In: /usr/lib/systemd/system/systemd-logind.service.d
             └─10-grub2-logind-service.conf
             /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
             /etc/systemd/system/systemd-logind.service.d
             └─hibernate.conf, lid.conf
     Active: active (running) since Tue 2024-09-17 18:00:18 EDT; 17s ago
       Docs: man:sd-login(3)
             man:systemd-logind.service(8)
             man:logind.conf(5)
             man:org.freedesktop.login1(5)
   Main PID: 813 (systemd-logind)
     Status: "Processing requests..."
      Tasks: 1 (limit: 4473)
   FD Store: 0 (limit: 512)
     Memory: 3.7M (peak: 4.7M)
        CPU: 209ms
     CGroup: /system.slice/systemd-logind.service
             └─813 /usr/lib/systemd/systemd-logind

Sep 17 18:00:18 Micro systemd-logind[813]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-0-rescue.conf:9: Unknown line 'grub_class', ignoring.
Sep 17 18:00:18 Micro systemd-logind[813]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.10.7-200.fc40.x86_64.conf:7: Unknown line 'grub_users', ignoring.
Sep 17 18:00:18 Micro systemd-logind[813]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.10.7-200.fc40.x86_64.conf:8: Unknown line 'grub_arg', ignoring.
Sep 17 18:00:18 Micro systemd-logind[813]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.10.7-200.fc40.x86_64.conf:9: Unknown line 'grub_class', ignoring.
Sep 17 18:00:18 Micro systemd-logind[813]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.8.5-301.fc40.x86_64.conf:7: Unknown line 'grub_users', ignoring.
Sep 17 18:00:18 Micro systemd-logind[813]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.8.5-301.fc40.x86_64.conf:8: Unknown line 'grub_arg', ignoring.
Sep 17 18:00:18 Micro systemd-logind[813]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.8.5-301.fc40.x86_64.conf:9: Unknown line 'grub_class', ignoring.
Sep 17 18:00:27 Micro systemd-logind[813]: New session 1 of user zwimer.
Sep 17 18:00:35 Micro systemd-logind[813]: New session c1 of user gdm.
Sep 17 18:00:36 Micro systemd[1]: /etc/systemd/system/systemd-logind.service.d/lid.conf:1: Unknown section 'Login'. Ignoring.

If I sudo systemctl restart systemd-logind.service then check the status again, I get:

● systemd-logind.service - User Login Management
     Loaded: loaded (/usr/lib/systemd/system/systemd-logind.service; static)
    Drop-In: /usr/lib/systemd/system/systemd-logind.service.d
             └─10-grub2-logind-service.conf
             /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
             /etc/systemd/system/systemd-logind.service.d
             └─hibernate.conf, lid.conf
     Active: active (running) since Tue 2024-09-17 18:01:15 EDT; 5s ago
       Docs: man:sd-login(3)
             man:systemd-logind.service(8)
             man:logind.conf(5)
             man:org.freedesktop.login1(5)
   Main PID: 7259 (systemd-logind)
     Status: "Processing requests..."
      Tasks: 1 (limit: 4473)
   FD Store: 11 (limit: 512)
     Memory: 3.2M (peak: 4.5M)
        CPU: 351ms
     CGroup: /system.slice/systemd-logind.service
             └─7259 /usr/lib/systemd/systemd-logind

Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.10.6-200.fc40.x86_64.conf:9: Unknown line 'grub_class', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-0-rescue.conf:7: Unknown line 'grub_users', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-0-rescue.conf:8: Unknown line 'grub_arg', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-0-rescue.conf:9: Unknown line 'grub_class', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.10.7-200.fc40.x86_64.conf:7: Unknown line 'grub_users', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.10.7-200.fc40.x86_64.conf:8: Unknown line 'grub_arg', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.10.7-200.fc40.x86_64.conf:9: Unknown line 'grub_class', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.8.5-301.fc40.x86_64.conf:7: Unknown line 'grub_users', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.8.5-301.fc40.x86_64.conf:8: Unknown line 'grub_arg', ignoring.
Sep 17 18:01:18 Micro systemd-logind[7259]: /boot/loader/entries/8b6af5bd2bad4f02b7109ae5fdb495bc-6.8.5-301.fc40.x86_64.conf:9: Unknown line 'grub_class', ignoring.

I know Login is a valid section for logind; which I can confirm via man logind.conf.
It is also clearly being detected and loaded according the first status; but for some reason it isn’t recognizing the Login section.
This section does exist in /usr/lib/systemd/logind.conf as one would expect and I see no warnings about it loading that.

I also tried moving the drop-in directory to /etc/systemd/logind.conf.d as suggested in /usr/lib/systemd/logind.conf and the man page, but the service didn’t seem to detect them there.

My end-goal is just to ensure that when I close the lid the machine suspends, which I don’t mind doing another-way though.

Thanks in advance for any and all help!

That would be the correct location, for example /etc/systemd/logind.conf.d/lid.conf. The /etc/systemd/system/systemd-logind.service.d/lid.conf is for the systemd process itself, and this process doesn’t know about special logind settings.

1 Like

That clarifies a few things and presumably would explain the unknown section error. The not-detecting at the given ‘correct’ location then is a distinct bug I’ll look into to see if maybe something is overriding it. Thanks!

My remaining confusion is, why does the unknown login section warning not occur when I restart the service? My assumption is that it is not being suppressed as a duplicate.

How do you determine that it is not detected?

You have too many other issues. For example looking at /boot/loader/entries files should not occur either.

It turns out that I had an SELinux error. Once I moved it into the directory as you suggested and fixed my SELinux context’s logind seems to properly loading and respecting that file. Thanks!