nullpo-head / wsl-distrod

Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
MIT License
1.9k stars 91 forks source link

[Bug]: Distrod replaced my ZSH shell with its own Bash #23

Open nicenemo opened 2 years ago

nicenemo commented 2 years ago

Describe the bug

Distrod replaced its own Bash

The following shell is there now

kruse:x:1000:1000:create with care by Ansible:/home/kruse:/opt/distrod/alias/bin/bash

It used to be:

kruse:x:1000:1000:create with care by Ansible:/home/kruse:/usr/bin/zsh

Why was this change needed? Can I change it back without losing systemd? Is there a zsh alternative? Can this behavour at least be documented?

I would rather not do an exec zsh in my bashrc.

Steps to reproduce

  1. Install Distrod in an existing Debian destribution.
  2. Enable it.

Expected behavior

I have:

Windows version

11 21h2

Linux kernel version

Linux xios 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 GNU/Linux

Distro

Debian 11

How did you install that distro?

Enabled distrod in an existing WSL2 distro

Logs

I think this is default programmed behaviour by distrod. No reason to include any non related logs.

additional comment

My distro was created from the default store version with [WSL debian boxes Powershell scripts]( (https://github.com/nicenemo/wsl-debian-boxes). Except changing the Debian mirror and updating the image it does nothing special. It allows me to create multiple Debian instances side by side.

nullpo-head commented 2 years ago

Hi Hans, thanks for trying Distrod.

Firstly, indeed Distrod will replace the default shell to its alias by design, but it should not replace zsh with bash, or it should not change any shell to an alias to different shell. Was the default shell really zsh when you installed Distrod?

Can I change it back without losing systemd?

No, that alias is necessary for Distrod to hook each WSL session. It's loosely documented in "How Distrod works" section in the README. I will improve the docs to make it more detailed. By the way, there is another possible approach to hook sessions, such as bind-mounting the default shell. The current shell hook approach is adopted because it is simpler and it I think is easier for users to understand how Distrod works.

Is there a zsh alternative?

Yes, of course. You can just run chsh and change your default shell to zsh or any your favorite shell. chsh will ask you to run sudo /opt/distrod/bin/distrod enable after that. See #7 for the detail. Actually, these replaced shells work as just aliases to the actual shells. They're not some custom implementations.

However,