Re: [systemd-devel] Why is my reboot.target disabled?

2023-07-05 Thread Andrei Borzenkov

On 05.07.2023 11:57, Ferenc Wágner wrote:

Andrei Borzenkov  writes:


On 04.07.2023 14:58, Ferenc Wágner wrote:


Please help me understand this phenomenon (systemd 252):

$ systemctl status ctrl-alt-del.target
○ reboot.target - System Reboot
   Loaded: loaded (/lib/systemd/system/reboot.target; disabled; preset: 
enabled)
   Active: inactive (dead)
 Docs: man:systemd.special(7)

$ ls -l /{etc,run}/systemd/system | fgrep reboot

$ ls -l /lib/systemd/system | fgrep reboot
lrwxrwxrwx 1 root root   13 febr  28 12.15 ctrl-alt-del.target -> reboot.target
-rw-r--r-- 1 root root  443 febr   1 18.20 plymouth-reboot.service
-rw-r--r-- 1 root root  598 febr  16 19.10 reboot.target
drwxr-xr-x 2 root root 4096 ápr   22 22.15 reboot.target.wants
lrwxrwxrwx 1 root root   13 febr  28 12.15 runlevel6.target -> reboot.target
-rw-r--r-- 1 root root  568 febr  16 19.10 systemd-reboot.service

What does it mean that reboot.target is disabled?


It means links listed in [Install] section are not present.


$ systemctl cat reboot.target
[...]
[Install]
Alias=ctrl-alt-del.target

and there is a /lib/systemd/system/ctrl-alt-del.target -> reboot.target
symlink as show above.  Why doesn't it count?



Technically link in /etc does not exist and enable/disable machinery was 
created to manage links in /etc. But what happens now is certainly 
inconsistent.


bor@bor-Latitude-E5450:~$ systemctl status ctrl-alt-del.target
○ reboot.target - System Reboot
 Loaded: loaded (/lib/systemd/system/reboot.target; disabled; 
vendor preset: enabled)

 Active: inactive (dead)
   Docs: man:systemd.special(7)
bor@bor-Latitude-E5450:~$ systemctl is-enabled ctrl-alt-del.target
alias
bor@bor-Latitude-E5450:~$ echo $?
0
bor@bor-Latitude-E5450:~$

I do not know if this is intentional or a bug.


Maybe related: why does 90-systemd.preset enable reboot.target but
disable poweroff.target (for example)?


There can be just one link target for ctrl-alt-del and reboot is the
most logical one.


And it's actually there, isn't it?




Re: [systemd-devel] Why is my reboot.target disabled?

2023-07-05 Thread Ferenc Wágner
Andrei Borzenkov  writes:

> On 04.07.2023 14:58, Ferenc Wágner wrote:
>
>> Please help me understand this phenomenon (systemd 252):
>>
>> $ systemctl status ctrl-alt-del.target
>> ○ reboot.target - System Reboot
>>   Loaded: loaded (/lib/systemd/system/reboot.target; disabled; preset: 
>> enabled)
>>   Active: inactive (dead)
>> Docs: man:systemd.special(7)
>>
>> $ ls -l /{etc,run}/systemd/system | fgrep reboot
>>
>> $ ls -l /lib/systemd/system | fgrep reboot
>> lrwxrwxrwx 1 root root   13 febr  28 12.15 ctrl-alt-del.target -> 
>> reboot.target
>> -rw-r--r-- 1 root root  443 febr   1 18.20 plymouth-reboot.service
>> -rw-r--r-- 1 root root  598 febr  16 19.10 reboot.target
>> drwxr-xr-x 2 root root 4096 ápr   22 22.15 reboot.target.wants
>> lrwxrwxrwx 1 root root   13 febr  28 12.15 runlevel6.target -> reboot.target
>> -rw-r--r-- 1 root root  568 febr  16 19.10 systemd-reboot.service
>>
>> What does it mean that reboot.target is disabled? 
>
> It means links listed in [Install] section are not present.

$ systemctl cat reboot.target
[...]
[Install]
Alias=ctrl-alt-del.target

and there is a /lib/systemd/system/ctrl-alt-del.target -> reboot.target
symlink as show above.  Why doesn't it count?

>> Maybe related: why does 90-systemd.preset enable reboot.target but
>> disable poweroff.target (for example)?
>
> There can be just one link target for ctrl-alt-del and reboot is the
> most logical one.

And it's actually there, isn't it?
-- 
Thanks for your time,
Feri.


Re: [systemd-devel] Why is my reboot.target disabled?

2023-07-04 Thread Andrei Borzenkov

On 04.07.2023 14:58, Ferenc Wágner wrote:

Hi,

Please help me understand this phenomenon (systemd 252):

$ systemctl status ctrl-alt-del.target
○ reboot.target - System Reboot
  Loaded: loaded (/lib/systemd/system/reboot.target; disabled; preset: 
enabled)
  Active: inactive (dead)
Docs: man:systemd.special(7)

$ ls -l /{etc,run}/systemd/system | fgrep reboot

$ ls -l /lib/systemd/system | fgrep reboot
lrwxrwxrwx 1 root root   13 febr  28 12.15 ctrl-alt-del.target -> reboot.target
-rw-r--r-- 1 root root  443 febr   1 18.20 plymouth-reboot.service
-rw-r--r-- 1 root root  598 febr  16 19.10 reboot.target
drwxr-xr-x 2 root root 4096 ápr   22 22.15 reboot.target.wants
lrwxrwxrwx 1 root root   13 febr  28 12.15 runlevel6.target -> reboot.target
-rw-r--r-- 1 root root  568 febr  16 19.10 systemd-reboot.service

What does it mean that reboot.target is disabled? 


It means links listed in [Install] section are not present.


And why is it?



Probably because those presets were never actually applied. Presets were 
intended to be used to perform initial configuration "on the first 
boot", but it does not make them mandatory.




# systemctl enable reboot.target
Created symlink /etc/systemd/system/ctrl-alt-del.target → 
/lib/systemd/system/reboot.target.

Now reboot.target is reported as enabled.

# systemctl disable reboot.target
Removed "/etc/systemd/system/ctrl-alt-del.target".

Now reboot.target is reported as disabled again.  Why doesn't the
ctrl-alt-del.target symlink under /lib/systemd/system count?

Maybe related: why does 90-systemd.preset enable reboot.target but
disable poweroff.target (for example)?


There can be just one link target for ctrl-alt-del and reboot is the 
most logical one.