Autorandr does not apply config on restart

Hi all!

I have configured randr and autorandr, and it works well for the session:

When running autorandr -c it applies the configuration.

When running systemctl start autorandr.service, it asks for the admin password and also applies the desired config.

But on reboot, the config is not applied.

> journalctl -u autorandr.service
...
-- Boot 865d6ebbcebd4a579ee37455e9a4dbdf --
Dec 27 21:47:02 lightview systemd[1]: Starting autorandr execution hook...
Dec 27 21:47:03 lightview systemd[1]: autorandr.service: Deactivated successfully.
Dec 27 21:47:03 lightview systemd[1]: Finished autorandr execution hook.

> systemctl cat autorandr
# /usr/lib/systemd/system/autorandr.service
[Unit]
Description=autorandr execution hook
After=sleep.target
StartLimitIntervalSec=5
StartLimitBurst=1

[Service]
ExecStart=/usr/bin/autorandr --batch --change --default lightview
Type=oneshot
RemainAfterExit=false
KillMode=process

[Install]
WantedBy=sleep.target

How do I configure it to apply my config on reboot? I would appreciate any suggestions.

Hello,

Any service that has to start on cold boot, or reboot, has to be enabled
systemctl enable --now autorandr.service

See systemd - ArchWiki

Ah, I’m sorry, I didn’t mention that I did enable it immediately after installing. The journalctl from my original post shows my boot logs. For every reboot, I see the following in journalctl, but this has no effect on the screen configuration:

-- Boot 0236f6e3ab6e47329d5d1bdaf72f6a51 --
Dec 29 21:29:38 lightview systemd[1]: Starting autorandr execution hook...
Dec 29 21:29:39 lightview systemd[1]: autorandr.service: Deactivated successfully.
Dec 29 21:29:39 lightview systemd[1]: Finished autorandr execution hook.

So it seems that it does run during the reboot, but either it runs at a wrong time, or it doesn’t complete successfully…