Solved waypipe display linuxulator wayland applications running in a chroot on freebsd

waypipe is x-forwarding for wayland

whats really cool is you can use waypipe to forward a wayland application running in a linuxulator choot
to freebsd on the same machine running wayland using waypipe sockets in the tmp dir of the chroot

i have wayland set up on both freebsd and the ubuntu chroot
and environmental variables in a ~/.zshenv file in the chroots home directory to launch qt5 applications using wayland

install waypipe on both freebsd and ubuntu in the choot

freebsd install waypipe

Code:
sudo pkg install waypipe

ubuntu install waypipe

Code:
sudo apt install waypipe

heres the trick

on the freebsd host

create the client socket in the ubuntu chroot tmp directory
from the freebsd host as your regular user, ie not as root

Code:
waypipe --socket /compat/ubuntu/tmp/waypipe.sock client &

in the ubuntu chroot

create the server socket that matches the same path as the client socket in the tmp directory
and specify an application to launch as the last argument to the command

again run the command as your user in the chroot, not as root
and because you can map id of your user on freebsd to the user in the chroot they can both access the socket
without any permission issues

Code:
waypipe --socket /tmp/waypipe.sock server qt5ct

in this case open qt5ct and use waypipe to display the application on freebsd

heres a screen shot of qt5ct launched from the chroot with waypipe
and displayed on the freebsd host running wayland using wlroots and the dwl wayland tiling window manager

waypipe.png


i think this also use the gpu and works with video as well

another idea is that you could perhaps use the same idea of creating sockets in the chroots tmp directory with pulseaudio

so on the freebsd host you start pulseaudio and create the pulseaudio socket in the chroots tmp directory
and then pipe the audio from applications in the chroot into that socket

waypipe


waypipe notes


ubuntu mantic linuxulator wayland set up

 
instead of launching linux apps from freebsd
and having to fix all the library paths and do lots of work around like with resolve

you might be able to launch the application in the chroot

and forward the display with either waypipe or x11 sockets
and the audio with a pulseaudio socket in the chroot tmp directory

pipewire also works with pulse audio on linux
 
trying to launch davinci resolve in a ubuntu chroot and forward the display with waypipe

im getting an error which isnt related to waypipe

Code:
/opt/resolve/bin/resolve: error while loading shared libraries: libc++.so.1: cannot open shared object file: No such file or directory


The missing symbol (_ZTVNSt3__14__fs10filesystem16filesystem_errorE) is part of libc++.so.1 which is present in the install but not within the /opt/resolve/libs path.
It can be found in opt/resolve/BlackmagicRAWPlayer/BlackmagicRawAPI or opt/resolve/BlackmagicRAWSpeedTest/BlackmagicRawAPI. Copy or link it from there to /opt/resolve/libs or start resolve with an LD_PRELOAD.
LD_PRELOAD=/opt/resolve/BlackmagicRAWPlayer/BlackmagicRawAPI/libc++.so.1 /opt/resolve/bin/resolve

the ld preload doesnt work

freebsd
create the client socket in the ubuntu chroot tmp directory from the freebsd host

Code:
waypipe --socket /compat/ubuntu/tmp/waypipe.sock client &

ubuntu chroot
start waypipe socket

Code:
waypipe --socket /tmp/waypipe.sock server /opt/resolve/bin/resolve

 
getting this error now which i have seen before

Code:
/opt/resolve/bin/resolve: symbol lookup error: /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0: undefined symbol: g_string_free_and_steal

i seem to attract more bugs than a fly zapper

fix for the above issue

Code:
cd /opt/resolve/libs
sudo mv libglib-2.0.so.0 libglib-2.0.so.0.bak
sudo cp /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 /opt/resolve/libs/

now on to the next error

