Bug 742783

Summary: ctrl-alt-delete in runlevel 3 causes a reboot although shutdown is configured in yast
Product: [openSUSE] openSUSE 12.1 Reporter: Forgotten User SNh8s-Gz29 <forgotten_SNh8s-Gz29>
Component: YaST2Assignee: Jiří Suchomel <jsuchome>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P3 - Medium CC: fcrozat
Version: Final   
Target Milestone: ---   
Hardware: x86   
OS: SUSE Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: patch for /usr/share/YaST2/modules/Security.ycp
patch for /usr/share/YaST2/modules/Security.ycp

Description Forgotten User SNh8s-Gz29 2012-01-22 22:39:14 UTC
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-GB; rv:1.9.2.25) Gecko/20111216 SUSE/3.6.25-2.1 Firefox/3.6.25

I usually shutdown the system from runlevel 3 using the Control-Alt-Delete combination. In Yast -> Security and Users -> Security Centre and Hardening -> Boot Settings -> Interpretation of Ctrl-Alt-Delete I selected "halt".

In /etc/inittab I found

> # what to do when CTRL-ALT-DEL is pressed
> ca::ctrlaltdel:/sbin/shutdown -h -t 4 now

Pressing Ctrl-Alt-Del in runlevel 3 causes a reboot

Entering "shutdown -h -t 4 now" causes a system halt including power-off

I observed this on a 64-bit and a 32-bit installation



Reproducible: Always

Steps to Reproduce:
1.Boot up
2.Press Ctrl-Alt-Delete
Actual Results:  
System reboots

