maharmstone / btrfs

WinBtrfs - an open-source btrfs driver for Windows
GNU Lesser General Public License v3.0
5.8k stars 222 forks source link

Steam resetting permissions when switching between Windows and Arch Linux #655

Open markmann447 opened 5 months ago

markmann447 commented 5 months ago

Hey, I don't know if this is a winbtrfs thing or a Valve thing, but basically when I play a game on an extra drive formatted using btrfs. When I log back into Linux, I have to take ownership of each drive with steam games on it, and this happens every time. Is there anything you can do on your end to stop the permissions from resetting when logging back into Linux? The reason I'm opening up this issue is because there's a potential risk of breaking my system when taking permissions on my Arch Linux drive. Obviously the way to prevent this from happening is to not format the OS drive, but in my personal opinion winbtrfs is a MUST HAVE tool for people who dual boot, and having this tool would make the linux adoption much higher for people who still need Windows on a seperate drive when they play games with intrusive anti-cheat or need to use programs that just don't work under WINE.

Thank you regardless for this wonderful tool.

rautamiekka commented 5 months ago

What do you mean by take ownership/permissions ?

markmann447 commented 5 months ago

missing file privilges So whenever I would switch to my Windows partition to play a game on Windows, it would run fine and update. Although when I switch to Linux, I get this "Missing file privileges" error. The way to solve this issue is to basically go into gnome disk utility and "Take Ownership" of each individual drive. This basically happens because Windows on Steam is somehow removing or resetting the file permissions for games on btrfs formatted drives. I was wondering if there was anything you can do on your end to solve this issue.

42Willow commented 4 months ago

This is probably related #421

Have a look at the Mappings section of the README, which tells you how to map your Windows SID to your Linux uid.

If it's resetting the permissions to 644 as well, it's probably because the program is "saving" the file by creating a new one and deleting the old one - I know some versions of Office do this, for instance.

weskerty commented 3 months ago

then it would be to create a DWORD entry in the registry HKLM\SYSTEM\CurrentControlSet\services\btrfs\Mappings with the id of your user in windows and in the value of the linux user?

image image

image

42Willow commented 3 months ago

I'm also experiencing the same issue, I just haven't been bothered trying to fix it with the solution I referenced...

This is what I'm going to try now:

SID (windows): wmic useraccount get name,sid UID (linux): $ id GID (linux): $ id

Arch Linux has a default group ID of 1000, but the default is 100 (according to the README)

The default entry maps Windows' Users group to gid 100, which is usually "users" on Linux.

Windows

User mappings: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\btrfs\Mappings Group mappings: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\btrfs\GroupMappings

repeat for both user mappings and group mappings

  1. Create a new DWORD (32-bit) for your SID:
  2. Name the DWORD with your Windows SID
  3. Set the value to your Linux UID or GID
  4. Repeat one more time for UID or GID

I'll get back to you to let you know if it works

42Willow commented 3 months ago

@weskerty I'm having trouble with the permissions, where did you find that menu?

weskerty commented 3 months ago

@weskerty I'm having trouble with the permissions, where did you find that menu?

file properties, Btrfs tab

weskerty commented 3 months ago

The default group changed with this setting In \btrfs\GroupMappings there was a DWORD S-1-5-32-545 There I set to Users (which in my Arch is 984) Screenshot_2

But I can't Change the Owner, I added all the users, I also cloned the GroupMappings ID and still nothing changes. The new folder and file created from Windows will have the ID 65534 which appears as Nobody in ArchLinux. image image

I don't know if I should open another issue about this.

youbloub commented 2 months ago

same error for me.

installing game under linux, launch it: working going on windows( with WinBtrfs v1.9) : working. going back to linux: get error : "an error occured while launching this game: missing file privileges"

tested on 2 computers and get same error. tried following git winbtrfs wiki : the mapping and fast boot added in regedit does not help. making a chown $user on my steam folder grant acces to steam.

this is clearly a window side problem

dekeonus commented 1 month ago

I have a suspicion this is because of

Note that processes running under User Access Control tokens create files as the BUILTIN\Administrators SID (S-1-5-32-544), rather as a user account.

and this would mean that there is no "user" in the posix sense. A windows process has a SID associated to it that can be a user OR a group (as well as a few other types, but user or group will be the most common). A posix system has BOTH a user (uid) AND a group (gid) associated with the process.

@weskerty do you have a GroupMapping for S-1-5-32-544 (Builtin Admins Alias) AND S-1-5-32-545 (Builtin Users Alias) and perhaps you could also try putting S-1-5-32-544 (Builtin Admins Alias) into Mappings (i.e. user mappings) and set it to your linux user account

Ideally I'd like to set winbtrfs mount options similar to file_mode=0664 dir_mode=0775 (or file_mode=0660 dir_mode=0770) and set set_gid on the dirs. (I'm currently trying to workout if winbtrfs does allow to change the create mode used for new objects)

markmann447 commented 2 weeks ago

Hello, I'm sorry to bother you guys but has there been any recent progress on this issue?