Unable to add new library folder to steam

Hi there. I am a new nixOS user, and one of the issues I’ve struggled with is trying to add a new library to Steam.

When I go to Steam → Settings → Storage → /home → Add Drive, I get a pop-up with two options:

/tmp/dumps
Let me choose another location

If I choose the latter, I get this blank screen:

image

Clicking New folder does nothing. Clicking select does nothing. Cancel closes the window, and afterwards, I get a generic error on the previous modal:

image

Also, when I first open up the settings window, I get a bunch of spam in stdout:

Couldn't write /nix/.steam_exec_test.sh: Read-only file system
Couldn't write /nix/store/.steam_exec_test.sh: Read-only file system
Couldn't write /nix/store/9y8pmvk8gdwwznmkzxa6pwyah52xy3nk-glibc-2.38-27/etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /nix/store/g3fisxkmyipgr4d1xyg6v1xcwfln04g4-glibc-2.38-27/etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /usr/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/bash_completion.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/cups/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/dbus-1/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/debuginfod/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/gconf/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/gtk-2.0/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/gtk-3.0/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/locale/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/login.defs/.steam_exec_test.sh: Not a directory
Couldn't write /etc/man/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/mono/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/OpenCL/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/pam.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/pkgconfig/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/profile/.steam_exec_test.sh: Not a directory
Couldn't write /etc/profile.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/protocols/.steam_exec_test.sh: Not a directory
Couldn't write /etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /etc/services/.steam_exec_test.sh: Not a directory
Couldn't write /etc/systemd/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/udev/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/vdpau_wrapper.cfg/.steam_exec_test.sh: Not a directory
Couldn't write /etc/X11/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/xattr.conf/.steam_exec_test.sh: Not a directory
Couldn't write /etc/xdg/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/xinetd.d/.steam_exec_test.sh: Read-only file system
Couldn't write /.host-etc/.steam_exec_test.sh: Read-only file system
Couldn't write /boot/.steam_exec_test.sh: Permission denied
Couldn't write /root/.steam_exec_test.sh: Permission denied
Couldn't write /srv/.steam_exec_test.sh: Permission denied
Couldn't write /var/.steam_exec_test.sh: Permission denied
Couldn't write /tmp/.X11-unix/X0/.steam_exec_test.sh: Not a directory
Couldn't write /nix/.steam_exec_test.sh: Read-only file system
Couldn't write /nix/store/.steam_exec_test.sh: Read-only file system
Couldn't write /nix/store/9y8pmvk8gdwwznmkzxa6pwyah52xy3nk-glibc-2.38-27/etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /nix/store/g3fisxkmyipgr4d1xyg6v1xcwfln04g4-glibc-2.38-27/etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /usr/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/bash_completion.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/cups/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/dbus-1/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/debuginfod/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/gconf/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/gtk-2.0/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/gtk-3.0/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/locale/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/login.defs/.steam_exec_test.sh: Not a directory
Couldn't write /etc/man/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/mono/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/OpenCL/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/pam.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/pkgconfig/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/profile/.steam_exec_test.sh: Not a directory
Couldn't write /etc/profile.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/protocols/.steam_exec_test.sh: Not a directory
Couldn't write /etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /etc/services/.steam_exec_test.sh: Not a directory
Couldn't write /etc/systemd/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/udev/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/vdpau_wrapper.cfg/.steam_exec_test.sh: Not a directory
Couldn't write /etc/X11/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/xattr.conf/.steam_exec_test.sh: Not a directory
Couldn't write /etc/xdg/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/xinetd.d/.steam_exec_test.sh: Read-only file system
Couldn't write /.host-etc/.steam_exec_test.sh: Read-only file system
Couldn't write /boot/.steam_exec_test.sh: Permission denied
Couldn't write /root/.steam_exec_test.sh: Permission denied
Couldn't write /srv/.steam_exec_test.sh: Permission denied
Couldn't write /var/.steam_exec_test.sh: Permission denied
Couldn't write /tmp/.X11-unix/X0/.steam_exec_test.sh: Not a directory

Here’s a link to my dotfiles: GitHub - rykugur/dotfiles: Various linux dotfiles.

And the relevant steam config in my dotfiles:

{ inputs, config, lib, pkgs, ... }: {
  programs = {
    steam = {
      enable = true;
      remotePlay.openFirewall = true;
      dedicatedServer.openFirewall = true;
    };
  };

  environment.systemPackages = [
    pkgs.gamescope
    pkgs.gamemode
  ];
}

I run btrfs, and have several SSD’s added under a single logical volume. Is there a way/how can I go about overriding the nixOS FHS to specify a btrfs subvolume I’ve created at /home/dusty/games? Does the subvolume perhaps need to be at the root-level (i.e. /games)? Does it need to be specified in my hardware-configuration.nix file?

