You are not logged in.
Hello:
I shut down my Devuan Beowulf system with a script called from a launcher which I set up within the panel of my Xfce desktop:
This is the script:
#!/bin/sh
# added to shutdown directly - no shutdown helper
PATH=/sbin:/bin:/usr/sbin:/usr/bin:
#
sync && sudo ethtool -s eth0 wol d && sudo rmmod -s -v e1000e && sudo shutdown -h now
This is the launcher command line:
xfce4-terminal -x sudo /usr/bin/shutdown.sh
This has been working perfectly well for the longest time.
Some time ago I set up Pihole in an autostarted Vbox virtual machine but although it seems to start up properly it does not shutdown gracefully.
ie: sudo shutdown -h now takes effect before the virtual machine has completely shut down.
The idea is to send the virtual machine the shutdown command, wait 5s and then execute the shutdown script.
Simple if not elegant.
As VBox gives members of the vboxusers group permission to start and shutdown a virtual machine, I cannot add the shutdown command to the shutdown script called from the launcher because this script needs sudo. ie: root privileges and the vms belong to vmusers and not to root.
So I add the virtual machine shutdown script + a 5s sleep to the launcher command line.
But it does not work with the launcher.
vboxmanage controlvm "madmax ascii" poweroff && sleep 5s && sudo /usr/bin/shutdown.sh works properly if I execute it from a terminal.
But not when I run it from the launcher:
xfce4-terminal -x vboxmanage controlvm "madmax ascii" poweroff && sleep 5s && /usr/bin/shutdown.sh
It only shuts down the virtual machine, the rest of the command does not have effect.
Cannot figure out what I'm doing wrong.
Any ideas?
Thanks in advance.
A.
Last edited by Altoid (2021-11-28 21:47:29)
Online
Maybe instead of using sleep use the wait command.
Offline
Hello:
... instead of using sleep use the wait command.
Hmm ...
"... wait is a command that waits for the given jobs to complete ..."
Think that may be it?
I'll try it out and report back here.
But if it the command works from an open terminal ...
vboxmanage controlvm "madmax ascii" poweroff && sleep 5s && sudo /usr/bin/shutdown.sh
... shouldn't it also work in the launcher command line?
xfce4-terminal -x vboxmanage controlvm "madmax ascii" poweroff && sleep 5s && sudo /usr/bin/shutdown.sh
My guess is that there's something in the syntax I'm using, just cannot find out what it is.
Thanks for your input.
Best,
A.
Online
If its working directly and not in a script, my first guess would be path issues.
rolfie
Offline
Hello:
... try it out and report ...
No, no change in how running the command from the launcher behaves.
But thanks a lot for the heads up on wait. 8^D
Using it instead of sleep, which has to be used with an arbitrary time lapse (which may or may not be always right) makes for a faster resolution of the command.
Thanks for your input.
Best,
A.
Online
Hello:
... working directly and not in a script, my first guess would be path ...
I thought of that at first so I checked the script and the launcher command line.
On one hand both xfce4-terminal and vboxmanage are located in /usr/bin/.
Also, as the vm does get shut down, I concluded that it was not related.
Nevertheelss, I just checked to see:
xfce4-terminal -x /usr/bin/vboxmanage controlvm "madmax ascii" poweroff && wait && sudo /usr/bin/shutdown.sh
... does not work either.
Thanks for your input.
Best,
A.
Online
I won't comment on VirtualBox (that sound you can hear is me biting my tongue) but using an entire terminal emulator to run a script seems... excessive.
Perhaps just run a shell instead, for example:
sh -c 'command1 && command2'
But I would recommend using /etc/rc6.d/ to execute scripts on shutdown. Ask the interweb for details 'cos I really don't know what I'm doing with sysvinit.
Brianna Ghey — Rest In Power
Offline
Hello:
... won't comment on VirtualBox ...
=^ )
... an entire terminal emulator to run a script ...
The only way I found to run this set of commands and see the printout roll out 'live' without much hassle.
Maybe could have sent the output to a file.
Perhaps just run a shell instead ....
Yes!!!
It lives! 8^D
sh -c 'vboxmanage controlvm "madmax ascii" poweroff && wait && sudo /usr/bin/shutdown.sh' as the command in the launcher works great.
Quite fast, maybe because the terminal is not involved now (?).
I have to look at the logs and see if anything is amiss VBox wise, but at first sight it seems to work as intended.
... recommend using /etc/rc6.d/ to execute scripts on shutdown.
I'll have a look at that further on.
Thank you very much for your input.
Much appreciated.
Best,
A.
Last edited by Altoid (2021-11-29 20:16:36)
Online
Hello:
Yes!!!
It lives! 8^D
.. look at the logs and see if anything is amiss ...
No problems detected in the guest machine logs, Pihole or Unbound.
For completeness' sake:
I run an autostarted VBbox Devuan Beowulf guest running Pihole/Unbound.
Although it starts up properly, for some reason it does not shutdown gracefully.
The result is that I get error messages when I shut down the host:
groucho@devuan:/var/log$ cat messages | grep -i error
--- snip ---
Nov 19 22:38:23 localhost kernel: [21254.843754] traps: VBoxSVC[2451] trap int3 ip:7fa545efcddc sp:7ffe92195e50 error:0 in VBoxXPCOMIPCC.so[7fa545ef8000+f000]
--- snip ---
groucho@devuan:/var/log$
See https://dev1galaxy.org/viewtopic.php?id=4684
Fixing this script (VBox) issue made everything right.
Now the host shuts down after the guest shuts down properly, it's health is preserved and there are no more localhost kernel errors.
Thanks to all that pitched in. 8^)
Best,
A.
Last edited by Altoid (2021-11-30 11:14:40)
Online