Update to OPNsense 21.7.1-amd64 /bin/bash missing

Started by lshantz, August 10, 2021, 12:41:25 AM

Previous topic - Next topic
August 10, 2021, 12:41:25 AM Last Edit: August 10, 2021, 12:56:38 AM by lshantz
I had an SSD block go bad which took my system down hard. I downloaded the 21.7 image and restored assuming that the bad block would be found and marked bad. When I attempted to use the  backup/restore option all hell broke loose. Lots of strange things, like unable to log in and interfaces not coming up.

Suspecting version incompatibility, I located the 21.1 image and restored. I was able to recover to it, just fine. So it does appear to be some sort of issue with the older backups. ?

Now though I have an odd issue that I need to resolve. I can ssh in, with no trouble, but if I try to su, or sudo su, it says: /usr/local/bin/bash: No such file or directory. how can I get a copy of this file back with no admin privileges? How does it not get installed from a scratch install? (21.1) If I save my backup from this 21.7 image, then install the newer image, I wonder if that works.

We do not rely on bash in our code so it's not installed.


Cheers,
Franco

You can set root's shell to e.g. /bin/csh from the UI.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

August 11, 2021, 01:01:43 AM #3 Last Edit: August 11, 2021, 04:00:59 AM by lshantz
Thank you very much for the response. If you do not install bash, what is the default shell you use?

Under system/settings/admin/ I see shell.. but no way to modify it. It is blank. Am I in the wrong spot?
Later: I found under users/root/ shows default of /usr/local/sbin/opnsense-shell, but when attempting to log in it says /bin/bash not found.

So doing a fresh install, then restoring from backup, screws this up?

Quote from: lshantz on August 11, 2021, 01:01:43 AM
Under system/settings/admin/ I see shell.. but no way to modify it. It is blank. Am I in the wrong spot?
Later: I found under users/root/ shows default of /usr/local/sbin/opnsense-shell, but when attempting to log in it says /bin/bash not found.
Did you try save/apply? Possibly change, save, change back, save?

root's default shell should be opensense-shell. If you don't want the menu on login, the FreeBSD default shell for root is /bin/csh.
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

Quote from: franco on August 10, 2021, 08:13:09 AM
We do not rely on bash in our code so it's not installed.


Cheers,
Franco

Just discovered this and appreciate the terse yet direct response. Did I miss this package removal from the release notes?  It broke my automation when I upgraded a few days ago.

See https://forum.opnsense.org/index.php?topic=15395.0

Perhaps bash was installed by another package (which has then changed its approach) and you were relying on that without realising?

Yes. The package manager distinguishes between manual and automatic packages:

"manual" means it was explicitly installed (by invoking "pkg install bash") for example. These packages are not automatically cleaned up.

"automatic" means it was implicitly installed by a dependency (e.g. by invoking "pkg install wireguard-tools"). When said package is removed, the automatic dependency is cleaned up along with it.

Long story short. If you rely on bash the following is enough to make it permanent:

# pkg install bash

Or when it was already installed:

# pkg set -A0 bash


Cheers,
Franco