hartwork / sandwine

:wine_glass: Command-line tool to run Windows apps with Wine and bwrap/bubblewrap isolation on Linux
https://pypi.org/project/sandwine/
GNU General Public License v3.0
81 stars 5 forks source link

Sandwine fails with "true: 1: wineserver: not found" #55

Closed MausKaffee34767 closed 2 weeks ago

MausKaffee34767 commented 6 months ago

If i try to run sandwine it immediately crashes!

Log:

2024-04-29 19:49:48 a sandwine._main[700753] DEBUG Path '/home/x/.nvm/versions/node/v21.7.1/bin' will not exist in sandbox mount stack, dropped from ${PATH}.
2024-04-29 19:49:48 a sandwine._main[700753] DEBUG Path '/snap/bin' will not exist in sandbox mount stack, dropped from ${PATH}.
2024-04-29 19:49:48 a sandwine._main[700753] DEBUG Path '/home/x/.dotnet/tools' will not exist in sandbox mount stack, dropped from ${PATH}.
2024-04-29 19:49:48 a sandwine._main[700753] DEBUG Path '/home/x/jadx-1.4.7/bin' will not exist in sandbox mount stack, dropped from ${PATH}.
2024-04-29 19:49:48 a sandwine._main[700753] DEBUG Path '/home/x/.local/bin' will not exist in sandbox mount stack, dropped from ${PATH}.
# bwrap \
    --disable-userns \
    --die-with-parent \
    --hostname 99d22c77309f \
    --unshare-user --unshare-all \
    --tmpfs / \
    --ro-bind /bin /bin \
    --dev /dev \
    --dev-bind /dev/dri /dev/dri \
    --ro-bind /etc /etc \
    --tmpfs /home/jakob \
    --tmpfs /home/jakob/.wine \
    --ro-bind /lib /lib \
    --ro-bind /lib32 /lib32 \
    --ro-bind /lib64 /lib64 \
    --proc /proc \
    --ro-bind /sys /sys \
    --tmpfs /tmp \
    --ro-bind /usr /usr \
    --clearenv \
    --setenv HOME /home/jakob \
    --setenv HOSTNAME 99d22c77309f \
    --setenv PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/games:/usr/libexec/xscreensaver:/usr/lib/wine \
    --setenv TERM xterm-256color \
    --setenv USER x \
    --setenv container sandwine \
    -- \
    sh -c 'wineserver -p0 && "$0" "$@" ; ret=$? ; wineserver -k ; exit ${ret}' \
    true
true: 1: wineserver: not found
true: 1: wineserver: not found
hartwork commented 6 months ago

Hi @MausKaffee34767,

I think it's arguable whether that's a crash when the is no backtrace, the verbose output is there by default. To me it looks like you do not have Wine installed but are running sandwine without --no-wine. Before I start patching things in to change the situation, I would like to ask what output and behavior you would expect from sandwine as a user with no Wine installed starting sandwine.

Best, Sebastian

cadrian commented 3 weeks ago

Hello,

I have exactly the same problem even though I do have wine installed:

$ wineserver -version
Wine 9.0

I am running Debian testing with Wine stable from winehq.

What am I missing?

Thanks

hartwork commented 3 weeks ago

@cadrian interesting! I'm starting to think that Wine could be installed in your system at a location that is not covered by the "usual system locations" that are mounted with bwrap. Could you share the output of which -a wineserver and lsb_release -a?

cadrian commented 3 weeks ago

Here it is:

$ which -a wineserver
/usr/bin/wineserver
/bin/wineserver
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:    n/a
Codename:   trixie

Note that /bin is a symlink to /usr/bin, hence the first output.

Apart from that, I did nothing fancy except installing the package from winehq instead of the native package from debian.

hartwork commented 3 weeks ago

@cadrian I guess the question is where the rest of the Wine files live. I would check the file listing of their Debian packages but https://dl.winehq.org/wine-builds/debian/dists/trixie/main/binary-amd64/ shows many different versions. Which of those debs do you have installed? E.g. if it turns out that most of the package lives in say /opt that would be the reason it's not already working.

cadrian commented 3 weeks ago

Here is the list of installed wine packages:

$ sudo apt list --installed | grep wine

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

carla-bridge-wine32/focal,focal,now 5:2.6.0~git20240921-1kxstudio1 all [installed]
carla-bridge-wine64/focal,focal,now 5:2.6.0~git20240921-1kxstudio1 all [installed]
carla-vst-wine/focal,now 5:2.6.0~git20240921-1kxstudio1 amd64 [installed]
wine-stable-amd64/testing,now 9.0.0.0~trixie-1 amd64 [installed]
wine-stable-i386/testing,now 9.0.0.0~trixie-1 i386 [installed]
wine-stable/testing,now 9.0.0.0~trixie-1 amd64 [installed]
wineasio-amd64/focal,now 5:1.2.0b-4kxstudio1 amd64 [installed]
wineasio-data/focal,focal,now 5:1.2.0b-4kxstudio1 all [installed]
wineasio-i386/focal,now 5:1.2.0b-4kxstudio1 amd64 [installed]
wineasio/focal,now 5:1.2.0b-4kxstudio1 amd64 [installed]
winehq-stable/testing,now 9.0.0.0~trixie-1 amd64 [installed]

And yes, I see wine directories in /opt

cadrian commented 3 weeks ago

Yep. Maybe the explanation:

$ ls -l /usr/bin/wineserver 
lrwxrwxrwx 1 root root 31 18 janv.  2024 /usr/bin/wineserver -> /opt/wine-stable/bin/wineserver
hartwork commented 3 weeks ago

@cadrian could you try add --pass /opt/wine-stable:ro during invocation of sandwine and report back how it went?

cadrian commented 3 weeks ago

It worked! Thank you.

hartwork commented 2 weeks ago

@cadrian perfect, thanks for trying and the update! There may be ways to make it work out of the box with Wine upstream Debian packages. I will need to sleep over it.

hartwork commented 2 weeks ago

It worked! Thank you.

@cadrian could you check if pull request #68 makes things work out of the box for you (i.e. without passing --pass /opt/wine-stable:ro explicitly)?

cadrian commented 2 weeks ago

@hartwork It would be my pleasure, for sure.

I checked out the PR. But how do I build or run locally? There is not any build file or launcher I can recognize :'(

Thanks

hartwork commented 2 weeks ago

@cadrian here's two ways that levarage Python virtualenvs:

a)

# cd "$(mktemp -d)"
# python3 -m venv venv
# source venv/bin/activate
# git clone --depth 1 --branch issue-55-support-wine-upstream-debian-packages https://github.com/hartwork/sandwine
# pip3 install -e sandwine/ 
# sandwine --help

b)

# cd "$(mktemp -d)"
# python3 -m venv venv
# source venv/bin/activate
# pip3 install git+https://github.com/hartwork/sandwine@issue-55-support-wine-upstream-debian-packages
# sandwine --help
hartwork commented 2 weeks ago

@cadrian did it work out?

hartwork commented 2 weeks ago

@cadrian I was now able to test on Debian myself and all of winehq-devel, winehq-staging and winehq-stable now worked out of the box on Debian bookworm. And that made me merge.

hartwork commented 2 weeks ago

@cadrian …and release 4.3.0 is out now with that new feature.

cadrian commented 1 week ago

Sorry I could not answer earlier. Real life got in the way… I'll try as soon as I can. Thanks for your work.