OPNsense Forum

English Forums => General Discussion => Topic started by: iorx on March 15, 2022, 09:19:33 PM

Title: "shutdown now" from shell and it ask for /bin/sh on the console
Post by: iorx on March 15, 2022, 09:19:33 PM
Hi all!

Corrupt install or something with last version? (I've toyed around a bit with this install...)

See attached pic.
Title: Re: "shutdown now" from shell and it ask for /bin/sh on the console
Post by: meyergru on March 15, 2022, 09:46:50 PM
And I thought I was dumb, I saw this too the other day.
Title: Re: "shutdown now" from shell and it ask for /bin/sh on the console
Post by: franco on March 16, 2022, 10:26:41 AM
Don't use "shutdown now" manually. Use

# opnsense-shell halt

or

# yes | opnsense-shell halt

if you are in a hurry.


Cheers,
Franco
Title: Re: "shutdown now" from shell and it ask for /bin/sh on the console
Post by: franco on March 16, 2022, 10:31:30 AM
PS: https://www.freebsd.org/cgi/man.cgi?shutdown(8) (https://www.freebsd.org/cgi/man.cgi?shutdown(8))

"When run without options, the shutdown utility will place the system into single user mode at the time specified."

Looks like it's working. ;)
Title: Re: "shutdown now" from shell and it ask for /bin/sh on the console
Post by: iorx on March 17, 2022, 08:44:43 AM
And again he strikes (me) Captain Can't Google for Shit aka Major BSD Inexperience. Salud!

So indeed works as designed! I usually go with "shutdown -r now", but was toying around with an educational install here in Hyper-V, and... had the idea that without the "-r" it would shutdown and power off nicely (as I think linux does, another VM guest running DietPi goes into power off ... confirmed).

Read the man, -p:
So using "-p" is not recommended? The right way is "opnsense-shell halt"

Have a nice day!
Title: Re: "shutdown now" from shell and it ask for /bin/sh on the console
Post by: franco on March 17, 2022, 09:07:50 AM
The official halt script is:

https://github.com/opnsense/core/blob/master/src/etc/rc.halt

That is what "opnsense-shell halt" is calling.

Yes, it does use "shutdown -op now", but it also covers tasks not covered by OS itself:

https://github.com/opnsense/core/tree/master/src/etc/rc.syshook.d/stop

"reboot" action is very similar in this matter.  :)


Cheers,
Franco
Title: Re: "shutdown now" from shell and it ask for /bin/sh on the console
Post by: meyergru on March 17, 2022, 06:33:07 PM
Yup, I had it for "reboot"... way to much Linux experience, I guess. Not all OSes are the same...  :-X