Code:
ActCCMessage Already in Table: Code= c005, Mode= 13, Level=  1, CmdKey= -1, Option= 0
ActCCMessage Already in Table: Code= c006, Mode= 13, Level=  1, CmdKey= -1, Option= 0
ActCCMessage Already in Table: Code= c007, Mode= 13, Level=  1, CmdKey= -1, Option= 0
ActCCMessage Already in Table: Code= 2282, Mode=  0, Level=  0, CmdKey= 8, Option= 0
PnlMsgActionStringAdapter Already in Table: Code= 615e, Mode=  0, Level=  0, CmdKey= -1, Option= 0
QSocketNotifier: Can only be used with threads started with QThread
log4cxx: No appender could be found for logger (UI).
log4cxx: Please initialize the log4cxx system properly.
18.6.5.0007 Linux/Clang x86_64
Main thread starts: 35BFD200
log4cxx: setFile(./logs/rollinglog.txt,true) call failed.
log4cxx: IO Exception : status code = 2
0x835bfd200    | Undefined            | INFO  | 2024-02-18 15:12:14,059 | --------------------------------------------------------------------------------
log4cxx: No output stream or file set for the appender named [RollLogAppender].
0x835bfd200    | Undefined            | INFO  | 2024-02-18 15:12:14,059 | Loaded log config from /home/djwilcox/.local/share/DaVinciResolve/configs/log-conf.xml
0x835bfd200    | Undefined            | INFO  | 2024-02-18 15:12:14,059 | -------------------------------------------------------------------------

error log

Code:
0x835bfd200    | Main                 | INFO  | 2024-02-18 16:03:22,942 | Running DaVinci Resolve v18.6.5.0007 (Linux/Clang x86_64)
0x835bfd200    | Main                 | INFO  | 2024-02-18 16:03:22,942 | BMD_BUILD_UUID 85ec0694-b733-45ba-8252-40a14dc7c1fa
0x835bfd200    | Main                 | INFO  | 2024-02-18 16:03:22,943 | BMD_GIT_COMMIT f7c6e119fb00645af5ac45a149d4552aeaa8b0a3
0x835bfd200    | GPUDetect            | INFO  | 2024-02-18 16:03:22,943 | Starting GPUDetect 1.2_5-a6
0x835bfd200    | GPUDetect            | ERROR | 2024-02-18 16:03:22,945 | Unable to connect to XOrg display.
0x835bfd200    | GPUDetect            | ERROR | 2024-02-18 16:03:23,011 | X11 logs not found.
0x835bfd200    | GPUDetect            | ERROR | 2024-02-18 16:03:23,044 | No matched GPUs found.
0x835bfd200    | Main.GPUConfig       | INFO  | 2024-02-18 16:03:23,044 | Compute API set to automatic, defaulting to Unknown.
0x835bfd200    | Main.GPUConfig       | INFO  | 2024-02-18 16:03:23,044 | Unsupported API Unknown, defaulting to Unknown.
0x835bfd200    | Main.GPUConfig       | ERROR | 2024-02-18 16:03:23,044 | Failed to select a valid compute API.
0x835bfd200    | Main.GPUConfig       | INFO  | 2024-02-18 16:03:23,044 | Automatic GPU Selection:
0x835bfd200    | Main.GPUConfig       | ERROR | 2024-02-18 16:03:23,044 |   No GPUs selected!
0x835bfd200    | IO                   | INFO  | 2024-02-18 16:03:23,044 | RED InitializeSdk with library path at /opt/resolve/libs
0x835bfd200    | IO                   | INFO  | 2024-02-18 16:03:23,084 | R3DAPI 8.4.0-53216 (20230817 Lx64S) R3DSDK 8.4.0-53216 (20230817 Lx64D C3B1) [/opt/resolve/libs/] init is successful
0x835bfd200    | Main                 | INFO  | 2024-02-18 16:03:23,085 | 0 RED rocket cards available
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
0x835bfd200    | Main                 | INFO  | 2024-02-18 16:03:23,085 | Decklink model name: '', version: ''
0x835bfd200    | DVIP                 | INFO  | 2024-02-18 16:03:23,085 | DVIP release/18.6.5 build 16 (d48fe17e4287b761de7bec34f161b1d5e722085b). Release, version 18.6.5.
0x8aaab9680    | IO                   | INFO  | 2024-02-18 16:03:23,085 | Using DNxHR library v2.7.3.27r
0x8b043b680    | SyManager            | ERROR | 2024-02-18 16:03:23,215 | GetProjectLibraries() - Access token is empty
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, xcb.

0x8aa2b8680    | Fusion               | INFO  | 2024-02-18 16:03:23,340 | Fusion Build: b60ff9f0_0005 (Jan 23 2024 13:00:17)

looks like its not finding the gpu
and maybe a wayland issue as well for good measure
 
---> i seem to attract more bugs than a fly zapper

ahahahaha. its not your fault...I've attracted the same bugs.
 
Don't forget to run this script :

