6

I have a time-consuming program running in Lubuntu 18.04 Live. It will take around one day to finish. After the program finishes the computer shuts down.

But since I am running Lubuntu Live, the computer asks me to

Please remove the installation medium then press enter

after initiating the shutdown. I will be traveling away before the program can finish and will not be back in a few weeks. I don't want the computer to be powered on all that time.

My question is: Is there a timeout after which the computer will eventually shut down, or is there any way to skip this prompt and completely shut down Lubuntu Live?

  • Sorry I missed 'Live' in the os description! – gena2x Jul 05 '19 at 17:46
  • You can always do poweroff -f, which will shutdown unconditionally and immediately. As this is livecd it should be fine, just be sure to unmount any file system you using. – gena2x Jul 05 '19 at 17:48
  • @gena2x Yes that works, thank you. I can use that. – TheAdam122 Jul 05 '19 at 17:53
  • Strictly speaking, the computer isn't "up and running" at that point. The OS has been unloaded and it's safe to turn it off. Is using a plug with a timer an option? That way you can set it to just turn off the power after a day or so. – terdon Jul 05 '19 at 18:00
  • @terdon well using a timer would mean having to unplug the computer so that is not an option for me, as the program is already running and it is not easy to stop and resume (i am running automated data recovery) – TheAdam122 Jul 05 '19 at 18:08
  • I got the same error and i used the below command and it was work for me. First, run this command: all_generic_ide pci=nommconf and then this command: ide=nodma acpi=off – PRAGNESH PATEL May 05 '20 at 20:23
  • OP didn't mention any errors. And you should explain what your "command" does. – annahri May 05 '20 at 20:34
  • @annahri i am talking about this error 'Please remove the installation medium then press enter' while installing Ubuntu might get this error and first run all_generic_ide pci=nommconf and then run ide=nodma acpi=off – PRAGNESH PATEL May 06 '20 at 15:06

4 Answers4

2

In situations, where a remotely accessed rescue system is already running and a reboot into the installed OS is required, the prompt can be disabled by editing the file /sbin/casper-stop.

E.g., at the end of /sbin/casper-stop:

    eject -p -m $device >/dev/null 2>&1
[ "$prompt" ] || return 0

add an unconditional return 0:

    eject -p -m $device >/dev/null 2>&1
[ "$prompt" ] || return 0

return 0

wolfmanx
  • 259
  • 2
  • 6
1

Try adding noprompt to the kernel command line (e.g., type e at the grub menu or the suggested Fn key).

See the manpage for other live boot options.

Jacopo
  • 136
  • 5
  • +1, this answer is the easiest to implement and can be undone easily (if you add/remove noprompt from grub's config) – TheLizzard May 09 '23 at 11:00
1

/sbin/casper-stop already has (or has since had added) code to handle this situation if the file /run/casper-no-prompt exists.

You can create a simple systemd unit file to always create this:

mint@mint:~$ cat /etc/systemd/system/casper-no-prompt.service 
# see /sbin/casper-stop
[Unit]
Description=Casper no-prompt

[Service] Type=oneshot ExecStart=touch /run/casper-no-prompt

[Install] WantedBy=multi-user.target mint@mint:~$ sudo systemctl daemon-reload mint@mint:~$ sudo systemctl enable casper-no-prompt mint@mint:~$ sudo systemctl start casper-no-prompt mint@mint:~$ sudo systemctl status casper-no-prompt ● casper-no-prompt.service - Casper no-prompt Loaded: loaded (/etc/systemd/system/casper-no-prompt.service; enabled; vendor preset> Active: inactive (dead) since Sat 2020-11-28 09:19:33 GMT; 1s ago Process: 4931 ExecStart=/usr/bin/touch /run/casper-no-prompt (code=exited, status=0/S> Main PID: 4931 (code=exited, status=0/SUCCESS)

Nov 28 09:19:33 mint systemd[1]: Starting Casper no-prompt... Nov 28 09:19:33 mint systemd[1]: casper-no-prompt.service: Succeeded. Nov 28 09:19:33 mint systemd[1]: Finished Casper no-prompt. mint@mint:~$ ls -l /run/casper-no-prompt -rw-r--r-- 1 root root 0 Nov 28 09:19 /run/casper-no-prompt mint@mint:~$

  • What can u do in Finnix ? This only works in Ubuntu – ToiletGuy Apr 16 '21 at 08:51
  • 1
    On Finnix the behaviour can be changed by setting LIVE_MEDIUM_EJECT_VERBOSE=false prior to shutdown. This can be set in /etc/tools/live.conf (see the /bin/live-medium-eject script for details of the implentation), although since Finnix is designed to be used in "live" read-only mode, I'm not sure how you would do this persistently. – Annihilannic Apr 17 '21 at 15:05
  • I have found the solution yesterday https://unix.stackexchange.com/questions/645377/force-finnix-linux-rescue-disk-to-shutdown-without-prompting-to-remove-cd-when and about how i did the read only mode, is I modified that live CD using squashfs tool and repack back. – ToiletGuy Apr 17 '21 at 15:57
  • Is there a documentation about that somewhere? You just gave me valuable info here. – ToiletGuy Apr 17 '21 at 16:01
  • I don't know, I just read the code. :-) – Annihilannic Apr 19 '21 at 05:43
  • I mean the documentation for Finnix stated the location of the code. I don't think this is documented in their website. I also found the location of /bin/live-medium-eject by luck. – ToiletGuy Apr 19 '21 at 08:22
0

The following solution will work on:

  • Operating System: Linux Mint 20.3 Live
  • Kernel: Linux 5.4.0-91-generic
  • Architecture: x86-64

Method: Edit the casper-stop file:

sudo gedit /sbin/casper-stop +126
  • The original will look like this:
     if [ -x /bin/plymouth ] && plymouth --ping; then
            plymouth watch-keystroke > /dev/null
        else
               read x < /dev/console
        fi
    
  • Change this to:
     if [ -x /bin/plymouth ] && plymouth --ping; then
            plymouth watch-keystroke > /dev/null
        else
            x='\n'
            #read x < /dev/console
        fi
    

Now it doesn't ask for confirmation of the shutdown.

  • Can you confirm that this exact solution solves the user's issue, taking into consideration that the user in the question is not using Linux Mint 20.3 Live, but Lubuntu 18.04 Live. – Kusalananda May 18 '22 at 18:37