ValveSoftware / steam-for-linux

Issue tracking for the Steam for Linux beta client
4.13k stars 174 forks source link

Steam prints "flock (FILE) LOCK_SH failed. errno = 38" errors for each the game that was moved to the external disk #10829

Open lufia opened 3 weeks ago

lufia commented 3 weeks ago

Your system information

steamwebhelper.sh[127]: Starting steamwebhelper under bootstrap sniper steam runtime at /home/lufia/.var/appcom.valvesoftware.Steam/.local/share/Steam/ubuntu12_64/steam-runtime-sniper
flock /run/user/60331/doc/f9ec6bc3/Steam/libraryfolder.vdf LOCK_SH failed. errno = 38
CAppInfoCacheReadFromDiskThread took 40 milliseconds to initialize
Steam Runtime Launch Service: starting steam-runtime-launcher-service
Steam Runtime Launch Service: steam-runtime-launcher-service is running pid 224
bus_name=com.steampowered.PressureVessel.LaunchAlongsideSteam
flock /run/user/60331/doc/f9ec6bc3/Steam/libraryfolder.vdf LOCK_SH failed. errno = 38
flock /run/user/60331/doc/f9ec6bc3/Steam/steamapps/appmanifest_xxx.acf LOCK_SH failed. errno = 38
flock /run/user/60331/doc/f9ec6bc3/Steam/libraryfolder.vdf LOCK_SH failed. errno = 38
BRefreshApplicationsInLibrary 1: 0ms

(Steam client is launched here, but all game stored on my external disk are not detected.)

Please describe your issue in as much detail as possible:

My host have an external USB SSD that usually mounted on /run/media/lufia/games.

A few days ago, because my laptop's storage is almost full, I moved large games by Steam > Settings > Storage tool.

After Steam client was restarted I noticed that Steam does not recognize the games I moved to external USB SSD; they are not installed. Also Steam client can't install new game I bought to the external USB SSD. Both these two cases above Steam client prints the same errors "flock (FILE) LOCK_SH failed. errno = 38"

(FILE) is such as:

Flatpak's permissions

$ flatpak permissions
Table      Object              App                     Permissions                  Data
gnome      shortcuts-inhibitor qemu.desktop            DENIED                       []
background background          com.valvesoftware.Steam yes                          0x00
documents  f9ec6bc3            com.valvesoftware.Steam read,write,grant-permissions (b'/run/media/lufia/games/Steam', 76, 257, 4)

I have tried

I have tried to get shared lock on the host directly, it worked:

$ cd /run/media/lufia/games/Steam
$ flock -s libraryfolder.vdf ls
libraryfolder.vdf  steamapps

I also tried to get shared lock within flatpak, it failed:

$ flatpak run --command=bash com.valvesoftware.Steam
$ cd /run/user/60331/doc/f9ec6bc3/Steam
$ flock -s libraryfolder.vdf ls
flock: libraryfolder.vdf: Function not implemented

Steps for reproducing this issue:

  1. Install com.valvesoftware.Steam
  2. Attach an external storage to the Linux box
  3. Move one or more games with Steam client
  4. Restart Steam client
kisak-valve commented 3 weeks ago

Hello @lufia, your symptoms resemble the discussion on #9776. Please give that issue report a read and see if it's relevant to you.

lufia commented 3 weeks ago

Hi @kisak-valve

I had read that issue you mentioned, I think that issue is very similar to this. However, I couldn't understand what I should do to fix this because that's author commented:

I'm not sure what did it to be exact...

I checked mounts

$ grep /run/user /proc/$(pidof -s steam)/mounts
tmpfs /run/user/60331 tmpfs rw,nosuid,nodev,relatime,size=3255252k,nr_inodes=813813,mode=700,uid=60331,gid=60331,inode64 0 0

$ grep /doc /proc/$(pidof -s steam)/mounts
portal /run/flatpak/doc fuse.portal rw,nosuid,nodev,relatime,user_id=60331,group_id=60331 0 0
lufia commented 3 weeks ago

Today I noticed that /run/user/60331/doc is symbolic link refers to /run/flatpak/doc.

Therefore, I now suspect XDG Desktop Portal wouldn't implement flock operation yet if the error message is correct.

Current versions in my Arch Linux box:

lufia commented 2 weeks ago

@kisak-valve

I'm not sure whether it will be merged or not, I created a PR to xdg-desktop-portal repository to merge a patch that is to fix this issue. https://github.com/flatpak/xdg-desktop-portal/pull/1353

But, the patch would add only non-blocking operations of flock(2) because blocking ops could block entire xdg-document-portal filesystem.

I have a question: Steam client might involve flock(2) with blocking operation?

For now, Steam works well with an external drive.