Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zsh not starting when connecting from WSL or another Linux machine #744

Open
VlastiBroucek opened this issue May 28, 2024 · 12 comments
Open

Comments

@VlastiBroucek
Copy link

VlastiBroucek commented May 28, 2024

Problem/Motivation

After updating to 18.0.0, zsh starts correctly in web terminal, but when connecting from WSL or another Linux machine terminal, zsh does not start and sh starts automatically.

Expected behavior

In previous version both started with zsh

Steps to reproduce

Should be simple to reproduce. Noticed it first on production machine, replicated it in VMware environment. Installed initially with 17.3.0, was working. As soon as I updated to 18.0.0 stopped working.

Just to be sure, I've restored to 17.3.0 from backup and all works again as expected.

Proposed changes

Ideally fix.

@mjs271
Copy link

mjs271 commented May 31, 2024

I'm seeing the same behavior on my system when connecting via ssh, for both Linux and macOS. Once I've logged in, I can drop into a bash/zsh shell by running the command, but can't change the default shell since which chsh comes up empty handed.

@rskallies
Copy link
Contributor

Can be fixed by running ln -s ~/.bash_profile ~/.profile when logged in

@VlastiBroucek
Copy link
Author

Can be fixed by running ln -s ~/.bash_profile ~/.profile when logged in

That did not work for me...

@rskallies
Copy link
Contributor

Yes for me it also did not work as expected. I then just changed the root user shell /etc/passwd from /bin/sh to /bin/zsh and now it works until the add-on is restarted.
root:x:0:0:root:/root:/bin/sh vs. root:x:0:0:root:/root:/bin/zsh

@VlastiBroucek
Copy link
Author

Yes for me it also did not work as expected. I then just changed the root user shell /etc/passwd from /bin/sh to /bin/zsh and now it works until the add-on is restarted. root:x:0:0:root:/root:/bin/sh vs. root:x:0:0:root:/root:/bin/zsh

Which means the add-on is broken and sadly, the maintainer keeps quiet...

@rskallies
Copy link
Contributor

rskallies commented Jun 5, 2024

Indeed. The commit 629ed20 updated the base image to Alpine 3.20.0. In this Alpine base image there is no /bin/ash in the password file entry for the root user anymore. It has now the more common /bin/sh value. The add-on tries to change it from /bin/ash to /bin/zsh which does not work anymore. The issue is located in the Dockerfile at line 87 "&& sed -i -e "s#bin/ash#bin/zsh#" /etc/passwd" .

Dockerfile.patch

@MilesTEG1
Copy link

Can be fixed by running ln -s ~/.bash_profile ~/.profile when logged in
It worked for me.
Until the add-on is restarted...

Indeed. The commit 629ed20 updated the base image to Alpine 3.20.0. In this Alpine base image there is no /bin/ash in the password file entry for the root user anymore. It has now the more common /bin/sh value. The add-on tries to change it from /bin/ash to /bin/zsh which does not work anymore. The issue is located in the Dockerfile at line 87 "&& sed -i -e "s#bin/ash#bin/zsh#" /etc/passwd" .

Dockerfile.patch

How can I use this fix?
I'm running HAOS and the addon inside HA.

@jcwillox
Copy link

I found that adding shadow to the packages option, (which adds the chsh command to change default shell), and adding chsh -s /bin/zsh to init commands successfully changes the default shell. I don't know why this is needed now but at least it fixes the issue for the time being.

packages:
  - shadow
init_commands:
  - chsh -s /bin/zsh

@MilesTEG1
Copy link

Nice fix @jcwillox
It seems to be working fine.

I just realized that all my .zshrc personnalisation was gone after rebooting the addon... my nice prompt...
Where can I store my file in order to get it back after a reboot?

@jcwillox
Copy link

I'm not sure if there's an official way, but my suggestion would be to put it in one of the mounted folders e.g. /config or /share and add a symlink to it ln -s /share/.zshrc ~/.zshrc you might also need -f to override the existing file, (or just rename it beforehand). Alternatively you can use a dotfiles manager to setup and sync your configs between devices.

Copy link

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Jul 11, 2024
@Bert-R
Copy link

Bert-R commented Jul 11, 2024

This issue is still active. There's a workaround (#744 (comment)), but it is not resolved.

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants