1

When shutting down Finnix Rescue Disk (using power button), I got the following message:

Please remove the live-medium, close the tray (if any) and press ENTER to continue:

Well, if I don't use power button, I can just trigger poweroff -f , where the -f option to force the rescue disk to shutdown, this will shutdown the OS without the above interactive message.

But using the power button it will not shutdown the OS with option -f. So how do you skip this message when shutting down the Finnix Rescue Disk using power button?

I found this post here which talks about

  1. modifying the script for /run/casper-no-prompt (but it doesn't work probably because this file is only for Ubuntu-based)
  2. putting noprompt and I even put noeject at the boot parameter but it has no effect

Note that I'm able to edit this ISO file and repack it back and make it bootable. So, is there a file that I can modify to skip the above interactive message when shutting down Finnix like putting a boot script that will trigger after pressing power button. I found that post here about Graceful shutdown via power button but it talks about CentOS only but I don't think this will work.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
ToiletGuy
  • 195

1 Answers1

1

I tried several methods like using rc6.d or rc0.d but all of them are not working. Then I found this helpful post about how to run a script right before shutdown. My aim is to override the shutdown command that is being triggered to shutdown -f

The post asked me to create a script in /usr/lib/systemd/system-shutdown. When I navigate to this directory, I found a script called live-tools.shutdown. The file contains the following code:

#!/bin/bash
/bin/live-medium-eject

So, I read the other file /bin/live-medium-eject and I found out this is the file has the code to wait for user input (press enter to eject disk). So I just need to comment the code like this:

#!/bin/bash
#/bin/live-medium-eject

Then when using the power button, it will not ask for ejecting Disk. Solved.

Another way I can think of without disturbing the code is to create a new script inside /usr/lib/systemd/system-shutdown called something like areboot (with the first character of a so it might execute first) and inside that script I can put this code and make it executable:

#!/bin/bash
reboot -f

I think this will work but I haven't tested this. The first one works but I'm not sure if the script is needed by others after I disabled it.

ToiletGuy
  • 195
  • 2
    Your first method will work for sure, but just a style point: it's a general principle with systemd that if you have something under [/usr]/lib/systemd/... that you need to override, you can (and should) do it by placing a file with the exact same name in the corresponding path under /etc/systemd/.... In this case, you could run mkdir -p /etc/systemd/system-shutdown; ln -s /dev/null /etc/systemd/system-shutdown/live-tools.shutdown to override the existing script in a "standard" way. – telcoM Apr 16 '21 at 12:55
  • @telcoM thanks for the tips! – ToiletGuy Apr 16 '21 at 18:00