Shortcut to restart the system

I have become accustomed to using REISUB to restart the system instead of executing the commands sudo umount -l /mnt/* and reboot as I previously did. However, I have noticed that this method restarts the system abruptly. Is there an alternate shortcut available to restart the system gracefully when it is not frozen?

If it’s not “frozen”, the normal shutdown procedure
(no REISUB)
will take care of everything (unmounting included)
and the shutdown will be … graceful.

What makes you think this is not happening?

sudo umount -l /mnt/* && echo "PC will reboot in 10 seconds" && sleep 10 && reboot

:question:

Anyway, the reboot is gracefully, but fast. reboot is just enough.

A previous personal experience that was probably just a fluke. But I would like to know about a shortcut to make it faster anyways.

I don’t understand. That’s pretty much what I’m doing, but I want to use a shortcut instead.

I believe one of the graceful ways of rebooting is to use:
systemctl reboot

1 Like

You said: “However, I have noticed that this method restarts the system abruptly.” and that is the answer. It waits ten seconds until it reboots. Now it is not “abruptly”.

Anyway… the reboot command does all the unmounts already. Why would one think that this is needed?

I meant REISUB but yeah you are right it reads like that.

faster than this - your procedure ?:

… just say “reboot” - or “poweroff
These are the equivalent (the very same …) of:
systemctl reboot
or
systemctl poweroff

It doesn’t get faster than this - not even if you assign some keyboard shortcut to these commands.
You just save time typing with a keyboard shortcut - but it does not change anything about the sequence that will (gracefully) shut down/reboot your system.

1 Like

What is a graceful way to restart my system with a shortcut without abruptly shutting it down?

When I restart with systemctl reboot or reboot or with the GUI button I get a few errors on my hard drives saying Failed to unmount. Which is why those methods aren’t graceful to me.

I used to use sudo umount -l /mnt/* and reboot to avoid errors with my hard drives, but I’d like to use a keyboard shortcut instead for faster access. I’ve been using REISUB, but I’m not sure if it’s shutting down my system abruptly. I’m looking for a keyboard shortcut that uses similar commands as sudo umount -l /mnt/* and reboot or REISUB to gracefully restart my system.

It should be something like what ChatGPT hallucinates but I’m getting the error

No such schema “org.gnome.settings-daemon.plugins.media-keys”
No such schema “org.gnome.settings-daemon.plugins.media-keys.custom-keybinding”
No such schema “org.gnome.settings-daemon.plugins.media-keys.custom-keybinding”
No such schema “org.gnome.settings-daemon.plugins.media-keys.custom-keybinding”

Prompt: How can I reboot my system with a shortcut in Manjaro Linux?

There are different ways to reboot your Manjaro Linux system, and one of the easiest ways is to use a keyboard shortcut. Here are the steps to set up a shortcut to reboot your Manjaro Linux system:

  1. Open the Manjaro Linux application launcher by clicking on the “Start” button or pressing the Super key (usually the key with the Windows logo).
  2. Type “keyboard” in the search bar and click on “Keyboard” to open the Keyboard Settings.
  3. Click on the “Shortcuts” tab and then click on the “+” button to add a new shortcut.
  4. In the “Command” field, enter the command “systemctl reboot” (without the quotes).
  5. Click on “Set Shortcut” and then press the key combination you want to use as a shortcut for rebooting your system. For example, you can use Ctrl+Alt+R.
  6. Click on “Add” to add the new shortcut to the list of shortcuts.

Now you can use the keyboard shortcut you just created to reboot your Manjaro Linux system. Just press the key combination you selected, and your system will restart.

— ChatGPT

Prompt: Convert REISUB to commands I can write in the terminal. Use usual commands like reboot for Alt+ SysRq+B.

REISUB stands for a sequence of keys to perform a safe reboot of the system. Here are the equivalent commands that you can write in the terminal:

  1. “r” key - Switch the keyboard to raw mode.
echo 1 > /proc/sys/kernel/sysrq
  1. “e” key - Send the SIGTERM signal to all processes except init.
kill -TERM -1
  1. “i” key - Send the SIGKILL signal to all processes except init.
kill -KILL -1
  1. “s” key - Sync all mounted filesystems.
sync
  1. “u” key - Remount all mounted filesystems in read-only mode.
mount -o remount,ro -a
  1. “b” key - Reboot the system.
reboot

You can execute these commands in the given order to perform a safe reboot of the system, just like you would use REISUB.

— ChatGPT

Prompt: Write a bash script that adds the shortcut.

Sure, here’s a bash script that adds a keyboard shortcut to reboot your Manjaro Linux system::

#!/bin/bash

# Define the command to reboot the system
COMMAND="systemctl reboot"

# Define the shortcut key combination
KEYS="<Control><Alt>R"

# Create a desktop file for the script
cat <<EOF >~/Desktop/Reboot.desktop
[Desktop Entry]
Type=Application
Name=Reboot System
Exec=$COMMAND
Terminal=false
EOF

# Make the desktop file executable
chmod +x ~/Desktop/Reboot.desktop

# Set the shortcut using the gsettings command
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ command "$COMMAND"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name "Reboot System"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ binding "$KEYS"

Save this script as a file with a .sh extension, such as setup_reboot_shortcut.sh. Then, run the script by entering the following command in the terminal:

bash setup_reboot_shortcut.sh

After running the script, a “Reboot System” icon should appear on your desktop, and you should be able to use the Ctrl+Alt+R keyboard shortcut to reboot your Manjaro Linux system.

— ChatGPT

Prompt: Write a bash script that adds the shortcut using the commands like REISUB.

Here’s a bash script that adds a Ctrl+Alt+R shortcut to reboot Manjaro Linux using the REISUB commands:

  1. Create a new bash script and open it with your preferred text editor. For example, you can use the following command to create a new file named reboot-shortcut.sh:
nano reboot-shortcut.sh
  1. Copy and paste the following code into the file:
#!/bin/bash

# Add a Ctrl+Alt+R shortcut to reboot the system using REISUB

# Define the keyboard shortcut
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings \
"['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/']"

# Set the properties for the new custom shortcut
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ \
name 'Reboot System' \
command 'bash -c "echo 1 > /proc/sys/kernel/sysrq && kill -TERM -1 && kill -KILL -1 && sync && mount -o remount,ro -a && reboot"' \
binding '<Primary><Alt>r'

This script defines a new keyboard shortcut using the gsettings command. The shortcut uses the REISUB commands to safely reboot the system.

  1. Save the file and exit your text editor.
  2. Make the script executable using the following command:
chmod +x reboot-shortcut.sh
  1. Run the script using the following command:
./reboot-shortcut.sh

This will add the Ctrl+Alt+R shortcut to reboot Manjaro Linux using the REISUB commands.

  1. Test the new keyboard shortcut by pressing Ctrl+Alt+R. This should safely reboot your system.

— ChatGPT

Prompt: Use dconf write instead of gsettings and add a sleep between the commands.

Sure, here’s an updated bash script that uses dconf write instead of gsettings, and adds a sleep between the commands:

#!/bin/bash

# Define the command to reboot the system
COMMAND="mount -o remount,ro -a && sleep 1 && reboot"

# Define the shortcut key combination
KEYS="<Primary><Alt>r"

# Set the shortcut using the dconf command
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/name "'Reboot System'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/command "'$COMMAND'"
dconf write /org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/binding "'<Primary><Alt>r'"

This script defines a new keyboard shortcut using the dconf write command. The shortcut uses the REISUB commands to safely reboot the system.

Save the script and make it executable using chmod +x reboot-shortcut.sh. Then run the script using ./reboot-shortcut.sh to add the new keyboard shortcut. You can test the shortcut by pressing Ctrl+Alt+R.

— ChatGPT

Don’t you have any GUI Desktop in use? :thinking:
AFAIK all GUI environments have a menu option to reboot or shutdown your computer :thinking:

Anyhow as mentioned by others, the command line version is just:

systemctl reboot

See man systemctl
:vulcan_salute:

Instead of fiddling around the problem, I would suggest finding the reason why it “failed to unmount”. Sometimes I saw such a message in the past, but the reason was that a program was writing or still accessing to it when I run poweroff. Obviously, it will fail to unmount properly. Or a program crash on power off and the kernel still assume that it accesses the mount point and blocks it (in that case it well never unmount properly).

 journalctl  --boot -1 --pager-end

PS: Believe me, on Windows, Volumes are also not always gracefully unmounted for reasons. But you never see it, because it is never a problem and the file system is correctable.

1 Like

Sidenote:

I will unwilling gag myself this time to reply to that part :rofl: