Open greemo opened 3 years ago
Hi! A some things to try:
ego --user=user_2 bash
and then run teams
from there?ego --sudo
mode work?sudo journalctl -f
in the background and then try ego
again, see if there are any log messages that might indicate a problem.Thanks Marti,
Running ego --user=user_2 bash
and then running teams from there worked perfectly.
Now I can log into multiple teams accounts simultaneously on Linux, thanks!
Great! I'm still curious though, why your original command doesn't work. It's probably something that can be improved in ego
.
PS: This is the first user feedback I've received. It's good to hear that somebody finds this useful. :)
FYI:
ego --sudo --user=user_2 teams
works, but I get the following output on the console:
X Error of failed request: BadName (named color or font does not exist) Major opcode of failed request: 140 (RANDR) Minor opcode of failed request: 16 (RRCreateMode) Serial number of failed request: 34 Current serial number in output stream: 34
Running journalctl before ego --user=user_2 teams
:
Mar 08 11:51:46 laptop polkitd(authority=local)[946]: Registered Authentication Agent for unix-process:200399:73989715 (system bus name :1.791 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_AU.UTF-8) Mar 08 11:51:50 laptop polkitd(authority=local)[946]: Operator of unix-session:c2 successfully authenticated as unix-user:user_1 to gain TEMPORARY authorization for action org.freedesktop.machine1.host-shell for system-bus-name::1.792 [machinectl shell --uid=user_2 -EDISPLAY=:0 -EPULSE_SERVER=unix:/run/user/1000/pulse/native -EPULSE_COOKIE=/run/user/1000/ego/pulse-cookie -- .host /bin/sh -c dbus-update-activation-environment --systemd DISPLAY PULSE_SERVER PULSE_COOKIE; systemctl --user start xdg-desktop-portal-gtk; exec teams] (owned by unix-user:user_1) Mar 08 11:51:50 laptop systemd[1]: Started Shell for User user_2. Mar 08 11:51:50 laptop systemd[200414]: pam_unix(login:session): session opened for user user_2 by (uid=0) Mar 08 11:51:50 laptop systemd-logind[956]: New session 128 of user user_2. Mar 08 11:51:50 laptop systemd[1]: Started Session 128 of user user_2. Mar 08 11:51:50 laptop systemd[1]: container-shell@3.service: Succeeded. Mar 08 11:51:50 laptop systemd[1]: session-128.scope: Succeeded. Mar 08 11:51:50 laptop systemd-logind[956]: Session 128 logged out. Waiting for processes to exit. Mar 08 11:51:50 laptop systemd-logind[956]: Removed session 128. Mar 08 11:51:50 laptop polkitd(authority=local)[946]: Unregistered Authentication Agent for unix-process:200399:73989715 (system bus name :1.791, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_AU.UTF-8) (disconnected from bus)
Cheers
OK I tried it and I see the issue now. The teams
command forks a background process and exits immediately. Since the command exits, the session quits and systemd tears down background processes with it.
This demonstrates the issue by keeping the session around for 5 more seconds. Teams has a chance to start up and then exits.
ego sh -c 'teams && sleep 5'
Hopefully there is a nice way to handle this situation that doesn't add much complexity, I'll have to do some research.
Jotting down notes about this issue...
teams
escapes the process hierarchy by double-forking, becoming an orphan process.
teams
processes still belong to the current session by process sesssion ID (e.g. ps o pid,ppid,pgid,sid,comm
), so it's possible to track them that way. (https://unix.stackexchange.com/a/18178)wait
on these processes because they aren't subprocesses of the shell ("bash: wait: pid 295517 is not a child of this shell")systemd-cgls -u user-$UID.slice
)
│ └─user-979.slice
│ ├─session-382.scope
│ │ ├─298304 /usr/share/teams/teams --disable-namespace-sandbox --disable-setuid-sandbox
systemctl show session-$XDG_SESSION_ID.scope
systemctl set-property session-406.scope KillMode=none
) and it's a bad idea anyway ("allows processes to escape the service manager's lifecycle and resource management").loginctl enable-linger ego
can be used to keep systemd around before and after the scope. But teams
(and I guess everything in the session scope) still gets killed when I close the shell. :(loginctl show-session -a $XDG_SESSION_ID
loginctl session-status $XDG_SESSION_ID
).
teams
as the main session process, I can run something that keeps track and waits for children? Although this is more complexity than I was hoping :(Stumbled upon ego while trying to run Teams on a different user session. Had the exact same issue, where running ego teams
would instantly exit without any discernible effect. I'm using Elementary OS 5.1.7 Hera (Ubuntu 18.04).
The bash -> teams workflow does work for me as well.
EDIT: if I can provide logs or any sort of debug data to help feel free to ask, I'd be happy to!
I installed ego, and I get the following output but the program is not run...
(base) user_1@laptop:~$ ego -v -v -v -v -v --user=user_2 teams
[ego::logging] Log level TRACE [users::base] Running getpwnam_r for user "user_2" [users::base] Loading user with uid 1001 Setting up Alter Ego for user user_2 (1001) Runtime data dir '/run/user/1000' configured Wayland: WAYLAND_DISPLAY not set, skipping X11 configured to allow +si:localuser:user_2 Publishing PulseAudio cookie /home/user_1/.config/pulse/cookie to /run/user/1000/ego/pulse-cookie PulseAudio dir '/run/user/1000/pulse' configured Running command: machinectl shell '--uid=user_2' '-EDISPLAY=:0' '-EPULSE_SERVER=unix:/run/user/1000/pulse/native' '-EPULSE_COOKIE=/run/user/1000/ego/pulse-cookie' -- .host /bin/sh -c 'dbus-update-activation-environment --systemd DISPLAY PULSE_SERVER PULSE_COOKIE; systemctl --user start xdg-desktop-portal-gtk; exec teams' Connected to the local host. Press ^] three times within 1s to exit session. Connection to the local host terminated.Any thoughts??