Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Make BASH the default shell

    Reply
    xaccrocheur | # 1 | 2011-08-15, 18:44 | Report

    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 ?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    D.Cent | # 2 | 2011-08-15, 18:48 | Report

    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...

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to D.Cent For This Useful Post:
    xaccrocheur

     
    Megaltariak | # 3 | 2011-08-15, 18:56 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 2 Users Say Thank You to Megaltariak For This Useful Post:
    reinob, xaccrocheur

     
    jd4200 | # 4 | 2011-08-15, 19:02 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to jd4200 For This Useful Post:
    xaccrocheur

     
    nathanbibb | # 5 | 2012-02-07, 12:56 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to nathanbibb For This Useful Post:
    reinob

     
    int_ua | # 6 | 2012-02-20, 03:08 | Report

    Originally Posted by nathanbibb View Post
    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?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    Hurrian | # 7 | 2012-02-20, 12:06 | Report

    Originally Posted by int_ua View Post
    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.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    spanner | # 8 | 2012-02-20, 12:35 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following 6 Users Say Thank You to spanner For This Useful Post:
    cube48, int_ua, mr_pingu, reinob, Viqsi

     
    stefanmohl | # 9 | 2012-02-29, 04:50 | Report

    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.

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to stefanmohl For This Useful Post:
    J4ZZ

     
vBulletin® Version 3.8.8
Normal Logout