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

Activating native systemd support breaks shell #486

Closed
aikooo7 opened this issue Jun 7, 2024 · 8 comments
Closed

Activating native systemd support breaks shell #486

aikooo7 opened this issue Jun 7, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@aikooo7
Copy link

aikooo7 commented Jun 7, 2024

Bug description

When enabling native systemd support and rebuild, switch and restart system you will be unable to log in to your system unless you use the recovery shell or use the shell binary directly instead of the wrapper.

Note: While trying to find what was the cause of the issue I rebuilt my home-manager and got Failed to connect to bus: No such file or directory so maybe #375 is related.

To Reproduce

Steps to reproduce the behavior:
Add wsl.nativeSystemd = true;
Run sudo nixos-rebuild switch
Run wsl --shutdown in cmd.
Run wsl -d NixOS in cmd. NixOS should be your nixos distro's name in wsl.

Logs

thread 'main' panicked at src/shell_wrapper.rs:105:10:
called `Result::unwrap()` on an `Err` value: When initializing journal logger

Caused by:
    No such file or directory (os error 2)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

WSL version

2.0.9.0

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.4170
@aikooo7 aikooo7 added the bug Something isn't working label Jun 7, 2024
@nzbr
Copy link
Member

nzbr commented Jun 15, 2024

It looks like systemd hasn't started properly. That should obviously not crash the shell though, I'll fix that

@nzbr
Copy link
Member

nzbr commented Jun 15, 2024

As for the underlying problem: Can you send me the output of dmesg executed in another distro right after this happens. To reduce the size of the output, it probably makes sense to shut down WSL with wsl --shutdown before that

@polybluez
Copy link

Is this the same error?

C:\Users\Admin>wsl
when trying to exec the wrapped shell

Caused by:
    No such file or directory (os error 2)

@polybluez
Copy link

There is a workaround: first fire up WSL with a recovery shell wsl -d NixOS --system --user root -- /mnt/wslg/distro/bin/nixos-wsl-recovery and then enter WSL as usual

@nzbr
Copy link
Member

nzbr commented Aug 18, 2024

@polybluez no, that is a diffferent error. I suspect that the one @aikooo7 experienced was a race condition, because the shell wrapper tried to connect to journald before that was started. That one should be fixed now, because it does not result in a crash anymore. Your error looks like the wrapper tries to start your shell, but the shell's binary just does not exist for some reason. The same probably would have happened without the wrapper

@leonbreedt
Copy link

leonbreedt commented Sep 12, 2024

This occurs for me as well, I basically have to revert to wsl.nativeSystemd = false; , or I cannot use NixOS-WSL at all.

Data point: My NixOS-WSL is built using a flake, using a user created by the flake (and not the nixos user). As soon as I have run the flake built, it is broken. Tried with a completely fresh install of the latest build (which has #496 merged), followed by my flake build.

After the flake build, I cannot start up the distribution due to this error.

@nzbr
Copy link
Member

nzbr commented Oct 13, 2024

@leonbreedt The latest tarball ships with native systemd enabled, so if that is working for you it being enabled isn't the actual problem. I suspect there's something in your config that interferes with it. Please open a new issue if you still have that problem.

@aikooo7 Because the race-condition should be fixed and I didn't hear from you after that, I'm going to close this for now. Feel free to re-open if the issue is still present

@nzbr nzbr closed this as completed Oct 13, 2024
@leonbreedt
Copy link

@nzbr: after i updated to latest nixpkgs, the issue no longer happens. thanks for the ping!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants