-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
Shell prompt regression after latest 19.0.0 update #788
Comments
Confirmed seeing the same thing |
Confirming, ssh not working after update. Seeing the same output. |
I have the same issue: Edit: |
I believe it was broken by PR #755 which changed the default shell from /bin/sh to /bin/zsh for the added users. However, the script creates only .profile, while, I'm pretty sure that zsh will not run .profile by default for a login shell, and thus requires .zprofile to exist. A temporary hack is to add the following to "init_commands" configuration option and restart:
Note that if you use a username other than "hassio" you should replace that in the path above. |
I have the same issue: I'll be waiting for version 19.0.1 fix. Until then rolling back to version 18.0.0, which is working as expected. Thanks all |
@frenck I believe that PR #755 should be backed out, I can find no logical reason for the change and not sure why it was accepted. As far as I can tell previous behavior was:
Now, behavior is:
Fix options: Back out PR #755, which is not required as /bin/sh is fine for login user since it will be immediately replaced by switch to the configured root shell. --or-- If for some reason it is desired to have login user leverage /bin/zsh (I have no idea why) then I believe ssh/rootfs/etc/s6-overlay/s6-rc.d/init-ssh/run line 110 should be modified to create .zprofile instead of .profile. I'm happy to provide a PR for either of this if needed, just not sure which is preferred. |
Maybe there is a good reason not to immediately sudo to root? Docker is not accessible but /config directory is readable. In this case the prompt needs to be fixed and new behavior documented. I can confirm that running I can understand the #755 reason as root shell is already |
But that's not true, rather, root shell is either /bin/zsh or /bin/bash based on whether config contains "zsh: true" or not, and since the only purpose of the ssh user being added is so that you can login with a username other than "root", it's not clear why it matters what shell this user leverages, since it will always just immediately be replaced by the configured root shell. IMO, using the Busybox /bin/sh makes 100% sense in this case because it's super fast to load and execute the profile and is then replaced a few milliseconds later. Regardless, it's not my decision and I don't really care one way or another what the fix is, but that PR is what caused it to break. If that PR would have included an additional line that change .profile to .zprofile, it would be fine. |
Yes, root shell could be zsh too (when configured so), however root user has Of course it would be good to use the same shell configuration option for both accounts. It is anyway the same person who uses them. |
My solution to get things back like they were before where my SSH session as hassio had correct Create
Also, since some file perms might exclude the group
Ref: Add a User to a Group (or Second Group) on Linux |
It does indeed seem that #755 introduced a bug. It looks like default shell is being created as zsh, however, just below, there is attempt to run |
is that the reason why i cant do for example chmod? this worked before |
Yes. This is because you are no longer root. |
I've opened a PR to revert the change. The login user shell doesn't matter since the user is supposed to be immediately dropped to the root shell anyway. I'm not sure why it was thought to be a fix for #744. |
indeed, its as easy as turning off "zsh" to have the old prompt back |
It's simple, but I'm probably not the first person to test the simple solution. Especially since the information that "bash" is used again after deactivation is even in the terminal documentation. |
If you don't use any of the zsh features, such as much improved tab completion and command history, just as an example, then sure, not really any negatives, you can use whatever shell you want. I still think adding a single line to the configuration, as I suggested above, is the easiest workaround to get back to original behavior with a working zsh (I much prefer zsh interactive behavior to bash) but there are plenty of options. |
Without the patch being reverted, disabling zsh replaces zsh with bash for both the root and new user, thereby resolving the issue. Yes. However, if you do use zsh, then this issue remains. Additionally, the issue is not so much the prompt, but that you are not running as the root user, which is what this addon assumes to be true. As such, reverting the PR should be done as a quick fix or adding a zprofile and testing that. I'm working around this by adding Incidentally, I actually use |
turning off zsh in the config still doesnt allow me permissions to edit files in vscode. unless im missing something. can this be reverted to previous functionality please? |
Any news of a 19.0.1 release to fix things? |
There's a patch. Just needs a review. Frenck maintains a lot of repos, so it may take some time for him to turn his attention here. In my oppinion, the simplest fix is what @tsightler posted above:
|
@Cougar I suggest renaming this issue now that it is better understood to be more than just a prompt issue. Maybe something like:
I also think @tsightler solution seems like a good one if not the best. Rather than revert #755, there just needs to be an equivalant profile that Zsh or other shells would run. The docs/readme should probably be updated to mention that whenf you change shells you need to make sure that sudo to root happens. |
I agree with @tsightler - this change should not have been approved. Just because a contributor has a preference for something fancy (that no one else has even heard about), even for all the good reasons, it cannot be allowed to be forced upon everyone else. Even if a workaround exists, most of us "common mortals" will end up spending days in vane trying to figure out what's gone wrong. |
Thanks to this issue I finally understand why I've seen strange behavior with ssh commands and rsync using this add-on. The add-on's intended behavior seems to be that you ssh in as Problems arise if you change shells or use ssh to run a non-interactive like Another example that fails in a surprising way:
Once you know, you can work around that with sudo:
(That's useful if you don't want to maintain unprotected ssh credentials inside of hass) So, rather than revert #755 as a solution, maybe there should be a less brittle way of becoming the root user that will work with all shells and non-interactive sessions? |
I agree that the mode of user switching (or why even use root?) should be addressed in longer term, however it seems prudent to revert and fix the regression. |
Currently with HaOS everything in config (and elsewhere) is owned by root. Here's the view from the host os (not the container)
|
I concur! In 30+ years using UNIX (10+ years Linux) I never had a need or desire to use zsh. I always used the defacto standard sh or ksh. Don't force me to use something newer! If I want to continue using my rotary dial telephone then let me! |
The thing is, merits of default shell aside, changing the shell of the authentication user should not even be required as the first thing that happens when you auth with that user is that you su back to root. So there is no reason that shouldn't just be |
Interesting. Yea, I figured it probably had to do with permissions in the config dir. It probably goes beyond the scope of this addon, but if group had rw, then the ssh user could be added to the group and be permitted access. I suppose this is getting off topic though... |
True, particularly since the Regardless the main concern is something Frenck (or anyone else with merge/release permissions) will accept. |
I like zsh and have no problem with it,... when is working. So far the default setup is broken and the only workaround I found was to add a custom init command to the config, one that has the full path to my user home directory included:
Note that use of |
same issue using the solution posted by @tsightler for the time being.
|
The problem with the symlink hack is that it will not survive a full shutdown. ( This will have to be fundamentally addressed by the developer. I personally love zsh and would like to see it remain as a shell choice, but unfortunately any home directory changes are wiped on a shutdown (as it's a container).
@ssbarnea where, specifically, did you do this? Perhaps this will solve the shutdown wipe. |
Problem/Motivation
Shell prompt is broken
Expected behavior
Prompt like this:
config #
Actual behavior
Prompt now
\[\e]0;\u@\h:\w\a\]\W $
Steps to reproduce
ssh to the home assistant
Proposed changes
No idea how zsh prompt works :(
The text was updated successfully, but these errors were encountered: