steam-for-linux icon indicating copy to clipboard operation
steam-for-linux copied to clipboard

The Steam client is forgetting secondary Steam Library folders on abnormal shutdown

Open ezdev128 opened this issue 2 years ago • 7 comments

Your system information

  • Steam client version (build number or date): 1647446817
  • Distribution (e.g. Ubuntu): Ubuntu
  • Opted into Steam client beta?: [Yes/No] No
  • Have you checked for system updates?: [Yes/No] Yes

Please describe your issue in as much detail as possible:

The Steam client loses non-default game folder settings on abnormal shutdown. After restarting the Steam client, you have to re-attach the alternative game path. In this case, no other settings are broken. This has been going on for half a year.

Steps for reproducing this issue:

Any of:

  1. after execution kill command on any hanged game while the Steam client is running
  2. after execution kill command on Steam client while any game is running
  3. right click on tray Steam icon -> 'Exit from steam' while any game is running

ezdev128 avatar Apr 25 '22 22:04 ezdev128

Hello @ezdev128, can you clarify what you mean by "non-default game folder settings." Where is it configured? This doesn't sound like something the Steam client has ever supported.

kisak-valve avatar Apr 25 '22 23:04 kisak-valve

@kisak-valve I mean 'Steam Library Folders'. Default is: /home/$USER/.steam/debian-installation. So any else game folders (except default) in Storage Manager are affected.

ezdev128 avatar Apr 25 '22 23:04 ezdev128

I have also had this happen to me several times and I use opensuse on two separate machines and the same on both - never found the trigger though. An additional piece of info for me is that my secondary location is /games/steam/.... and the library folders lists the location in the dropdown as /games only. Additionally when I reconnect the library all of the games shaders in that library get redownloaded. Hope that helps track it down

apcolvin avatar May 08 '22 04:05 apcolvin

Hello @ezdev128, what is the full path you used with your secondary Steam library folder(s)? I suspect that there's a pattern here of Steam libraries with paths ending in [...]/steam.

Another example seen in #8596 with the Steam library located at /mnt/arch-games/steam.

kisak-valve avatar May 18 '22 12:05 kisak-valve

Mine ends /steam as you suggest with games in steam/steamapps

apcolvin avatar May 18 '22 12:05 apcolvin

Hello @ezdev128,

We cannot reproduce this. Can you provide the following files maybe: config/libraryfolders.vdf steamapps/libraryfolders.vdf and logs/content_log.txt (under ~/.steam/steam if you use the official Valve install paths).

If the libraryfolders.vdf files are still pointing to your external steam library once the client has stopped loading it, consider archiving it and uploading it to us (you can probably remove common/ which is going to be the bulk of the content, or reproduce on an empty library).

TTimo avatar May 23 '22 16:05 TTimo

This has been happening to me recently, usually after a reboot from a long session use.

Here are the files that you mentioned: gist link

Also noticed that content_log.txt says [2022-09-21 00:24:47] Drive removed: /mnt/NVMEData but I never did that

I am using Pop OS 22.04, installed using the distro-provided steam package, and using the Steam Client Beta version 1663634272

asimshrestha2 avatar Sep 21 '22 12:09 asimshrestha2

Have similar issue on arch. Rather than library, it forgets the games installed in that library.

ashtonx avatar Oct 06 '22 06:10 ashtonx

I had the issue on Ubuntu that Steam kept forgetting my manually-added default library folder. I believe it's solved (survived 2 reboots...) by changing the mount point to /home/xyz rather than /mnt/ - as recommended here https://support.system76.com/articles/extra-drive/.

arochfold avatar Nov 16 '22 19:11 arochfold

I had the issue on Ubuntu that Steam kept forgetting my manually-added default library folder. I believe it's solved (survived 2 reboots...) by changing the mount point to /home/xyz rather than /mnt/ - as recommended here https://support.system76.com/articles/extra-drive/.

Sadly no, it's still an issue, it seems like sometimes steam doesn't close properly when you're pressing shut down button while game is running and loses the libraries and you need to re-add them.

