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

fix(shell-wrapper): login shell and user systemd #464

Merged
merged 6 commits into from May 9, 2024
Merged

Conversation

nzbr
Copy link
Member

@nzbr nzbr commented May 5, 2024

Starts the wrapped shell as a login shell if the shell wrapper is started as a login shell (arg0 is prefixed with -)

@nzbr nzbr requested a review from K900 May 5, 2024 08:31
@nzbr nzbr added bug Something isn't working release-exclude Excluded from release changelog labels May 5, 2024
@SuperSandro2000
Copy link
Member

Not working for me :/

May 06 16:55:15 francium systemd[1]: Stopping User Manager for UID 1000...
May 06 16:55:15 francium systemd[409]: Activating special unit Exit the Session...
May 06 16:55:15 francium ssh-agent[468]: exiting on signal 15
May 06 16:55:15 francium systemd[409]: Stopped target Main User Target.
May 06 16:55:15 francium systemd[409]: Stopping SSH Agent...
May 06 16:55:15 francium systemd[409]: Stopped SSH Agent.
May 06 16:55:15 francium systemd[409]: Stopped target Basic System.
May 06 16:55:15 francium systemd[409]: Stopped target Paths.
May 06 16:55:15 francium systemd[409]: Stopped target Sockets.
May 06 16:55:15 francium systemd[409]: Stopped target Timers.
May 06 16:55:15 francium systemd[409]: Closed D-Bus User Message Bus Socket.
May 06 16:55:15 francium systemd[409]: Closed GnuPG cryptographic agent and passphrase cache.
May 06 16:55:15 francium systemd[409]: Closed Socket for Lorri Daemon.
May 06 16:55:15 francium systemd[409]: Closed Podman API Socket.
May 06 16:55:15 francium systemd[409]: Removed slice User Application Slice.
May 06 16:55:15 francium systemd[409]: Reached target Shutdown.
May 06 16:55:15 francium systemd[409]: Finished Exit the Session.
May 06 16:55:15 francium systemd[409]: Reached target Exit the Session.
May 06 16:55:15 francium (sd-pam)[414]: pam_unix(systemd-user:session): session closed for user sandro
May 06 16:55:15 francium systemd[1]: user@1000.service: Deactivated successfully.
May 06 16:55:15 francium systemd[1]: Stopped User Manager for UID 1000.

@nzbr
Copy link
Member Author

nzbr commented May 6, 2024

It does not fix systemd user sessions. Only that the shell is started as a login shell.
Can you see if systemd user sessions work with another distro on your system? Because they do not for me (tested Ubuntu and Debian so far)

@SuperSandro2000
Copy link
Member

SuperSandro2000 commented May 7, 2024

Can you see if systemd user sessions work with another distro on your system?

They work when I go back to 0b90c1d. I don't think I enabled lingering or anything else.

They also work since then but only for a few minutes and then they get closed.

@nzbr nzbr changed the title fix(shell-wrapper): propagate login shell status fix(shell-wrapper): login shell and user systemd May 8, 2024
@nzbr
Copy link
Member Author

nzbr commented May 8, 2024

WSL starts a single shell under login to create the logind session. That shell runs in the background and is not the one that gets connected to the terminal. The process has SIGCHLD set to be ignored, which makes the shell wrapper crash when it tries to wait for the sh it forks of to source /etc/set-environment.
I have changed it so that it now checks if SIGCHLD is ignored and if yes it skips setting the environment.
tl;dr: it should work now

utils/src/shell_wrapper.rs Outdated Show resolved Hide resolved
@nzbr nzbr requested a review from K900 May 8, 2024 14:52
@K900 K900 merged commit 61fe33f into main May 9, 2024
25 checks passed
@nzbr nzbr deleted the login-shell-fix branch May 9, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working release-exclude Excluded from release changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants