protonscr

Path to Steam directory cannot contain spaces

steamopen reviewed
ValveSoftware/steam-for-linux#3711 · opened 2015-02-10 by tkedwards · updated 2022-07-15 · 9 comments · github
Ttkedwards 2015-02-10 github

I've moved my Steam directory to another location and I've found that Steam won't start if the directory path contains spaces.

Steps to reproduce:

  1. Install Steam as normal
  2. cd ~; mkdir "Program Data"; mv .local/share/Steam "Program Data/"
  3. cd .local/share; ln -s /home/user/"Program Data"/Steam
  4. Start Steam: /usr/bin/steam

Expected result:
Steam starts properly

Actual result:
Steam fails to start with:

$ /usr/bin/steam
Running Steam on ubuntu 14.04 64-bit
STEAM_RUNTIME is enabled automatically
/home/user/Program Data/Steam/steam.sh: line 347: no match: /home/user/ubuntu12_32/steam-runtime.tar.xz.part*
/home/user/Program Data/Steam/steam.sh: line 697: LD_LIBRARY_PATH: unbound variable

Workarounds:
Start Steam at the shell with: cd "/home/user/Program Data/"; ./steam.sh
Change "Program Data" to "Program_Data"

Suggested Fix:
As far as I can tell the way you set STEAMROOT using dirname $0 is wrong - you need to enclose it in quotes to account for file paths that have spaces:
STEAMROOT="$(cd "$(dirname "$0")" && echo $PWD)"

OOxalin 2015-02-11 github

Your short log points at another problem about LD_LIBRARY_PATH not being defined:
/home/user/Program Data/Steam/steam.sh: line 697: LD_LIBRARY_PATH: unbound variable
This is a bug already reported: issue 3697 (https://github.com/ValveSoftware/steam-for-linux/issues/3697)
This can be solved by defining LD_LIBRARY_PATH as follow:
export LD_LIBRARY_PATH=""
Then launch steam.

That said, about the reported bug, indeed the missing quotes seem to be the real problem.

Updated comment: removed question about the symlink.

OOxalin 2015-02-11 github

By the way, your suggested fix makes sense. ;)

Ttkedwards 2015-02-11 github

Thanks for the quick response. In case it helps still I've done the symlink thing, it hasn't made a difference:

$ cd .local/share/
$ rm Steam
$ ln -s /home/user/Program\ Data/Steam
$ steam
Repairing installation, linking /home/user/.steam/steam to /home/user/.local/share/Steam
Running Steam on ubuntu 14.04 64-bit
STEAM_RUNTIME is enabled automatically
/home/user/Program Data/Steam/steam.sh: line 347: no match: /home/user/ubuntu12_32/steam-runtime.tar.xz.part*
/home/user/Program Data/Steam/steam.sh: line 697: LD_LIBRARY_PATH: unbound variable
Zzman0900 2015-02-12 github

This would be a smarter way to set the STEAMROOT variable:

STEAMROOT=$(dirname "$(readlink -f "$0")")
OOxalin 2015-02-12 github

Yes, that would be another solution. But, from a bug encountered in a launch script, wouldn't it be better to add quotes like this:
STEAMROOT="$(dirname "$(readlink -f "$0")")"

Ttkedwards 2015-04-08 github

Any chance of putting one of these fixes in the next release? I still see the problem after the latest update.

Nnanonyme 2018-10-18 github

Not sure how probable this is for anyone with *nix-only background since most such people know to use underscores instead of spaces for compatibility. Not saying I wouldn't like to see this bug squished

Ttkedwards 2018-10-18 github

*nix has always supported spaces in filenames, and that's commonly used in people's home directories. This is a bug worth fixing

MMagicD3VIL 2022-07-15 github

Your short log points at another problem about LD_LIBRARY_PATH not being defined: /home/user/Program Data/Steam/steam.sh: line 697: LD_LIBRARY_PATH: unbound variable This is a bug already reported: issue 3697 (#3697) This can be solved by defining LD_LIBRARY_PATH as follow: export LD_LIBRARY_PATH="" Then launch steam.

That said, about the reported bug, indeed the missing quotes seem to be the real problem.

Unreal that I have encountered a problem tied to this somehow 7 years later. I tried to find out for 5 hours how it is possible that Steam segfaults when I try to open it via terminal (Konsole) with

/home/magicd3vil/.local/share/Steam/steam.sh: line 794: 372749 Segmentation fault      (core dumped) "$STEAMROOT/$STEAMEXEPATH" "$@"

and when I launch it in KDE via the desktop shortcut it works with no problems.

And... for no apparent reason when I try to launch it from the terminal via LD_LIBRARY_PATH="" steam suddenly it works :')