~alpine/users

5 3

Reverting default shell from '/bin/dash' to '/bin/ash': Commands not found, permissions denied

Details
Message ID
<CALVR4_2DnY1E6jfUg+NAxzhSLXE=DJXMj+J3LE2x=OvyC0HSYA@mail.gmail.com>
DKIM signature
missing
Download raw message
Dear friends

I have changed my default shell to `/bin/dash`, following the instructions in
`https://wiki.alpinelinux.org/wiki/Shell_management#By_hand`,
which worked fine.

However, when reverting the default shell back to `/bin/ash' following
the above steps,
many of the commands are not available, e. g.:
    [userx ~]$ ls -l /
    /bin/ash: ls: not found
     [userx ~]$ man ls
    /bin/ash: man: Permission denied
    [userx ~]$ vi /etc/passwd
    /bin/ash: vi: not found
    [userx ~]$ su -
    /bin/ash: su: not found

Changing the default shell once more to `/bin/bash` appears to work
fine, but I'd like to use
`/bin/ash`.

Alpine 3.22.1

Part of content of `/etc/passwd`:
```
userx:x:1000:1000::/home/userx:/bin/ash
```
Content of `/etc/shells`:
```
# valid login shells
/bin/sh
/bin/ash
/bin/bash
```

    [userx ~]$ echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

What did not help:
    # apk upgrade
    # apk fix busybox
    # apk fix busybox-binsh

What else can I do, except for deleting the user and recreate it?

Thanks for any tips!

Best regards

Rolf
Details
Message ID
<DBKEUM0YSCWW.2LNX6RFB4LSTG@posteo.net>
In-Reply-To
<CALVR4_2DnY1E6jfUg+NAxzhSLXE=DJXMj+J3LE2x=OvyC0HSYA@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On Thu Jul 24, 2025 at 5:42 PM CEST, Rolf wrote:
> Dear friends
>
> I have changed my default shell to `/bin/dash`, following the instructions in
> `https://wiki.alpinelinux.org/wiki/Shell_management#By_hand`,
> which worked fine.
>
> However, when reverting the default shell back to `/bin/ash' following
> the above steps,
> many of the commands are not available, e. g.:
>     [userx ~]$ ls -l /
>     /bin/ash: ls: not found
>      [userx ~]$ man ls
>     /bin/ash: man: Permission denied
>     [userx ~]$ vi /etc/passwd
>     /bin/ash: vi: not found
>     [userx ~]$ su -
>     /bin/ash: su: not found
>
> Changing the default shell once more to `/bin/bash` appears to work
> fine, but I'd like to use
> `/bin/ash`.
>
> Alpine 3.22.1
>
> Part of content of `/etc/passwd`:
> ```
> userx:x:1000:1000::/home/userx:/bin/ash
> ```
> Content of `/etc/shells`:
> ```
> # valid login shells
> /bin/sh
> /bin/ash
> /bin/bash
> ```
>
>     [userx ~]$ echo $PATH
>     /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
>
> What did not help:
>     # apk upgrade
>     # apk fix busybox
>     # apk fix busybox-binsh
>
> What else can I do, except for deleting the user and recreate it?
>
> Thanks for any tips!
>
> Best regards
>
> Rolf

Could you maybe check what `command -v man` and `stat /bin/ls` outputs?
Details
Message ID
<20250724173303.54ba0d00@bonsai.doitto.me.uk>
In-Reply-To
<DBKEUM0YSCWW.2LNX6RFB4LSTG@posteo.net> (view parent)
DKIM signature
missing
Download raw message
Perhaps your shell init has become confused, and you path is not being
set properly?

does /usr/bin/ls work?

another machine or VM is useful for reference in these situations.
Details
Message ID
<CALVR4_113Dgap5N-4mXtPa12X-j7f3rpoErmOmpASPdQ=m5ksg@mail.gmail.com>
In-Reply-To
<20250724173303.54ba0d00@bonsai.doitto.me.uk> (view parent)
DKIM signature
missing
Download raw message
Dear Ian,
dear Sertonix

Many thanks for your time.

Ian Smith <m4r35n357@gmx.co.uk> wrote:
> does /usr/bin/ls work?

Yes, `/usr/bin/ls` works fine in `ash`.

Sertonix <sertonix@posteo.net> wrote:
> Could you maybe check what `command -v man` and `stat /bin/ls` outputs?

Output with `ash`:
$ command -v man
No output.

$ command -v /usr/bin/man
/usr/bin/man

$ /bin/stat ls
stat: can't stat 'ls': No such file or directory

$ /bin/stat /bin/ls
File: '/bin/ls' -> '/bin/busybox'
  Size: 12            Blocks: 0          IO Block: 4096   symbolic link
Device: 10303h/66307d    Inode: 917545      Links: 1
Access: (0777/lrwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2025-07-25 16:52:00.303372867 +0200
Modify: 2025-07-13 17:21:28.020744413 +0200
Change: 2025-07-13 17:21:28.020744413 +0200

Output with `bash`:
$ command -v man
/usr/bin/man

$ /bin/stat ls
Same output as in `/bin/stat /bin/ls` in `ash`.

Thanks to your hints, I tried adding the following line to `~/.profile`:
`export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin`

Now it works :), although I don't know why ... (I don't know where the
system-wide default PATH variable is defined).

Best regards, and thanks again

Rolf


Rolf
Details
Message ID
<20250725185702.0200d256@bonsai.doitto.me.uk>
In-Reply-To
<DBKEUM0YSCWW.2LNX6RFB4LSTG@posteo.net> (view parent)
DKIM signature
missing
Download raw message
The sh and bash man pages describe in horrible detail the sequence of
shell init files!  It is not something I would like to have to explain!

If you have someting working, I'd stick with it for the time being,
you can sort out the details later when you have nothing better to do ;)
Details
Message ID
<CALVR4_2zq6QOjbaJwK9c0=mLc4Bzj6_mJ5LaACfM8aX5Y7LOig@mail.gmail.com>
In-Reply-To
<20250725185702.0200d256@bonsai.doitto.me.uk> (view parent)
DKIM signature
missing
Download raw message
Dear Ian

Ian Smith <m4r35n357@gmx.co.uk> wrote:
> The sh and bash man pages describe in horrible detail the sequence of
> shell init files!  It is not something I would like to have to explain!

You have put it very nicely: "in horrible detail", "It is not something I
would like to have
to explain!" - I'll have to remember that :)

Thanks again to you and to Sertonix for your hints! I really appreciate
both the work of
the Alpine Linux maintainers and of the mailing list contributors. We enjoy
working
with Alpine Linux on our two home office PCs very much, and it's great to
get some help
or hints on this mailing list.

Best regards

Rolf
Reply to thread Export thread (mbox)