Try doing shutdown while game is running few times and you'll most likely encounter it again.

ashtonx avatar Nov 16 '22 19:11 ashtonx

same issue here steam sys info

zany130 avatar Nov 21 '22 22:11 zany130

I lately had problems with this, too. System is a current KDE Neon (Ubuntu 22.04 LTS based) I'm not sure if this only happens on an abnormal shutdown, but keep a closer look on shutdown conditions. My secondary paths end in SteamSSD and SteamLibrary (which than contain libraryfolder.vdf and steamapps)

kermitfrog avatar Nov 24 '22 16:11 kermitfrog

I believe I am experiencing this as well. I never made a connection with abnormal shutdowns, but I do fairly often have to kill Hearts of Iron 4 when it freezes, so they could be connected.

ltallen avatar Jan 04 '23 04:01 ltallen

Affects me as well, steam forgets other libraries, happens when steam gets closed/crashes while game is running. Running steam in archlinux via distrobox under fedora kinoite host.

Trollman16747 avatar Mar 14 '23 15:03 Trollman16747

Not to necro this thread, but I am also having this issue on Ubuntu. Seems this hasn't been fixed yet

NathanielH-snek avatar Apr 14 '23 21:04 NathanielH-snek

Next beta will have some changes that may improve this issue.

TTimo avatar Apr 14 '23 21:04 TTimo

Latest beta should have fixed this, if it hasn't please provide content_log.txt next time it happens ([email protected]) as it'll have more diagnostic information.

TTimo avatar May 02 '23 20:05 TTimo

It still forgets secondary steam library folders on an abnormal shutdown of the steam client (for example, force killing client after freeze or forcibly rebooting PC after a lockup) content_log.txt

zany130 avatar May 06 '23 01:05 zany130

glad to see i'm not the only once facing this problem tho i don't think rebooting via 'sudo reboot now' is what i'd call an abnormal shutdown

Kyr4l avatar May 13 '23 17:05 Kyr4l

@zany130 unfortunately your log is truncated and contains no useful information. It just reflects that there is a single Steam library and does not report on the Steam startup that failed to load the secondary.

TTimo avatar May 15 '23 16:05 TTimo

happened again here is another content log this time I will attach both content_log.previous.txt and content_log.txt content_log.previous.txt content_log.txt

zany130 avatar Jun 05 '23 21:06 zany130

@zany130 what is /mnt/GAMES on your system? What filesystem? Is it a removable device?

The relevant lines:

[2023-06-01 22:22:38] Drive removed: /mnt/GAMES
[..]
[2023-06-01 22:22:38] Unmounted library folder "/mnt/GAMES/SteamLibrary" (68 apps)
[2023-06-01 22:22:38] Triggered async write of Steam library folders configuration (1 libraries).

Steam gets a notification from the OS that the partition was unmounted, and so it removes the library. The client doesn't keep anything around, since the filesystem no longer exists. The library and the games are gone.

I'll have to check with other devs here but I'm not sure that's 'wrong'. On Deck there's code to detect and mount the library again if an sd card gets inserted, but there's nothing like that on desktop. Maybe the Steam client should keep track of UUIDs it has seen before and match them up to try and re-add a library.

It seems like for now the OS shouldn't unmount the partition from under Steam's nose.

TTimo avatar Jun 05 '23 23:06 TTimo

Yes, that's my secondary Steam library on a SATA hard drive I have permanently connected.

It should be mentioned the Steam library is not being removed consistently. So sometimes I forcibly kill Steam (or cut the power to my PC because it hangs) then re-open Steam, and it doesn't always remove the drive (before it was)

zany130 avatar Jun 06 '23 23:06 zany130

I'm facing this issue on a fresh install of Ubuntu 22.04.2. Looking at logs/content_log.txt it seems obvious why it's happening:

[2023-06-20 23:54:02] Drive removed: /mnt/Jättis
[2023-06-20 23:54:02] Dependency removed: parent 228980, child 12120, depot 228990
... dependency messages for about 50 rows or so
[2023-06-20 23:54:02] Dependency removed: parent 228980, child 2090230, depot 228990
[2023-06-20 23:54:02] Unmounted library folder "/mnt/Jättis/SteamLibrary" (56 apps)