What WM/DE do you run? Looks to me like your file picker menu implementatiom isn’t working for some reason, whatever it is backed by - steam will use its own if you have none.

I’m running Hyprland. I went through the wiki entry and everything looks to be installed correctly. My hyprland.nix config:

{ inputs, pkgs, ... }: {
  programs.hyprland = {
    enable = true;
    package = inputs.hyprland.packages.${pkgs.system}.hyprland;
    xwayland.enable = true;
  };

  environment.systemPackages = with pkgs; [
    xdg-desktop-portal-hyprland
    xdg-desktop-portal-gtk
  ];
}

I tested the file picker in other apps and it seems okay, but maybe that doesn’t tell me much.

EDIT: I tried adding xdg-desktop-portal as well after reading the Arch linux wiki, but no fix.

I stumbled on a github post and looks like the backend is showing true for xdg-desktop-portal-gtk portal, but reporting an error:

EDIT:

Also this line looks interesting:

        "org.freedesktop.portal.FileChooser" : {
          "available" : false
        }, 

This is not how you install portals. You use xdg.portal.enable = true; and then set xdg.portal.extraPortals, see Flatpak section of the NixOS manual.

Although you should not need it as Hyprland NixOS module does it for you:

Looking at Hyprland portal configuration, you might benefit from adding x-d-p-gtk there:

$ cat $(nix-build -A hyprland)/share/xdg-desktop-portal/hyprland-portals.conf
[preferred]
default=hyprland;gtk

The Hyprland portal enabled by default does not actually ship FileChooser portal:

$ cat $(nix-build -A xdg-desktop-portal-hyprland)/share/xdg-desktop-portal/portals/hyprland.portal
[portal]
DBusName=org.freedesktop.impl.portal.desktop.hyprland
Interfaces=org.freedesktop.impl.portal.Screenshot;org.freedesktop.impl.portal.ScreenCast;org.freedesktop.impl.portal.GlobalShortcuts;
UseIn=wlroots;Hyprland;sway;Wayfire;river;

You’re right, I was reading up on that when I saw your response.

This is specified in the Hyprland wiki, so I tried adding xdg-desktop-portal-gtk to extraPortals:

{ inputs, pkgs, ... }: {
  programs.hyprland = {
    enable = true;
    package = inputs.hyprland.packages.${pkgs.system}.hyprland;
    xwayland.enable = true;
  };

  xdg.portal = {
    enable = true;
    extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
  };
}

Unfortunately it did not fix the problem.

Have you tried running without xdpgtk? As I mentioned, steam inplements its own file chooser, which IME runs when no other chooser is installed.

You could perhaps confirm my suspicion about xdp issues by trying to pick a folder and then looking at the user log for all the xdp units you’re using. One of them should complain about not being able to do something.

Worst case, I think journalctl --user -f should give some insights anyway.

I’d need to find the post, but I read on github there was a recent change (mid 2023) that either removed the Steam file browser, or changed to prefer the native file picker.

I did indeed try without xdpgtk and no change. journalctl had this for output, which I didn’t find surprising:

Jan 28 13:38:01 jezrien dbus-daemon[1741]: [session uid=1000 pid=1741] Activating via systemd: service name='org.freedesktop.impl.portal.desktop.gtk' unit='xdg-desktop-portal-gtk.service' requested by ':1.258' (uid=1000 pid=111228 comm="/usr/libexec/steam-runtime-tools-0/x86_64-linux-gn" label="kernel")
Jan 28 13:38:01 jezrien dbus-daemon[1741]: [session uid=1000 pid=1741] Activation via systemd failed for unit 'xdg-desktop-portal-gtk.service': Unit xdg-desktop-portal-gtk.service not found.
Jan 28 13:38:01 jezrien dbus-daemon[1741]: [session uid=1000 pid=1741] Activating via systemd: service name='org.freedesktop.impl.portal.desktop.kde' unit='plasma-xdg-desktop-portal-kde.service' requested by ':1.258' (uid=1000 pid=111228 comm="/usr/libexec/steam-runtime-tools-0/x86_64-linux-gn" label="kernel")
Jan 28 13:38:01 jezrien dbus-daemon[1741]: [session uid=1000 pid=1741] Activation via systemd failed for unit 'plasma-xdg-desktop-portal-kde.service': Unit plasma-xdg-desktop-portal-kde.service not found.

Edit: found one of several github issues mentioning it here

Ah. Huh. It still showed up for me a week or three ago, but fair enough.

I vaguely recall NixOS’ fhs being problematic with the xdg portals. Can you try watching the logs with xdpgtk enabled?

Tried again with xdpgtk enabled - not much. Steam spit these logs out, butg they don’t look overly related:

… pre-submit edit: I had a bunch of stuff typed out, but decided to reboot before I submit. Hey, whadda ya know, it’s working now. The fix was to add xdg-desktop-portal-gtk to environment.systemPackages:

{ inputs, pkgs, ... }: {
  programs.hyprland = {
    enable = true;
    package = inputs.hyprland.packages.${pkgs.system}.hyprland;
    xwayland.enable = true;
  };

  xdg.portal = {
    enable = true;
    extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
  };

  environment.systemPackages = with pkgs; [
    xdg-desktop-portal-gtk
  ];
}

I think that I thought-without-thinking that adding it to extraPortals would also install it.

Thank you for your assistance!

It does. I think it’s more likely that you just needed to reboot after xdp-gtk was added to get steam to actually see it or such. But hey, nice that it’s fixed!

1 Like

I was having the same issue with a similar log output as OP:

Couldn't write /nix/.steam_exec_test.sh: Read-only file system
Couldn't write /nix/store/.steam_exec_test.sh: Read-only file system
Couldn't write /nix/store/pacbfvpzqz2mksby36awvbcn051zcji3-glibc-2.40-36/etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /nix/store/nc130f3h3fdaabx63bdqbgly9q81fl31-glibc-2.40-36/etc/rpc/.steam_exec_test.sh: Not a directory
Couldn't write /usr/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/audit/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/avahi/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/bash_completion.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/bluetooth/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/dbus-1/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/gtk-3.0/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/libnl/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/locale/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/man/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/nftables/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/nginx/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/OpenCL/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/pam.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/pkcs11/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/pkgconfig/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/ppp/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/profile.d/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/security/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/systemd/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/tpm2-tss/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/udev/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/wildmidi/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/X11/.steam_exec_test.sh: Read-only file system
Couldn't write /etc/xdg/.steam_exec_test.sh: Read-only file system
Couldn't write /boot/.steam_exec_test.sh: Permission denied

I mainly use COSMIC, but I also tried the portals fix given in i3; it worked in neither configuration.

I get these logs when I click “Add Drive” on this screen:
image

This could totally be thanks to my impermanence setup but the logs looked quite similar to what I saw here. Following is my config: GitHub - GetPsyched/homeless-shelter: my nix config

Hey!

I’m pretty new when it comes to NixOS, so maybe I missed something obvious, but, no matter what I seem to try I also can’t get Steam to work with my other drive.

I’ve installed xdg.portal and rebooted like was explained here, but Steam still refuses to recognize I have other drives for some reason. Any ideas? (Also, where do I find Steam’s logs that I see other people posting?)

I’m running KDE Plasma 6 Wayland on NixOS 25.05 if that helps, and here’s all my steam-related stuff:

{ config, pkgs, lib, … }:

xdg.portal = {
enable = true;
extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
};

programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
};

(Idk how to make my config look pretty like everyone else’s lol)
Thanks!

Hm, this is a shot in the dark, but since you’re using plasma, remove the gtk portal? Not sure, AIUI the plasma portal is more limited and people use the gtk portal in addition, but it’s worth a try.

If you manually start it from a terminal by running steam it will log to your terminal.

The easy way is to just manually put spaces in there so it looks pretty. Many editors will align things for you correctly if you use tab.

You can also use nixfmt to do that automatically - just running it against your file manually is an option, but you can also configure your editor to automatically run it on save or such.

Ok, I’ve commented out extraPortals:

xdg.portal = {
enable = true;
#extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
};

And sudo nixos-rebuild switch’d.

After rebooting, I opened steam through konsole and saw it was complaining about not having write permissions to two directories when I try to “Add Drive”:

Couldn’t write /boot/.steam_exec_test.sh: Permission denied
Couldn’t write /home/crimson/Gen4Nvme500Gb/.steam_exec_test.sh: Permission denied

So I gave it write permissions via

sudo chmod o+w /home/crimson/Gen4Nvme500Gb

aaaaaand Bingo!

Thank you so much TLATER! I probably wouldn’t have figured that out on my own lol.

Instead of doing that, I’d really recommend figuring out what user/group steam runs as and making sure that user has write permissions. The ps command will tell you that.

You’re not using the flatpak version, so this should just be your user.

Most likely the SSD is mounted on boot and owned by root.

1 Like

Yep! Switched write perms over to the User with

sudo chmod o-w

and then

sudo chmod u+w

Checked steam and everything still works!

Thanks again!

You probably also need something along the lines of:

chown -R steam:steam <dir>