Score:0

Cannot execute /usr/local/bin/fish: No such file or directory

pw flag

To preface, I'm new to all this and still learning, so please bare with me when it comes to terminology and locating things.

Setup: Proxmox Virtual Environment 7.2-3 + Container + ubuntu-22.04-standard_22.04-1_amd64.tar.zst

Issue: For my Ubuntu server's terminal/console, I installed fisher and fish shell yesterday merely to change the appearance. When I tried to restart the container, I received a login issue that appeared to be related to the location of fish I had placed in the directory. Though I'm not totally certain.

I don't know how to log back into the container, and I'd rather not have to start from scratch by setting everything up again. I would be grateful for any assistance.

Further Background info and Images:

Score:2
vn flag

First, the good news -- There's almost certainly a way to recover. The bad news is that I don't exactly how to do so in this case. I'll make some suggestions below on what I think will work, but I don't run Proxmox, so I can't test directly.

But first, I'm going to make a suggestion:

  • When installing software, use the official docs first, rather than a "Technical" site such as the one you referenced above.

The article you linked to above is just plain wrong and will (did) result in system corruption. The correct process is documented by the Fish team in:

With apologies, a bit of a rant -- Sites like the one you linked to are "paid content sites". They pay for articles from "freelance" (albeit "vetted") writers. Unfortunately, the content can vary wildly in quality. To give you the worst example I've seen, last year a new visitor came into a Subreddit I frequent on a technical topic. The person wrote (paraphrasing, but accurate):

I have no knowledge of [topic] and have never used it, but I've been asked to write an article about how to do [xyz] with [topic]. Can anyone give me some guidance?

Note that I do not know which site they were writing for.

Of course, not every article on every paid-content site is like that, but the article you refer to above is bad. Any documentation that will absolutely, no-questions-asked, corrupt your system is bad. The main problem is in:

Step 4 ("Make fish shell as default shell") in that doc reads:

sudo chsh -s /usr/local/bin/fish

That's just multiple mistakes wrapped up into one!

  • First, and worst -- That's the incorrect path for Fish under Ubuntu. That is, I believe, where Fish would be installed under macOS. Under Ubuntu, it's (typically) /usr/bin/fish, but as the Fish docs point out, you should always confirm the location on your system.

  • By using sudo chsh without a username, it changes the shell for the root user. This is bad, and makes recovery so much more difficult.

    If you wanted to change the shell for the current user using sudo, the syntax would be:

    sudo chsh -s <path/to/shell> $USER
    
  • But even that's a bad idea, as chsh as the root user (a.k.a. sudo chsh) will allow you to set a "bad shell" path. It will warn you, but it will still change /etc/passwd to use the bad shell path you told it to.

    sudo chsh -s /this/is/bad $USER
    grep $USER /etc/passwd
    

    You will see the wrong path is set.

    Side-note: I'm able to try these things out on my system without fear of corruption since I'm using Windows Subsystem for Linux, a virtual environment where I know I can easily recover any of these mistakes. Proxmox containers should actually be very similar to the technology that WSL uses "under-the-hood", so I'm assuming there's just as easy a recovery mechanism there.

The correct command for changing your shell to Fish under Ubuntu is simply:

chsh -s /usr/bin/fish

As long as you don't use sudo, it will change your user's shell, and it will validate that the shell is a good one.


Recovery Plan

You mention that you are using Ubuntu as a container in Proxmox. That's good, I believe. If you were using a VM, you would need to boot into Ubuntu under Proxmox using a valid shell. That would still be possible.

Again, the bad news here is that I'm not quite sure how to do this, and since Proxmox doesn't run under Ubuntu, you may need a different site (such as the Proxmox forums) to answer this. In general, you're going to need to:

  • Access the Proxmox commandline.

  • I'm assuming from the Proxmox doc that you will need to use the pct tool to manage the container.

  • Access the Ubuntu container with a valid shell. You might try pct exec <vmid> /usr/bin/bash.

  • You'll need to be root inside the Ubuntu container, which I believe will be the default for pct.

Once you have access to the Ubuntu container in a valid shell, as root:

  • chsh -s /usr/bin/bash

    There's a chance this won't work since the shell for the current user is invalid. However, I believe that root will still be able to reset the shell (a normal user definitely would not). However, if you run into problems, the other alternative is:

    vipw
    

    This will allow you to edit your /etc/passwd directly, and change the /usr/local/bin/fish to /usr/bin/bash.

    This will reset your root user's shell back to a good one. For root, I would recommend leaving the shell as Bash. Change your shell to Fish for your normal, non-root user as described in the Fish docs.

NotTheDr01ds avatar
vn flag
In re-reading my answer, I believe I set a new personal record for uses of the word "bad" in a single post. However, it was warranted ;-).
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.