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

Any ways to set zsh as default shell? #16

Closed
abcfy2 opened this issue Dec 4, 2016 · 15 comments
Closed

Any ways to set zsh as default shell? #16

abcfy2 opened this issue Dec 4, 2016 · 15 comments

Comments

@abcfy2
Copy link

abcfy2 commented Dec 4, 2016

I like to use zsh. On ubuntu I can use chsh -s /bin/zsh to set default shell to zsh, but how to set the default shell on wsltty?

@mintty
Copy link
Owner

mintty commented Dec 4, 2016

wsltty simply passes /bin/bash to wslbridge in the shortcuts, the wsl*.bat scripts, and the context menu.
@rprichard: I don't know whether wslbridge actually needs a shell specified.
Since I don't have testing capabilities myself right now, please try to remove /bin/bash from your invocation. If that works, we can do without it.

@abcfy2
Copy link
Author

abcfy2 commented Dec 4, 2016

Oh thanks. Change the shortcuts /bin/bash -> /bin/zsh works.

@mintty
Copy link
Owner

mintty commented Dec 4, 2016

Thanks, so that would be your workaround.
But actually my question was whether it also works if you simply leave out the /bin/bash or /bin/zsh parameter completely.

@abcfy2
Copy link
Author

abcfy2 commented Dec 4, 2016

No. Leave out /bin/bash or /bin/zsh will use /bin/bash as default. Maybe it doesn't get the default shell from /etc/passwd?

@mintty
Copy link
Owner

mintty commented Dec 4, 2016

Even if you change the default shell in WSL as indicated in your original comment?
How does your shell look like in /etc/passwd?

@abcfy2
Copy link
Author

abcfy2 commented Dec 4, 2016

Seems that WSL doesn's support set default shell. See: microsoft/WSL#846

And /etc/passwd:

root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/usr/sbin/nologin
man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
libuuid:x:100:101::/var/lib/libuuid:
syslog:x:101:104::/home/syslog:/bin/false
messagebus:x:102:106::/var/run/dbus:/bin/false
landscape:x:103:109::/var/lib/landscape:/bin/false
sshd:x:104:65534::/var/run/sshd:/usr/sbin/nologin
pollinate:x:105:1::/var/cache/pollinate:/bin/false
fengyu:x:1000:1000:"",,,:/home/fengyu:/usr/bin/zsh

@antonioyon
Copy link

I've gotten it to work by putting exec zsh in my .bashrc. It's a bit hacky but you can wrap a test for interactive login around it and it's just as good.

@mintty
Copy link
Owner

mintty commented Jan 31, 2017

Added section "Shell selection" to project page README.

@mintty mintty closed this as completed Jan 31, 2017
@mintty
Copy link
Owner

mintty commented Oct 10, 2017

Meanwhile it is possible to invoke WSL with the configured default shell, using the wsl.exe wrapper.

@mintty
Copy link
Owner

mintty commented Oct 23, 2017

Released 1.8.0 which does not set a preference to /bin/bash anymore.

@mintty mintty closed this as completed Oct 23, 2017
@ForsakenHarmony
Copy link

I'm still getting bash every time?

@mintty
Copy link
Owner

mintty commented Dec 1, 2017

Maybe you'd need to update your shortcuts. If you use the previous shortcuts, you'll get the previous behaviour.
Please try the "WSL Terminal" shortcut (it may be new, you can check the target in the properties first). Remove non-working WSLtty desktop shortcuts and copy fresh ones from the Start Menu or reinstall.

@ForsakenHarmony
Copy link

ForsakenHarmony commented Dec 1, 2017

I'm pretty sure my initial install was after that update

I'm using the WSL Terminal shortcut in the context menu

$ chsh
Changing the login shell for root
Enter the new value, or press ENTER for the default
        Login Shell [/usr/bin/fish]:

@mintty
Copy link
Owner

mintty commented Dec 1, 2017

Right, actually 1.8.0 removes explicit invocation of /bin/bash from the WSLtty shortcuts, but support from wslbridge is still needed to make it work, see rprichard/wslbridge#17.

@mintty mintty reopened this Dec 1, 2017
@mintty
Copy link
Owner

mintty commented Jan 24, 2018

Closing for the more generic #86.

@mintty mintty closed this as completed Jan 24, 2018
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

4 participants