Code:
bash << EOF
LD_PRELOAD=/home/marietto/Files/dummy-uvm.so /opt/resolve/bin/./resolve
EOF

resolve needs dummy-uvm.so inside the linuxulator to detect the gpu.
 
gotcha

had to rename the file instead of unzipping it
just in case anyone else downloads the attachment

Code:
mv dummy-uvm.zip dummy-uvm.so

ill see what happens using that file
 
seems like its detecting the gpu now

Code:
0x8361f7200    | Main                 | INFO  | 2024-02-18 17:05:57,661 | Running DaVinci Resolve v18.6.5.0007 (Linux/Clang x86_64)
0x8361f7200    | Main                 | INFO  | 2024-02-18 17:05:57,661 | BMD_BUILD_UUID 85ec0694-b733-45ba-8252-40a14dc7c1fa
0x8361f7200    | Main                 | INFO  | 2024-02-18 17:05:57,661 | BMD_GIT_COMMIT f7c6e119fb00645af5ac45a149d4552aeaa8b0a3
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,661 | Starting GPUDetect 1.2_5-a6
0x8361f7200    | GPUDetect            | ERROR | 2024-02-18 17:05:57,663 | Unable to connect to XOrg display.
0x8361f7200    | GPUDetect            | ERROR | 2024-02-18 17:05:57,704 | X11 logs not found.
0x8361f7200    | GPUDetect            | ERROR | 2024-02-18 17:05:57,734 | No Main Display GPU found and no monitors found to match, defaulting to gpu:379170ec.cd75a979.
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,734 | Done in 73 ms.
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,734 | Detected System:
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,734 |   - OS: Linux Ubuntu 23.10
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,734 |   - System ID: dd92eabd8b674313baea5b72eeb36d83
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,734 |   - CPU: Intel Core i7-9750H, 12 threads, x86-64
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,735 | Detected 1 GPUs:
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,735 |   - "NVIDIA GeForce GTX 1650" (gpu:379170ec.cd75a979) <- Main Display GPU
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,735 |     Discrete, 3.8 GiB VRAM, PCI:1:0
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,735 |     Matches: CUDA, NVML, OpenCL
0x8361f7200    | GPUDetect            | INFO  | 2024-02-18 17:05:57,735 | Detected 0 monitors:
0x8361f7200    | Main.GPUConfig       | INFO  | 2024-02-18 17:05:57,735 | Compute API set to automatic, defaulting to CUDA.
0x8361f7200    | Main.GPUConfig       | INFO  | 2024-02-18 17:05:57,735 | Selected compute API: CUDA
0x8361f7200    | Main.GPUConfig       | INFO  | 2024-02-18 17:05:57,735 | Automatic GPU Selection:
0x8361f7200    | Main.GPUConfig       | INFO  | 2024-02-18 17:05:57,735 |   - "NVIDIA GeForce GTX 1650" (gpu:379170ec.cd75a979)
0x8361f7200    | IO                   | INFO  | 2024-02-18 17:05:57,735 | RED InitializeSdk with library path at /opt/resolve/libs
0x8361f7200    | IO                   | INFO  | 2024-02-18 17:05:57,880 | R3DAPI 8.4.0-53216 (20230817 Lx64S) R3DSDK 8.4.0-53216 (20230817 Lx64D C3B1) RED CUDA 8.4.0-53119 (20230817) [/opt/resolve/libs/] init is successful
0x8361f7200    | Main                 | INFO  | 2024-02-18 17:05:57,880 | 0 RED rocket cards available
libDeckLinkAPI.so: cannot open shared object file: No such file or directory
0x8361f7200    | Main                 | INFO  | 2024-02-18 17:05:57,880 | Decklink model name: '', version: ''
0x8361f7200    | DVIP                 | INFO  | 2024-02-18 17:05:57,880 | DVIP release/18.6.5 build 16 (d48fe17e4287b761de7bec34f161b1d5e722085b). Release, version 18.6.5.
0x8e4808680    | IO                   | INFO  | 2024-02-18 17:05:57,880 | Using DNxHR library v2.7.3.27r
0x8ea23b680    | SyManager            | ERROR | 2024-02-18 17:05:58,008 | GetProjectLibraries() - Access token is empty
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, xcb.

maybe wayland issue is the final piece of the puzzle

qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, xcb.
 
you could also add this to your ~/.zshenv in the chroot

Code:
export LD_PRELOAD=/home/djwilcox/.config/gpu/dummy-uvm.so