So, when I shut down my system, the drive gets unmounted by the OS before steam is shut down. Steam is notified and it removes the library folder. Obviously this is intended behaviour, but I wonder what one could do to work around it? Obviously shutting down steam first and then the OS will help but a less manual workaround would be nice. Worth noting that I didn't have this issue on my previous install. The library folder is the same and even the /etc/fstab row for the drive is copied over from the old installation.

JarnoKai avatar Jun 21 '23 08:06 JarnoKai

Thanks @JarnoKai. We have two confirmations of the root cause for this now.

This is really an OS problem - Ubuntu 22 only as far as I can tell? UI / desktop sessions processes shouldn't be left running while the OS is unmounting partitions...

We could put a workaround in the Steam client, either by detecting that the system is shutting down, or by keeping a mapping of library paths indexed by partition UUIDs so we can remount them later. I can't give you an ETA on us doing this though.

TTimo avatar Jun 21 '23 14:06 TTimo

This just hit me, though I'm not sure I can reconstruct what happened. Was playing some game on Arch ... stopped that, but Steam was still running. Did a system update (including Kernel) and attached/detached some USB sticks.

Then (w/o rebooting) wanted to start Hunt: Showdown, it ran but caused some exception ... I figured I should probably reboot to get everything aligned, did that, Steam library is empty :/

Under Downloads, I only see /home/uqs/.local/share/Steam and my other location of /opt/steam is gone. NB: /opt is not a separate filesystem, but resides on / just as /home, so it's essentially a symlink-like situation.

With the UI bug in the new steam (see issue #9273 ) I also can't seem to re-add /opt/steam ... I'll probably symlink things over at this point to get things unstuck?

uqs avatar Jun 25 '23 18:06 uqs

Ok, lol. So I had a look at .local/share/Steam/steamapps/libraryfolders.vdf and it looked hopeless, but then I saw that I also had a /opt/steam/libraryfolder.vdf, so I just copied that contentid over to a second entry.

{
        "0"
        {
                "path"          "/home/uqs/.local/share/Steam"
                "label"         ""
                "contentid"             "1611104819401591390"
                "totalsize"             "0"
                "update_clean_bytes_tally"              "0"
                "time_last_update_corruption"           "0"
                "apps"
                {
                        "228980"                "883257504"
                        "1493710"               "1229396969"
                }
        }
        "1"
        {
                "path"          "/opt/steam"
                "label"         ""
                "contentid"             "2619151340883743646"
                "totalsize"             "0"
                "update_clean_bytes_tally"              "0"
                "time_last_update_corruption"           "0"
        }
}

Started steam, and voila presto it looks same as before. Though the "Storage" setting is weird, in that it shows Local Drive (/) and External Drive (/)

So is it possible that my (not so old, mind you) installation of Steam with a separate games folder is no longer a supported setup? It sure is impossible to add it like so in the UI. It only seems to truly want to add different drives, not different locations from the same drive ...

uqs avatar Jun 25 '23 19:06 uqs

I think this isn't specific to Linux either. In addition to my Linux desktop I also have a mac and I occasionally run games off of an external drive. Sleeping the device while steam is still running will cause the external drive to "eject improperly" and steam will not recognize the drive anymore until manually readding the library. Admittedly this may be a separate issue but I wanted to contribute this in case it was useful

NathanielH-snek avatar Jun 25 '23 19:06 NathanielH-snek

Thanks @NathanielH-snek - this is clearly the same problem.

TTimo avatar Jun 26 '23 17:06 TTimo

I have the same issue occasionally on Arch. I believe it happens at OS shutdown if Steam is still running, the OS unmounts the drive or at least signals it is being removed before Steam shuts down. My steam library is on an internal SSD mounted at /ssd (/ssd/steamlibrary). content_log.txt

Mike3137 avatar Jul 20 '23 07:07 Mike3137