Expected Results:  
System to shutdown and power off
Comment 1 Jiri Slaby 2012-02-07 10:14:40 UTC
Hmm, I suppose you are using systemd?
Comment 2 Forgotten User SNh8s-Gz29 2012-02-07 20:49:20 UTC
(In reply to comment #1)
> Hmm, I suppose you are using systemd?

Yes.

And before you ask, if I boot with option "init=/sbin/sysvinit" the behaviour is correct: Press ctrl-alt-delete and the system shuts down and powers off. (64-bit and 32-bit)
Comment 3 Jiri Slaby 2012-02-07 21:15:06 UTC
OK, it is not a kernel bug then...
Comment 4 Frederic Crozat 2012-02-08 09:24:48 UTC
yast should create :
ln -s /lib/systemd/system/halt.service /etc/systemd/system/ctrl-alt-del.target
in addition to changing /etc/inittab (which is not read by systemd).
Comment 5 Forgotten User SNh8s-Gz29 2012-02-08 17:29:24 UTC
If I add (while systemd is configured)

> ln -s /lib/systemd/system/halt.service /etc/systemd/system/ctrl-alt-del.target

manually, ctrl-alt-delete doesn't do anything at all. After I remove that link, I am back to the original behaviour.
Comment 6 Jiří Suchomel 2012-02-15 08:50:07 UTC
(In reply to comment #5)
> If I add (while systemd is configured)
> 
> > ln -s /lib/systemd/system/halt.service /etc/systemd/system/ctrl-alt-del.target
> 
> manually, ctrl-alt-delete doesn't do anything at all. After I remove that link,
> I am back to the original behaviour.

Frederic, any comment on this?

Additionally, what about other options? YaST offers Reboot, Halt and Ignore. I suppose for Reboot, the symlink above should be removed, but what about Ignore?
Comment 7 Frederic Crozat 2012-02-15 10:15:55 UTC
by default, ctrl-alt-del.target is symlinked to reboot.target

so, yast should do (careful, I did an error in my previous comment, better to link against target, not service):

for reboot : ln -s /lib/systemd/system/halt.target /etc/systemd/system/ctrl-alt-del.target
for halt : remove /etc/systemd/system/ctrl-alt-del.target (so it will use the defaults)
for ignore : ln -s /dev/null /etc/systemd/system/ctrl-alt-del.target
Comment 8 Jiří Suchomel 2012-02-15 15:52:18 UTC
(In reply to comment #7)
> by default, ctrl-alt-del.target is symlinked to reboot.target

> for reboot : ln -s /lib/systemd/system/halt.target
> /etc/systemd/system/ctrl-alt-del.target
> for halt : remove /etc/systemd/system/ctrl-alt-del.target (so it will use the
> defaults)
> for ignore : ln -s /dev/null /etc/systemd/system/ctrl-alt-del.target

It should be the other way, right?

for reboot: 

ln -s /lib/systemd/system/reboot.target /etc/systemd/system/ctrl-alt-del.target

for halt:

ln -s /lib/systemd/system/halt.target /etc/systemd/system/ctrl-alt-del.target
Comment 9 Frederic Crozat 2012-02-15 16:05:24 UTC
oops, not enough coffee this morning :

for reboot : 
just remove the symlink in /etc (so we revert to package behaviour)

for halt:
ln -s /lib/systemd/system/halt.target /etc/systemd/system/ctrl-alt-del.target

for nothing
ln -s /dev/null /etc/systemd/system/ctrl-alt-del.target
Comment 10 Jiří Suchomel 2012-02-16 08:35:00 UTC
Just in case: if someone had, theoreticaly, /etc/systemd/system/ctrl-alt-del.target linked to 

/lib/systemd/system/reboot.target

or

/lib/systemd/system/ctrl-alt-del.target

This also counts as reboot (the default scenario), right?
Comment 11 Frederic Crozat 2012-02-16 08:54:24 UTC
yes, it does.

targets and services from /etc/systemd/system are always preponderant over the one from /lib/systemd/system
Comment 12 Jiří Suchomel 2012-02-16 09:11:32 UTC
Created attachment 476442 [details]
patch for /usr/share/YaST2/modules/Security.ycp

Harald, could you patch your  /usr/share/YaST2/modules/Security.ycp with this patch and test if it works for you?

1. download it to file ('security.diff')
2. patch it ('patch /usr/share/YaST2/modules/Security.ycp < security.diff')
3. compile ('ycpc -c /usr/share/YaST2/modules/Security.ycp')
4. run YaST again
Comment 13 Forgotten User SNh8s-Gz29 2012-02-16 19:36:55 UTC
After applying the patch and setting "Interpretation of Ctrl-Alt-Delete" to "halt" the system indeed *halts* and prints a message to that effect, but does *not* power off, which is what I would expect
Comment 14 Jiří Suchomel 2012-02-16 20:17:20 UTC
Well, that looks like a systemd bug (actually, it happens to me sometimes as well)
Comment 15 Forgotten User SNh8s-Gz29 2012-02-16 21:53:22 UTC
Jiri, for me there is no "sometimes" about it. I didn't try it hundreds of times, but with the patch in place it *always* halts without power off. When using sysvinit it *always* powers off
Comment 16 Jiří Suchomel 2012-02-16 22:01:13 UTC
(In reply to comment #15)
> Jiri, for me there is no "sometimes" about it. I didn't try it hundreds of
> times, but with the patch in place it *always* halts without power off. When
> using sysvinit it *always* powers off

Yes, I believe. I wrote 'sometimes' for me, just when I try to halt the system (unrelated to pressing ctrl-alt-delete).
Comment 17 Frederic Crozat 2012-02-17 08:58:41 UTC
my bad, for "halt" command, create symlink :
ln -s /lib/systemd/system/poweroff.target /etc/systemd/system/ctrl-alt-del.target

for halt not powering off, be sure to use halt -p, just calling halt will not cut the power (it is standard unix behaviour, we had a patch in sysvinit initscript to add -p on supported platform but we don't plan to add similar stuff to systemd).
Comment 18 Jiří Suchomel 2012-02-17 09:06:08 UTC
Created attachment 476641 [details]
patch for /usr/share/YaST2/modules/Security.ycp

New patch
Comment 19 Jiří Suchomel 2012-02-17 09:06:46 UTC
Harald, does it work now?
Comment 22 Forgotten User SNh8s-Gz29 2012-02-17 21:46:25 UTC
Jiri, I have tried the "halt" setting in YaST under both 32-bit and 64-bit systems and both now successfully power off! I didn't try the other YaST options "reboot" and "ignore"
Comment 23 Bernhard Wiedemann 2012-02-20 08:00:10 UTC
This is an autogenerated message for OBS integration:
This bug (742783) was mentioned in
https://build.opensuse.org/request/show/105924 Factory / yast2-security
Comment 24 Jiří Suchomel 2012-02-20 08:26:05 UTC
I've submitted new package to Factory and requested update for 12.1

> created request id 105926
Comment 25 Bernhard Wiedemann 2012-02-20 09:00:10 UTC
This is an autogenerated message for OBS integration:
This bug (742783) was mentioned in
https://build.opensuse.org/request/show/105926 12.1 / yast2-security