Shortcut to restart the system

I’m trying to avoid hard drive errors I get when shutting down the system. I don’t know what systemd devs have to do with this.

Please share those, but please make sure you are not confusing errors with warnings or simple outputs … If is about watchdog, you might want to read this Improving performance - ArchWiki

The real reason for that message is more important as the message itself…
If there are processes using that partition in anyway, unmounting will fail for obvious reasons…
So you need to make sure that those processes are shutdown properly before you can safely unmount it…

REISUB is just a forced kill of everything followed by unmount and reboot, eg. not really what you can call a proper way to shutdown (But yes its still safer as a power-off)

You are wrong in the way of thinking. You don’t need to reinvent the shutdown process…you have to find what process still writes to disk and prevent the unmounting and thus shutdown. It is some buggy or misconfigured program that YOU installed, because /mnt/hdd7 is not part of default installation. Hint: what are you using hdd7 for?

I’m not going to try to figure out which process is using each and every resource of the computer when all I want to do is shut down the system. That’s the job of the operating system. Since the operating system isn’t doing its job properly, I need to come up with a general solution that doesn’t require me to look around for processes or resources every time I shut down the system.

You should confuse yourself and us with - IMO - useless AI results.

If the hang is caused by disk io - it may be cache needs to be written - so something like

sync && poweroff

Should do it - but you can get more info by looking at poweroff(8) — Arch manual pages or

man poweroff

But realize the certain processes will tell the system to ignore the shutdown signal - most notably a hypervisor with a running instance which is cannot be closed.

VirtualBox will refuse if a virtual Windows system is running.

If you are the - shutup and shutdown type - you can use the force

       -f, --force
           Force immediate power-off, halt, or reboot. If specified,
           the command does not contact the init system. In most
           cases, filesystems are not properly unmounted before
           shutdown. For example, the command reboot -f is mostly
           equivalent to systemctl reboot -ff, instead of systemctl
           reboot -f.

I wonder if the reason the user wants to create a shutdown script is because they are encountering the dreaded 1 minute and 30 second delay on shutdown, waiting for processes to quick before continuing?
If this is the case, it is an easy remedy…

sudo nano /etc/systemd/system.conf

Look for this entry “DefaultTimeoutStopSec=”, if it is not there, just add it to the bottom like this:

DefaultTimeoutStopSec=10s

Note: 10s means 10 seconds.

After this, any process that has not stopped in 10 seconds, gets killed. I use this on all of my systems and never had any issue. Clean shutdown every time.

Reboot is required for changes to take effect.

I’m having trouble using the shortcuts I’ve created, but people keep suggesting things that aren’t related to my issue. I feel like the AI is understanding my question better. All I want is to press a combination of keys and have it execute a command like sync && mount -o remount,ro -a && sudo umount -l /mnt/* && reboot. However, the shortcut I created using a script only works when I type ‘graceful_restart.sh’ in the terminal, which defeats the purpose of making a shortcut since I want to avoid having to write, and the shortcut I created with dconf doesn’t do anything. I’m not sure if it’s due to a lack of privileges or something else.

Yes, you are correct, the idea of having a keyboard shortcut to shutdown and restart is unconventional if not odd. If you are in Cinnamon, just press ALT + F2 and either type poweroff or reboot, I mean it doesn’t get any easier than that.

Yeah, or I could click the button that says “Quit” and then “Shut Down,” but that is giving me an error. Otherwise, I wouldn’t be wasting time with this.

Well that’s an important piece of information!

What exactly is happening?

Have you heard of an XY problem?

You’re asking about your proposed solution, instead of your problem.

Your “error” looks like a warning or even just information, about a filesystem not being unmounted, it’s not a hard drive error.

I’ve seen similar messages in the past. Unless there’s an actual problem you’re just worrying over nothing.

Do you get any other errors etc?
Do you have to wait for a timeout?
Does it finish shutting down? Quickly?

How do you know it doesn’t get unmounted at a later time?

If you clearly describe the actual issue, perhaps we can figure it out.

Still no answer to this part, what kind of exact error are you getting when you perform those steps?

If you don’t want to fix the real issue, but just want help with your own solution then i think people have already helped you enough…
:vulcan_salute: