Matoking / protontricks

A wrapper that does winetricks things for Proton enabled games, requires Winetricks.
GNU General Public License v3.0
1.56k stars 35 forks source link

protontricks seems to lack permissions, running as sudo results in crash (returncode: 69) #307

Open sebastianrueckerai opened 1 week ago

sebastianrueckerai commented 1 week ago

Describe the bug

I am following this guide to get Gothic II to run:https://bfloeser.de/posts/gothic/#the-absolute-minimum Installing the needed components via protontricks results in errors.

To Reproduce

  1. Install protontricks on Ubuntu via pipx
  2. try protontricks 39510 directmusic

Expected behavior should install directmusic

System (please complete the following information):

Additional context

If I do protontricks 39510 directmusic I get:

Traceback (most recent call last):
  File "/home/womb/.local/bin/protontricks", line 8, in <module>
    sys.exit(cli())
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/main.py", line 370, in main
    returncode = run_command(
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/util.py", line 456, in run_command
    wine_bin_dir = create_wine_bin_dir(proton_app)
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/util.py", line 217, in create_wine_bin_dir
    shutil.rmtree(str(bin_path))
  File "/usr/lib/python3.10/shutil.py", line 725, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.10/shutil.py", line 681, in _rmtree_safe_fd
    onerror(os.unlink, fullname, sys.exc_info())
  File "/usr/lib/python3.10/shutil.py", line 679, in _rmtree_safe_fd
    os.unlink(entry.name, dir_fd=topfd)
PermissionError: [Errno 13] Permission denied: 'wine-preloader'

If I try sudo -E protontricks 39510 directmusic I get:

pressure-vessel-wrap[67925]: N: Not replacing "/etc/vulkan/explicit_layer.d" with tmpfs: Path "/etc" is reserved by the container framework
pressure-vessel-wrap[67925]: N: Not replacing "/etc/vulkan/implicit_layer.d" with tmpfs: Path "/etc" is reserved by the container framework
pressure-vessel-wrap[67925]: W: Not sharing path --filesystem="/etc" with container because "/etc" is reserved by the container framework
pressure-vessel-wrap[67925]: W: Not sharing path --filesystem="/lib32" with container because "/lib32" is reserved by the container framework
pressure-vessel-wrap[67925]: N: Not sharing "/libx32" with sandbox: Path "/usr" is reserved by the container framework
pressure-vessel-wrap[67925]: W: Not sharing path --filesystem="/sbin" with container because "/sbin" is reserved by the container framework
steam-runtime-launcher-service[68033]: E: Can't find session bus: The connection is closed
Traceback (most recent call last):
  File "/home/womb/.local/bin/protontricks", line 8, in <module>
    sys.exit(cli())
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/main.py", line 370, in main
    returncode = run_command(
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/util.py", line 516, in run_command
    raise RuntimeError(
RuntimeError: bwrap launcher crashed, returncode: 69

Any help would be appreciated!

Matoking commented 1 week ago

Protontricks creates a set of Wine wrapper scripts under $XDG_CACHE_HOME/protontricks/<Proton name>/bin/; $XDG_CACHE_HOME is usually $HOME/.cache. If this directory doesn't have execute permissions (eg. because the mount has noexec set), that could explain the permission problem.

The location has caused problems before. I might set it to prefer $XDG_RUNTIME_DIR instead if that's available, as it might have better guarantee of having execute permission.

sebastianrueckerai commented 1 week ago

@Matoking thanks! Anything I can do in the meantime to make it work on my end? Also, if this is a permission problem, why is "sudo -E protontricks " not working either, do you know?

Matoking commented 6 days ago

Don't run Protontricks as root! It's generally a bad idea for general applications, as even if it does work it can make a mess of your file permissions. Protontricks does not require administrator rights.

I've pushed an experimental fix described above to the check_mount_noexec branch. Since you're using pipx, could you install it using the following command and check if it solves your issue?

$ pipx install --force git+https://github.com/Matoking/protontricks.git@check_mount_noexec

If that doesn't solve the issue, could you try running mount and posting the output here?

sebastianrueckerai commented 3 days ago

@Matoking I tried your new version, unfortunately it did not work:

 šŸ§ womb 20:31:36 07/04/24 ī‚° ā²cā³ base ī‚° šŸ  ī‚° āœ… ī‚° pipx install --force git+https://github.com/Matoking/protontricks.git@check_mount_noexec
Installing to existing venv 'protontricks'
  installed package protontricks 1.11.2.dev9+gb038772, installed using Python 3.10.12
  These apps are now globally available
    - protontricks
    - protontricks-desktop-install
    - protontricks-launch
done! āœØ šŸŒŸ āœØ
 šŸ§ womb 20:31:45 07/04/24 ī‚° ā²cā³ base ī‚° šŸ  ī‚° āœ… ī‚° protontricks 39510 directmusicTraceback (most recent call last):
  File "/home/womb/.local/bin/protontricks", line 8, in <module>
    sys.exit(cli())
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/main.py", line 32, in cli
    main(args)
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/util.py", line 159, in wrapper
    return cli_func(self, *args, **kwargs)
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/cli/main.py", line 357, in main
    proton_app = find_proton_app(
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/steam.py", line 848, in find_proton_app
    tool_app = find_steam_compat_tool_app(
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/steam.py", line 609, in find_steam_compat_tool_app
    appinfo_sections = [
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/steam.py", line 609, in <listcomp>
    appinfo_sections = [
  File "/home/womb/.local/pipx/venvs/protontricks/lib/python3.10/site-packages/protontricks/steam.py", line 531, in iter_appinfo_sections
    raise SyntaxError(
SyntaxError: Invalid file magic number. The appinfo.vdf version might not be supported by the current version of Protontricks - please check for updates.

Here is the mount output:

 šŸ§ womb 20:32:01 07/04/24 ī‚° ā²cā³ base ī‚° šŸ  ī‚° āŒ1 ī‚° mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=48966976k,nr_inodes=12241744,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=9801132k,mode=755,inode64)
/dev/nvme0n1p2 on / type ext4 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=29,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=23585)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
ramfs on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
sunrpc on /run/rpc_pipefs type rpc_pipefs (rw,relatime)
net_cls on /sys/fs/cgroup/net_cls type cgroup (rw,relatime,net_cls)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=9801128k,nr_inodes=2450282,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
Matoking commented 3 days ago

The error you received is unrelated to this issue; see #304.