so you dont have to run it every time
which is the location of the dummy-uvm.so in the chroot

not sure why resolve isnt launching

i can launch qt5ct which is also a qt wayland application
so not sure what the issue is

wayland settings in ~/.zshenv in the chroot

Code:
# wayland
export XDG_SESSION_TYPE=wayland
export WAYLAND_DISPLAY=wayland-0

# qt5
export QT_QPA_PLATFORMTHEME=qt5ct
export QT_QPA_PLATFORM=wayland
 
the davinci log

Code:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, xcb.

looks like a qt wayland issue

maybe missing a package for wayland in the chroot
 
of course

on ubuntu blank

on freebsd

:0

setting the DISPLAY=:0
in the chroot didnt do anything


You can't run DaVinci Resolve out of the Linuxulator,because it is not a native FreeBSD tool,I mean,it is not installable via ports or package ; instead Blender it is,OBS it is... so it can work only inside the Linuxulator.

I'm not sure if it could work if you bring out all the configuration and system files of Resolve out of the Linuxulator. Maybe it can work,but with anoher script,this :


Code:
bash << EOF
xhost +
env LD_LIBMAP="`nv-sglrun printenv LD_LIBMAP | grep -v libGL`" /compat/ubuntu2310/opt/resolve/bin/./resolve
EOF


not sure at all if it will work. It doesn't for me.
 
hi mate, thats similar to what i use with obs studio in a desktop entry

Code:
Exec=sh -c 'LD_LIBMAP="`nv-sglrun printenv LD_LIBMAP | grep -v libGL`" obs'

i dont know if the issue is that davinci resolve doesnt support "pure wayland"
and only works with xwayland

ive tried googling but cant seem to find an answer

which i think means qt would use xcb
and you would have to use x11 sockets

i did a little experiment and installed wayland-utils on ubuntu in the chroot

Code:
sudo apt install wayland-utils

this installs a package called wayland-info
which displays information about the wayland session

when i run wayland-info in the chroot

Code:
wayland-info

failed to create display: No such file or directory

but if i use waypipe with wayland-info in the chroot
like this

on the freebsd host

Code:
waypipe --socket /compat/ubuntu/tmp/waypipe.sock client &

and then on ubuntu in the chroot

Code:
waypipe --socket /tmp/waypipe.sock server /usr/bin/wayland-info

it outputs this

Code:
interface: 'xwayland_shell_v1',                          version:  1, name: 30
interface: 'wl_output',                                  version:  4, name: 31
        name: eDP-1
        description: SHP 0x14BA (eDP-1)
        x: 0, y: 0, scale: 1,
        physical_width: 340 mm, physical_height: 190 mm,
        make: 'SHP', model: '0x14BA',
        subpixel_orientation: unknown, output_transform: normal,
        mode:
                width: 1920 px, height: 1080 px, refresh: 59.999 Hz,
                flags: current
interface: 'wl_output',                                  version:  4, name: 32
        name: DP-3
        description: Ancor Communications Inc VE247 FALMQS050176 (DP-3 via HDMI)
        x: 0, y: 0, scale: 1,
        physical_width: 530 mm, physical_height: 300 mm,
        make: 'Ancor Communications Inc', model: 'VE247',
        subpixel_orientation: unknown, output_transform: normal,
        mode:
                width: 1920 px, height: 1080 px, refresh: 60.000 Hz,
                flags: current
[


and in the davinci log

Code:
0x8361f7200    | GPUDetect            | ERROR | 2024-02-18 19:25:00,020 | Unable to connect to XOrg display.
0x8361f7200    | GPUDetect            | ERROR | 2024-02-18 19:25:00,064 | X11 logs not found.
0x8361f7200    | GPUDetect            | ERROR | 2024-02-18 19:25:00,098 | No Main Display GPU found and no monitors found to match, defaulting to gpu:379170ec.cd75a979.

1 - resolve doesnt detect xorg

maybe i need to install xorg in the chroot as well as wayland

2 - No Main Display GPU found and no monitors found to match
 
rather than using waypipe
we create a new Xwayland rootfull window on freebsd

Code:
Xwayland :01

that opens a blank window with a display id of :01

then in the chroot in a ~/.zshenv file we add

Code:
export DISPLAY=:1

then in the chroot we open an application

Code:
/opt/resolve/bin/resolve
 
Back
Top