Add --grab-reboot option to trigger system reboot via keyboard shortcut#176
Add --grab-reboot option to trigger system reboot via keyboard shortcut#176kdj0c merged 3 commits intokmscon:mainfrom
Conversation
373f8ea to
23f6c8e
Compare
This commit adds a new configurable keyboard shortcut option --grab-reboot that allows users to reboot the system directly from kmscon. Features: - Disabled by default (user must explicitly configure a key combination) - Uses direct reboot() system call for reliability - Calls sync() before reboot to ensure data safety - Independent of --session-control flag - Fully configurable key combination (e.g., <Ctrl><Alt>Delete) - Includes comprehensive documentation in man pages Implementation details: - Added grab_reboot field to kmscon_conf_t structure - Added seat_trigger_reboot() function using reboot(RB_AUTOBOOT) - Integrated into seat-level input event handling - Updated both kmscon.1 and kmscon.conf.1 man pages Usage example: kmscon --grab-reboot='<Ctrl><Alt>Delete'
23f6c8e to
e0d135a
Compare
|
I'm a bit skeptical about this feature, but the code looks good, and it doesn't introduce complexity, so if no other comments I will merge it soon. |
|
Wait a second before merging. I am investigating one more thing.
De : Jocelyn Falempe ***@***.***>
Date : dimanche, 14 décembre 2025 à 22:57
À : kmscon/kmscon ***@***.***>
Cc : Jerome Tollet (jtollet) ***@***.***>, Author ***@***.***>
Objet : Re: [kmscon/kmscon] Add --grab-reboot option to trigger system reboot via keyboard shortcut (PR #176)
[https://avatars.githubusercontent.com/u/554627?s=20&v=4]kdj0c left a comment (kmscon/kmscon#176)<#176 (comment)>
I'm a bit skeptical about this feature, but the code looks good, and it doesn't introduce complexity, so if no other comments I will merge it soon.
—
Reply to this email directly, view it on GitHub<#176 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGBK27R7CIJ2AF3FWB25ZM34BXMK3AVCNFSM6AAAAACO6JNWRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNJSGI2DINBQGM>.
You are receiving this because you authored the thread.
|
|
I confirm this PR is good.
De : Jerome Tollet (jtollet) ***@***.***>
Date : dimanche, 14 décembre 2025 à 23:18
À : kmscon/kmscon ***@***.***>, kmscon/kmscon ***@***.***>
Cc : Author ***@***.***>
Objet : Re: [kmscon/kmscon] Add --grab-reboot option to trigger system reboot via keyboard shortcut (PR #176)
Wait a second before merging. I am investigating one more thing.
De : Jocelyn Falempe ***@***.***>
Date : dimanche, 14 décembre 2025 à 22:57
À : kmscon/kmscon ***@***.***>
Cc : Jerome Tollet (jtollet) ***@***.***>, Author ***@***.***>
Objet : Re: [kmscon/kmscon] Add --grab-reboot option to trigger system reboot via keyboard shortcut (PR #176)
[https://avatars.githubusercontent.com/u/554627?s=20&v=4]kdj0c left a comment (kmscon/kmscon#176)<#176 (comment)>
I'm a bit skeptical about this feature, but the code looks good, and it doesn't introduce complexity, so if no other comments I will merge it soon.
—
Reply to this email directly, view it on GitHub<#176 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGBK27R7CIJ2AF3FWB25ZM34BXMK3AVCNFSM6AAAAACO6JNWRSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNJSGI2DINBQGM>.
You are receiving this because you authored the thread.
|
|
Thanks for this! I was just complaining to myself about ctrl-alt-del not being capable of rebooting my machine this morning. |
|
@satmandu that quite common... And that's why linux vt supports it too. TY ! |
|
Cool! |
|
While the feature is very useful, this implementation is quite dangerous. I suggest either replacing this hard reboot with a proper |
Following Karlson2k's feedback on PR kmscon#176, this commit adds clear warnings about the dangers of "hard" mode (immediate reboot without proper shutdown) which can cause data loss and filesystem corruption. The documentation now explicitly states that: - "soft" mode (default) sends SIGINT to PID 1 for a clean reboot, matching the standard Linux console Ctrl-Alt-Del behavior - "hard" mode performs an immediate reboot via reboot(RB_AUTOBOOT) with sync() but without proper shutdown sequence Changes: - Updated man pages (kmscon.1 and kmscon.conf.1) with detailed warnings - Updated kmscon.conf.example with prominent DATA LOSS warning - Clarified that soft mode matches Linux console behavior users expect Tested on real hardware with both modes: - soft mode: clean shutdown via SIGINT to PID 1 ✓ - hard mode: immediate reboot via RB_AUTOBOOT ✓
Following Karlson2k's feedback on PR kmscon#176, this commit adds clear warnings about the dangers of "hard" mode (immediate reboot without proper shutdown) which can cause data loss and filesystem corruption. The documentation now explicitly states that: - "soft" mode (default) sends SIGINT to PID 1 for a clean reboot, matching the standard Linux console Ctrl-Alt-Del behavior - "hard" mode performs an immediate reboot via reboot(RB_AUTOBOOT) with sync() but without proper shutdown sequence Changes: - Updated man pages (kmscon.1 and kmscon.conf.1) with detailed warnings - Updated kmscon.conf.example with prominent DATA LOSS warning - Clarified that soft mode matches Linux console behavior users expect Tested on real hardware with both modes: - soft mode: clean shutdown via SIGINT to PID 1 ✓ - hard mode: immediate reboot via RB_AUTOBOOT ✓
|
@Karlson2k Thank you for the excellent feedback! You're absolutely right about the concerns with hard reboot. I've addressed all your suggestions in PR #260: What was implemented:
Testing:
The implementation follows your recommendation to make this configurable while defaulting to the safe behavior users expect. |
|
@Karlson2k Thank you for the excellent feedback! You're absolutely right about the concerns with hard reboot. I've addressed all your suggestions in PR #260: What was implemented:
About hard mode: Testing:
The implementation follows your recommendation to make this configurable while defaulting to the safe behavior users expect. |
Summary
This PR adds a new
--grab-rebootoption that allows users to configure a keyboard shortcut to reboot the system directly from kmscon.Features
reboot(RB_AUTOBOOT)for reliability<Ctrl><Alt>Delete)Implementation
grab_rebootfield tokmscon_conf_tconfiguration structureseat_trigger_reboot()function usingreboot(RB_AUTOBOOT)seat_input_event()kmscon.1.xml.inandkmscon.conf.1.xml.inman pagesUsage
Modified Files
src/kmscon_conf.h- Configuration structuresrc/kmscon_conf.c- Option definition and help textsrc/kmscon_seat.c- Reboot trigger implementationdocs/man/kmscon.1.xml.in- Command-line option documentationdocs/man/kmscon.conf.1.xml.in- Configuration file documentation