maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   Make BASH the default shell (https://talk.maemo.org/showthread.php?t=75773)

xaccrocheur 2011-08-15 18:44

Make BASH the default shell
 
Hi all ; Sorry if this info exists elsewhere, I searched for it but the search engine is weird...

I installed BASH4 but I can't seem to use it, no matter what I do, echo $SHELL returns /bin/sh

How can I make BASH the default shell for both user and root ?

D.Cent 2011-08-15 18:48

Re: Make BASH the default shell
 
I once replaced the default shell by the z-shell (zsh). However, I wasn't able to reboot then (Maemo didn't come up --> reflash).

So if there is a possibility to change the default shell, it's not replacing the entry in /etc/passwd...

Megaltariak 2011-08-15 18:56

Re: Make BASH the default shell
 
Replacing the entry in /etc/passwd works if the shell is compatible with the Maemo scripts which are run at boot. Bash 3.2 is compatible, I run it for a long time as the default shell with no problems. Bash 4 SHOULD be compatible but I haven't tested it (no need for it), you can try replacing the entries in /etc/passwd (ONLY for user, root and eventually others users that you created) but make a backup first.

jd4200 2011-08-15 19:02

Re: Make BASH the default shell
 
I've been using bash4 as the default shell for a few weeks now, and I've had no issues.

As Megaltariak said, you need to edit your /etc/passwd, and replace /bin/sh with /bin/bash, for root and user; be careful as a typo, or replacing the wrong entry will lead to problems.

e.g. change
user:XXXX.XXXX:XXX:XXX::/home/user:/bin/sh
to
user:XXXX.XXXX:XXX:XXX::/home/user:/bin/bash

the XXX's in your case will be a bunch of digits.

nathanbibb 2012-02-07 12:56

Re: Make BASH the default shell
 
So I'm not sure if there is something I've done wrong here, but following jd4200's advice above, I am now not able to boot the N900. Here is what I did exactly:

1. I previously had Bash 3.2 installed and working on the N900 X Terminal, but was hoping to update to Bash 4.
2. I installed Bash 4 from Extras-Dev
3. I uninstalled Bash 3.2 using App Manager (HAM).
4. In the X Terminal (now running Busybox), I used 'sudo vi /etc/passwd' to update the passwd file, replacing '/bin/sh' with '/bin/bash' for user and root and saved.
5. When restarting X Terminal, it errored out and quit (I'm not sure where the log files are for X Terminal, so if there is more I can provide let me know where to pull it).
6. When restarting the device, the N900 hangs indefinitely.
7. I restarted using the rescue initrd and changed the /etc/passwd file back to using '/bin/sh' for user and root.
8. N900 still does not boot up.

Since I am able to get to the device, I have no issue rescuing my data and flashing the device (I've done this plenty of times), but I am not sure if I did something wrong or if the instructions above are incorrect.

Let me know if you have any comments on what I could have done wrong - otherwise, I'll let this stand as a warning for anyone looking to the directions above.

int_ua 2012-02-20 03:08

Re: Make BASH the default shell
 
Quote:

Originally Posted by nathanbibb (Post 1161653)
2. I installed Bash 4 from Extras-Dev
3. I uninstalled Bash 3.2 using App Manager (HAM).
4. In the X Terminal (now running Busybox), I used 'sudo vi /etc/passwd' to update the passwd file, replacing '/bin/sh' with '/bin/bash' for user and root and saved.

Bash 4 executable is /bin/bash4, isn't it?

Hurrian 2012-02-20 12:06

Re: Make BASH the default shell
 
Quote:

Originally Posted by int_ua (Post 1167170)
Bash 4 executable is /bin/bash4, isn't it?

Code:

ln -s /bin/bash4 /bin/bash
Fixes issues with ez-debian trying to use bash4.

spanner 2012-02-20 12:35

Re: Make BASH the default shell
 
Out of paranoia, I use a .profile entry that checks whether 'sh' is being run in interactive mode AND whether bash is available, and if so execs it:

Code:

if [ $SHELL = "/bin/sh" ]; then
  if [ -x /bin/bash ]; then
    case $- in
      *i*) exec bash $@;;
    esac
  fi
fi

I didn't want to mess with /etc/passwd or inadvertently remove bash only to find my device unusable, and this does the trick for me.

stefanmohl 2012-02-29 04:50

Re: Make BASH the default shell
 
The simple way to do this is to run:

chsh

Then give it the path to the shell you want to run. I think chsh is installed by default.


All times are GMT. The time now is 05:02.

vBulletin® Version 3.8.8