WARNING: Don't change the default shell!

Discussion in 'Modding and Customization' started by mward, Oct 6, 2008.

  1. mward

    mward

    Joined:
    Sep 28, 2008
    Messages:
    4
    Likes Received:
    0
    Having set up various customisations, I decided to switch to my favourite shell (tcsh) using the chsh command. I changed the login shell for root and user: as I have done on every other Linux or Unix machine I have ever used.

    On the next reboot, I got a black screen with an X cursor, and nothing else!

    The first time this happened, I reinstalled the whole system, because I never guessed that changing the login shell would break the machine! The second time, I rebooted off a Linux rescue USB thumb drive and fixed it by editing /etc/passwd to change /bin/tcsh back to /bin/bash. I used this recovery system:

    http://www.tux.org/pub/people/kent-robo ... index.html

    After a rebbot, everything worked again except the trackpad, which was fixed by shutting down, unplugging the power and removing the battery for a while, then starting up again.

    If you are going to mess about with your One, I strongly suggest setting up a rescue disk on a thumb drive: if even the most innocuous change, such as changing the login shell, could render your system unbootable, then a recovery system is essential.
     
    mward, Oct 6, 2008
    #1
  2. mward

    daldred

    Joined:
    Aug 25, 2008
    Messages:
    887
    Likes Received:
    0
    Changing the login shell isn't an innocuous change! The scripts which set things up are shell scripts: changing the shell changes how commands work, so it's not too surprising that some scripts (albeit ones which should specify themselves which shell they should use, but presumably don't) fail.
     
    daldred, Oct 6, 2008
    #2
  3. mward

    mward

    Joined:
    Sep 28, 2008
    Messages:
    4
    Likes Received:
    0
    The login shell is the program which is executed when a user logs in or executes the su command. The various shell scripts which are executed to set up the system should specify their shell on the first line. For example /etc/rc.d/rc.local starts with:

    #!/bin/sh

    so it will be passed to /bin/sh for execution. An executable script whose first line starts with # (without the !) will be passed to /bin/csh. Any other executable script will be passed to /bin/sh.

    It is an error for the startup process to depend on the login shell for root or any other process.

    The file /etc/shells lists the valid shells: if tcsh has been installed, then /bin/tcsh appears in the list of valid shells.
     
    mward, Oct 6, 2008
    #3
  4. mward

    daldred

    Joined:
    Aug 25, 2008
    Messages:
    887
    Likes Received:
    0
    Indeed - but the way the startup process runs on the One is not standard, and I wouldn't want to rely on all scripts being compliant.
     
    daldred, Oct 6, 2008
    #4
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.