Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: No Shell found at booting

  1. #1

    Unhappy No Shell found at booting

    I read about the benefits of running shell scripts in another shell then bash so I installed dash. Then I tried to link /bin/sh to dash instead of bash. I do not have a good understanding of linking but thought copying such a command wouldn't lead to problems. I seem to have something wrong and made an invalid link (maybe linking to itself?). When I turn on my computer and try to start openSuse, it says it can not find a shell. I am stuck in some kind of command line but the only thing I can do is fill in my user name and passwords, if I do that, it tells me I have no mail.
    I think chrooting in from a usb is the way to solve this (I have done this ones before after misconfiguring grub) but don't know how to solve the problem with the (symbolic) links.
    I would truly appreciate any help.
    Twijg

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,948

    Default Re: No Shell found at booting

    I do not think that script written for one interpreter will run very well on a different interpreter. Even if both are shells and thus probably related. Some shells differ more from others then some others, but I would never take the chance.

    Linking the default shell to something different is of course a recipe for disaster. Every script in the system that wants the default shell will now be treated by a different program (when the link points to another shell if you intended) or not run at all (when your link failed for some reason).

    I think your best approach is a rescue boot, mount the / file system of the broken system and undo the link.
    Last edited by hcvv; 08-Aug-2020 at 09:16.
    Henk van Velden

  3. #3
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    14,299
    Blog Entries
    3

    Default Re: No Shell found at booting

    Quote Originally Posted by Twijg View Post
    I am stuck in some kind of command line but the only thing I can do is fill in my user name and passwords, if I do that, it tells me I have no mail.
    When you get to that point, try entering "root" for the user name and the root password. Then chances are that will get you in with a root command line, where you can fix the problem.

    You probably need to then do:
    Code:
    cd /bin
    rm sh
    ln -s bash sh
    openSUSE Leap 15.2; KDE Plasma 5.18.5;

  4. #4
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    14,299
    Blog Entries
    3

    Default Re: No Shell found at booting

    Quote Originally Posted by Twijg View Post
    I read about the benefits of running shell scripts in another shell then bash so I installed dash. Then I tried to link /bin/sh to dash instead of bash.
    I looked at "dash" in Yast Software Management.

    What you did ought to have worked, since "dash" is supposed to be a posix compliant implementation of "sh".

    I am not at all surprised that it did not work. But that should be considered a bug. It indicates that too many bashisms have crept into the system. It indicates that there are scripts that ought to start with "#! /bin/bash" but have either omitted that line or used "#! /bin/sh" instead.

    Or perhaps there are bashisms in "/etc/profile".

    Hmm, maybe I should experiment with that. But it might work for me, because I use "csh" as my shell.
    openSUSE Leap 15.2; KDE Plasma 5.18.5;

  5. #5

    Default Re: No Shell found at booting

    Quote Originally Posted by nrickert View Post
    When you get to that point, try entering "root" for the user name and the root password. Then chances are that will get you in with a root command line, where you can fix the problem.

    You probably need to then do:
    Code:
    cd /bin
    rm sh
    ln -s bash sh
    Thanks for your reply, I'll try to do that.


    Quote Originally Posted by nrickert View Post
    I looked at "dash" in Yast Software Management.

    What you did ought to have worked, since "dash" is supposed to be a posix compliant implementation of "sh".

    I am not at all surprised that it did not work. But that should be considered a bug. It indicates that too many bashisms have crept into the system. It indicates that there are scripts that ought to start with "#! /bin/bash" but have either omitted that line or used "#! /bin/sh" instead.

    Or perhaps there are bashisms in "/etc/profile".

    Hmm, maybe I should experiment with that. But it might work for me, because I use "csh" as my shell.
    I too thought that all bash dependent scripts would have specified bash as shell instead of using the sh. The problem could also be a wrong linkage of mine. If I can make it work again, I'll try again to use dash as standard shell, hopefully that will work, if not, I'll just keep using bash for everything.

  6. #6
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    14,299
    Blog Entries
    3

    Default Re: No Shell found at booting

    Before posting, I had checked with a Tumbleweed system. But the system that I checked was last updated a week ago.

    I have since checked another system, one that has been more recently update. And the shell setup has changed.

    Now "/bin/sh" is a link to "/usr/bin/sh". And "sh" has now been put under control of update-alternatives. You can probably fix it with
    Code:
    update-alternatives --config sh
    which should tell you that something is wrong and that it is fixing it.

    Follow that with
    Code:
    cd /bin
    rm sh
    ln -s ../usr/bin/sh .
    And then check with:
    ls -lL /bin/sh /bin/bash
    Those should both give the same date and file size since they should both be links to the same file.

    I may experiment with "dash". I installed it, but "update-alternatives" does not see it as an alternative for "sh". Perhaps the recent changes are a work in progress.
    openSUSE Leap 15.2; KDE Plasma 5.18.5;

  7. #7
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    14,299
    Blog Entries
    3

    Default Re: No Shell found at booting

    An update.

    I installed "dash" (in an up-to-date Tumbleweed)
    I then did:
    Code:
    cd /usr/bin
    rm sh
    ln -s dash sh
    And I rebooted to see what happened.

    Things were mostly fine. I tried with GDM and then with SDDM. Either way, I could get into a GUI session without a problem.

    I also tried login with a different user who has "/bin/sh" as a shell. And that also went fine.

    I did see one problem. During booting, I got an error:
    Code:
    [FAILED] Failed to start Apply settings from /etc/sysconfig/keyboard.
    So there's probably a bashism somewhere in that startup file.

    I then reverted "sh" to using "bash", and rebooted. That failure did not show up. It only shows up when using "dash".
    openSUSE Leap 15.2; KDE Plasma 5.18.5;

  8. #8

    Default Re: No Shell found at booting

    I tried the solutions and they didn't work, the command
    Code:
    update-alternatives --config sh
    complains about not having an alternative.
    After trying to continue nevertheless and rebooting, I get the same error (problem with symbolic links) as before.

  9. #9
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    26,948

    Default Re: No Shell found at booting

    Can you at least show what you have now?
    Code:
    ls -l /bin/sh
    Henk van Velden

  10. #10
    Join Date
    Aug 2010
    Location
    Chicago suburbs
    Posts
    14,299
    Blog Entries
    3

    Default Re: No Shell found at booting

    Lets see if we can get everything the way that it should be.

    This is from Tumbleweed, as updated today:
    Code:
    % cd /usr/bin
    % ls -l sh
    lrwxrwxrwx 1 root root 20 Aug  4 12:21 sh -> /etc/alternatives/sh
    
    % cd /etc/alternatives
    % ls -l sh
    lrwxrwxrwx 1 root root 13 Aug  4 12:21 sh -> /usr/bin/bash
    
    % cd /bin
    twleap:rickert 6% ls -l sh
    lrwxrwxrwx 1 root root 13 Aug  2 06:21 sh -> ../usr/bin/sh
    You can check what you get. The dates might be different, because the date on a symlink is probably the date when that link was made.

    The first two of those (for "/usr/bin" and for "/etc/alternatives") are probably correct on your system. When you tried that "update-alternatives" command, it should have fixed those after complaining that they were broken.

    The last one (for "/bin") is probably still broken.

    You can fix (as root) with:
    Code:
    cd /bin
    rm sh
    ln -s ../usr/bin/sh  sh
    openSUSE Leap 15.2; KDE Plasma 5.18.5;

Page 1 of 3 123 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •