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

User session immediately ends due to shell wrapper #470

Open
bekriebel opened this issue May 7, 2024 · 1 comment
Open

User session immediately ends due to shell wrapper #470

bekriebel opened this issue May 7, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bekriebel
Copy link

Bug description

#452 Appears to be causing interactive shell users to appear logged out to the system as soon as they sign in. This can be seen in the system logs, as well as checking the results of last and seeing that all user sign-ins last zero seconds. Because of this, user systemd services are also exiting, causing systemctl --user to throw the error Failed to connect to bus: Connection refused.

Reverting commit 03b52c7 makes the login work as expected.

I'm testing this with bash, but it may happen with other shells as well.

To Reproduce

Steps to reproduce the behavior:

  1. Install a fresh system using the instructions here: https://nix-community.github.io/NixOS-WSL/install.html, but do not perform an update.
  2. Check journalctl and note that the user is signed properly.
  3. Run sudo nix-channel --update and sudo nixos-rebuild switch
  4. Terminate the wsl instance.
  5. Start the wsl instance
  6. Check journalctl and note that the user is immediately signed out, even though the shell is still active.

To fix the issue, do a nixos build with commit 03b52c7 reverted and note that the user once again stays signed in properly.

Logs

The user getting logged out:

May 06 19:44:02 nixos systemd[286]: Starting D-Bus User Message Bus Socket...
May 06 19:44:02 nixos systemd[286]: Listening on D-Bus User Message Bus Socket.
May 06 19:44:02 nixos systemd[286]: Reached target Sockets.
May 06 19:44:02 nixos systemd[286]: Reached target Basic System.
May 06 19:44:02 nixos systemd[1]: Started User Manager for UID 1000.
May 06 19:44:02 nixos systemd[286]: Starting Run user-specific NixOS activation...
May 06 19:44:02 nixos systemd[1]: Started Session 104 of User <redacted>.
May 06 19:44:02 nixos login[280]: pam_unix(login:session): session closed for user <redacted>
May 06 19:44:02 nixos systemd[286]: Finished Run user-specific NixOS activation.
May 06 19:44:02 nixos systemd[286]: Reached target Main User Target.
May 06 19:44:02 nixos systemd[286]: Startup finished in 136ms.
May 06 19:44:02 nixos systemd-logind[271]: Session 104 logged out. Waiting for processes to exit.
May 06 19:44:02 nixos systemd[1]: session-104.scope: Deactivated successfully.
May 06 19:44:02 nixos systemd-logind[271]: Removed session 104.
May 06 19:44:12 nixos systemd[1]: Stopping User Manager for UID 1000...
May 06 19:44:12 nixos systemd[286]: Activating special unit Exit the Session...
May 06 19:44:12 nixos systemd[286]: Stopped target Main User Target.
May 06 19:44:12 nixos systemd[286]: Stopped target Basic System.
May 06 19:44:12 nixos systemd[286]: Stopped target Paths.
May 06 19:44:12 nixos systemd[286]: Stopped vscode-remote-workaround.path.
May 06 19:44:12 nixos systemd[286]: Stopped target Sockets.
May 06 19:44:12 nixos systemd[286]: Stopped target Timers.
May 06 19:44:12 nixos systemd[286]: Closed D-Bus User Message Bus Socket.
May 06 19:44:12 nixos systemd[286]: Removed slice User Application Slice.
May 06 19:44:12 nixos systemd[286]: Reached target Shutdown.
May 06 19:44:12 nixos systemd[286]: Finished Exit the Session.
May 06 19:44:12 nixos systemd[286]: Reached target Exit the Session.
May 06 19:44:12 nixos (sd-pam)[288]: pam_unix(systemd-user:session): session closed for user <redacted>
May 06 19:44:12 nixos systemd[1]: [email protected]: Failed to kill control group /user.slice/user-1000.slice/[email protected], ignoring: Input/output error
May 06 19:44:12 nixos systemd[1]: [email protected]: Deactivated successfully.
May 06 19:44:12 nixos systemd[1]: Stopped User Manager for UID 1000.
May 06 19:44:12 nixos systemd[1]: [email protected]: Consumed 126ms CPU time, read 4.6M from disk, written 0B to disk, no IP traffic.

A normal login after reverting 03b52c7:

May 06 19:35:57 nixos systemd[281]: Starting D-Bus User Message Bus Socket...
May 06 19:35:57 nixos systemd[281]: Listening on D-Bus User Message Bus Socket.
May 06 19:35:57 nixos systemd[281]: Reached target Sockets.
May 06 19:35:57 nixos systemd[281]: Reached target Basic System.
May 06 19:35:57 nixos systemd[1]: Started User Manager for UID 1000.
May 06 19:35:57 nixos systemd[281]: Starting Run user-specific NixOS activation...
May 06 19:35:57 nixos systemd[1]: Started Session 102 of User <redacted>.
May 06 19:35:57 nixos systemd[281]: Finished Run user-specific NixOS activation.
May 06 19:35:57 nixos systemd[281]: Reached target Main User Target.
May 06 19:35:57 nixos systemd[281]: Startup finished in 161ms.

WSL version

WSL version: 2.1.5.0
Kernel version: 5.15.146.1-2
WSLg version: 1.0.60
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3527```
@bekriebel bekriebel added the bug Something isn't working label May 7, 2024
573 added a commit to 573/nix-config-1 that referenced this issue May 7, 2024
@SuperSandro2000
Copy link
Member

see #464 (comment) and the recent discussion in matrix

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

2 participants