protonscr

Leftover semaphores from other user can block steamvr

steamvrclosed
ValveSoftware/SteamVR-for-Linux#193 · opened 2019-04-16 by ChristophHaag · updated 2024-06-30 · 3 comments · github
CChristophHaag 2019-04-16 github

Sometimes SteamVR doesn't properly clean up (maybe when it crashes) and leaves files in /dev/shm or semaphores around. That's often not a problem because on startup it cleans up, except when you switch linux users and start SteamVR as another user, those resources can't be cleaned up.

The shared memory files can be easily cleaned up:

sudo rm /dev/shm/*Valve*

For the semaphores it's a bit more work. You have to start vrcompositor

LD_LIBRARY_PATH=~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64 strace ~/.local/share/Steam/steamapps/common/SteamVR/bin/linux64/vrcompositor

and look for a line like this

semctl(1769473, 0, IPC_RMID, NULL)      = -1 EPERM (Die Operation ist nicht erlaubt)

then you can remove the semaphore with sudo ipcrm -s 1769473

An okay solution would be for SteamVR to ask for the user's password who owns the resources and clean up as that user.

A better solution would be for every user account to have its own set of resources, so the conflict is not there in the first place.

Llostgoat 2019-08-09 github

SteamVR semaphores are now namespaced into separate sessions in order to fix this issue.

CChristophHaag 2019-08-26 github

I sometimes still have this issue with SteamVR 1.7.9
System Report: SteamVR-2019-08-27-AM_01_43_41.txt
strace of vrcompositor: vrcompositor_semaphores.txt

Though today I know I had started SteamVR stable on the other account which probably does not have the fix. Do both SteamVR versions need it?

CChristophHaag 2024-06-30 github

Still an issue btw. Ran SteamVR on one user, quit, switched users, started SteamVR "A key comonent is not working etc."

This terrible one liners cleans it up thanks to all the semaphores from SteamVR having 666 permissions

ipcs -s | grep 666 | while read LINE; do [[ -d $(ipcs -s -i $(echo $LINE | awk '{print $2}') | tail -n +9 | head -n +1 | while read PIDLINE; do ls -l /proc/$(echo $PIDLINE | awk '{print $5}')/self; done;) ]] || sudo ipcrm -s $(echo $LINE | awk '{print $2}'); done

Nothing extracted yet.