How to halt Linux and windows systems immediately and safely by pressing power button

Currently I am using Fedora 36 pre release.

Previously while booting Linux system I was able to see console login by pressing alt ctrl F1 or alt ctrl F2 etc.,. At present when I am running desktop environments like gnome mate etc., when I press ALT ctrl F1 or alt ctrl F2 etc I am unable to see console and instead I am still in desktop environment itself.
Strange, fedora 35 here, without any special configuration in this regard. How about Ctrl-alt-F3 ? Does the command

sudo chvt 3

take you to a text console?

The logind.conf that you talked about earlier, manages this behaviour also. Is there any non-standard, or non-default option in it ?
 
Strange, fedora 35 here, without any special configuration in this regard. How about Ctrl-alt-F3 ? Does the command

sudo chvt 3

take you to a text console?

The logind.conf that you talked about earlier, manages this behaviour also. Is there any non-standard, or non-default option in it ?
Hi I have followed what you have suggested and succeeded ie creating a symbolic link and pressing Ctrl alt f4 and after that pressing Ctrl alt del keys.

Upto now I am using my system from the past 4 months and facing this issue and thought asking others like you and even I have asked people in Fedora forums, Unix forums and Linux forums etc.,. All suggested to buy a new apc ups or buy a RTL usb converter and connect ups with usb port and install a software etc. Some people suggested to click shutdown button in desktop environment etc.,.

Finally I have succeeded thanks a lot for your suggestions and patience.
 
Here after pressing Ctrl alt F1 I am at graphics login prompt and after pressing Ctrl alt f2 I am at desktop environment and after pressing Ctrl alt f4 I am at console login.

After that when I press ctrl alt del my system is powered off with in 15 seconds.

All these happened when my monitor is turned off.

Thanks a lot to you.
 
May I know how to do the same in windows 11 ie., create a shortcut to shutdown the system immediately and safely and assign this shortcut to power button present in cabinet box.
 
Previously I have created a similar thread and creating a new because previous one doesn't have a solution and the current one has solution.

Hi Many of us use Linux desktop computer or even a server with optionally a secondary power supply such as ups etc.,. Many of of us but not all think to shutdown the system immediately and safely without turning on the monitor but don't know how to do so. I have found a solution and sharing with you which may help you.

I have asked many of you how to shutdown the system immediately and safely by pressing power button present in cabinet box without turning monitor on. Many of you suggested to buy a new apc ups or buy a RTL usb converter and connect ups with usb port and install a software etc. Some people suggested to click shutdown button in desktop environment etc.,.


But one person from tech enclave forum suggested a method and it working properly and I have tested a number of times. I am providing this method as it may help you and other people like me.


The procedure is as follows


Create a symbolic link in bash terminal as follows


Code:
sudo ln -sf /usr/lib/systemd/system/poweroff.target /etc/systemd/system/ctrl-alt-del.target


After this press ctrl-alt-f4 which should bring or switch from graphics to console login prompt.


After this press ctrl-alt-del which will instantly start shutting down your Linux system safely and immediately, without any confirmation.


Here after pressing Ctrl alt F1 I am at graphics login prompt and after pressing Ctrl alt f2 I am at desktop environment and after pressing Ctrl alt f4 I am at console login.


The above may vary from Linux distribution to distribution so try to press ctrl alt F1 or ctrl alt f2 or ctrl alt f3 ctrl alt f4 keys and any one can bring you to console login. After that press ctrl alt del which will shutdown system immediately and safely.


Note that all these happened with in 15 seconds even when my monitor is turned off.


Finally thanks to some of you who have given some suggestions and patience.

Regards,
Rupesh.
 
Last edited:
I don't see why this needed a separate thread, and why you couldn't credit the person who shared this with you in the first place?
 
I have created this thread because I thought it may be useful to others and so I want to catch more attention of others.

In the title I have specified " how to shutdown system immediately without monitor which I tested"

Here in the thread itself I have specified without using monitor and I have tested. Many other people can catch the subject of this thread by seeing title itself.

Someone asked question as why can't you enter shutdown -h now or similar and if are going to ask the same question then my answer is

Suppose main power supply is off and there is no backup in ups.

Someone of you may have encountered such situation and at that time there is no chance to enter any command in terminal emulator because whole system may get switched off as ups is going to stop shortly.

Some people may neglect and at some times after some days ups may stop working. Previously as the system is not shut down properly file system may be corrupted and some times system hardware may get damaged.

Many people even don't use ups power supply at all because they don't know what happens after.

I have suggested what to do in such a hurry situations as ups can't supply power much time.

If you don't have power interrupts then you can neglect this thread totally.
 
Ideally, if the minimal chance of file corruption that is present in modern systems is a concern, the power backup and data backup should be rigorous enough to make something like this unnecessary. Still worth an academic discussion, but not something to rely on to avoid data loss. Just my two cents.
 
Any method can take atleast 90 seconds but the method I have given takes less than 15 seconds only that too without using monitor.

You can google for "ssh remote command execution" and read up on the suggestions.

On ubuntu and ubuntu based systems I basically install ssh server by running "sudo apt install ssh" then from any other machines if I remember correctly you just type:

ssh user@host 'shutdown -h now'

Hope this helps?
 
Back
Top