Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Replicate a homedir in the sandbox and point the userdir to it #572

Closed
mirkobrombin opened this issue Sep 29, 2021 Discussed in #571 · 3 comments
Closed

[Request] Replicate a homedir in the sandbox and point the userdir to it #572

mirkobrombin opened this issue Sep 29, 2021 Discussed in #571 · 3 comments

Comments

@mirkobrombin
Copy link
Member

Discussed in #571

Originally posted by stonebuckl September 28, 2021
I have an issue where after closing and opening Bottles running with Flatpak all settings and local characters in Diablo 2 Resurrected are deleted. It seems as if those files are stored in a virtual file system that only exists during the sandboxed execution. I also understand that I could probably expose a folder to circumvent this issue as described here. However, I think it should be possible for D2R to create and keep local files inside the sandbox. Am I wrong?

It seems to me, the main issue is that in my Bottles winecfg, the folder Documents links to /home/username instead of (what I would assume to be correct) an existing directory in the bottle directory. Using strace, I can see that the files are accessed at /home/username/.var/app/com.usebottles.bottles/data/bottles/bottles/Battlenet/dosdevices/c:/users/username/Documents/Diablo II Resurrected/Save/ but that folder only exists in Wine (checked with command prompt), not physically on the disk. Consequently, the folder vanishes after closing Bottles.

[pid 80501] 20:56:17 lstat("/home/username/.var/app/com.usebottles.bottles/data/bottles/bottles/Battlenet/dosdevices/c:/users/username/Documents/Diablo II Resurrected/Save/Isabella.d2s", {st_mode=S_IFREG|0644, st_size=945, ...}) = 0

My understanding is that as the Battle.net client can somehow use local files to keep my login credentials and store game data, so should the game itself be able to. Am I wrong?

@mirkobrombin mirkobrombin changed the title Diablo 2 Resurrected settings and local data lost after Flatpak Bootles restart [Request] Replicate a homedir in the sandbox and point the userdir to it Sep 29, 2021
@mirkobrombin
Copy link
Member Author

mirkobrombin commented Sep 29, 2021

Originally posted by mirkobrombin September 28, 2021

I've managed to reproduce the problem, using notepad I created a file and saved in C:\users\USER\Downloads, the file is detected by wine but not by the system and once the subsystem is restarted, the file disappears.

The problem is that wine default point the folders inside the user's dir, to the user's home dir. As you have seen, you can fix the problem by exposing the homedir to Bottles, so that the runner can write to that directory.

Regarding your question, I believe it is possible to force wine to use an internal path for those links, I believe I will turn this thread into an issue to add the functionality to the roadmap.

Workaround: Exposing the homedir to Bottles

Feature concept

As the Bottles' Flatpak is now sandboxed, it cannot access the homedir, this cause the runner to treat that directory as a temp which will be cleaned on restart.

To fix it we can just place a homedir folder in each bottles, e.g. /data/bottles/myBottle:

  • bottle.yml
  • drive_c/
  • dosdevices/
  • *.reg
  • homedir/

then reproducing the standard homedir structure inside that folder:

  • homedir/Downloads
  • homedir/Documents
  • homedir/..

and link the userdir from the prefix to these:

  • drive_c/users/USER/Downloads -> homedir/Downloads
  • drive_c/users/USER/Documents -> homedir/Documents
  • drive_c/users/USER/.. -> homedir/..

I think this can be made a default and not an only flatpak-feature. Maybe the first step for a all-packages-sandbox.

Resources:

@stonebuckl
Copy link

@mirkobrombin Could you let me know how to activate the new behavior in an existing Bottle? I just tried and the local files are still being deleted after Bottles restart with version 2021.10.14-treviso-2. Or do I have to recreate the Bottle?

@mirkobrombin
Copy link
Member Author

mirkobrombin commented Oct 17, 2021

In existing bottle you should unlink (using the unlink command) the directories inside ~/.var/app/com.usebottles.bottles/data/bottles/bottles/yourBottle/drive_c/users/yourUsername and make them as folders.

Here you can find more information, like the correct directories and the symlinks: https://docs.usebottles.com/flatpak/expose-directories/use-system-home

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants