jails running linux wayland apps in a ubuntu jail

ive been experimenting with running linux wayland apps in an ubuntu jail

the jail is running ubuntu mantic with the nvidia drivers manually installed
so they match the version on the freebsd host

wayland enabled in the jails ~/.zshenv config

Code:
export WAYLAND_DISPLAY=wayland-0
export QT_QPA_PLATFORM=wayland
export GDK_BACKEND=wayland

running a simple application like qt5ct displays the window on the freebsd host running labwc

20240422_19h20m15s_grim.png


so i thought id try running obs studio in the jail

i have pulseaudio working using a socket in /tmp which is mounted in the jail
and the /dev/dri, /dev/drm and /dev/nvidia* exposed to the jail using devfs_rules

so the jail can use the gpu on the host

opening obs studio with error message saying obs is running which it isnt

20240422_19h20m31s_grim.png



obs studio nvenc encoding enabled

20240422_19h20m53s_grim.png


i had to build and install wlrobs on ubuntu to enable wayland screen capture
but i just get a black window

20240422_19h21m08s_grim.png



i have the xdg-portal-wlroots installed
maybe an issue with the portal and dbus

so i need to figure out why the display is black

next i thought id try running firefox

so i installed firefox as a deb using this guide


however when i try and run firefox as a wayland application
i get an empty window with this error message

Code:
[GFX1-]: glxtest: DRM device has no render node
[GFX1-]: glxtest: Cannot find DRM device

so i exported the drm render in the zshenv

Code:
export MOZ_DRM_DEVICE=/dev/dri/renderD128

i actually managed to get firefox to open once and play a video on youtube with the audio working
but havent managed to get it to work again

firefox empty transparent window
with window i use for taking screenshots in the foreground

20240422_19h21m39s_grim.png


if you need a version of obs studio to record just a black screen then look no further

and if you want a super secure browser thats impossible to spy on
i present firefox invisible mode
 
managed to get pulseaudio working with obs studio running in an ubuntu jail

i have pulseaudio set up on freebsd so it creates a pulseaudio socket in the /tmp directory
and the /tmp directory is mounted in the jail which lets you route the audio from the jail to the host

i created a media scene in obs studio and added the url for a mp4 video
after editing the advanced audio properties and enabling monitoring and output the audio from the media scene plays on the freebsd host

but there is no video displayed in the obs preview window
you will see the audio mixer - media source showing the audio levels

20240422_21h41m59s_grim.png
 
obs media source running in an ubuntu jail with working audio and video

i managed to get the video working by unsetting some variables i use for davinci resolve in the ~/.zshenv

Code:
#export __NV_PRIME_RENDER_OFFLOAD=1
#export __GLX_VENDOR_LIBRARY_NAME=nvidia

i still get a black screen when trying to capture the desktop though

20240422_23h33m41s_grim.png
 
launching obs in the jail with the dbus address from the host

Code:
DBUS_SESSION_BUS_ADDRESS=unix:path=/tmp/dbus-PrA66g9NtV,guid=805b5d25ddfa6d7ba51e4fe36626e000 obs

then creating an output source set to
Wayland output (scpy)

you can then capture either of the desktops
however trying to record with nvenc crashes obs

Code:
[h264_nvenc @ 0x3b5dbc0] dl_fn->cuda_dl->cuInit(0) failed -> CUDA_ERROR_OPERATING_SYSTEM: OS call failed or operation not supported on this OS

20240422_23h39m46s_grim.png



even though nvidia-smi shows cuda enabled

Code:
ubuntu% nvidia-smi
Mon Apr 22 23:48:15 2024
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 550.54.14              Driver Version: 550.54.14      CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650        Off |   00000000:01:00.0 Off |                  N/A |
| N/A   41C    P8              1W /   50W |       0MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+
 
Can you document the steps to get the audio passed from the jail to the host? I’m trying to get a jail working with desktop as well, but no audio devices are found.
 
obs recording using SVT-AV1 on ubuntu in a jail

you have to start obs studio with dbus address of the host
for the xdg-desktop-portal to let you select the display to record with obs studio

maybe there is a variable that needs to be set for obs to work with cuda

svt-avi.png



obs-recording.jpg
 
firefox running as wayland app working in ubuntu jail

it was the nvidia setting i commented out that where causing the issue with firefox

audio working with pulseaudio
window displayed on freebsd using Wayland and not Xwayland

you can see in the screenshot below i can even pop the video with picture in picture
which isnt possible using an Xwayland window

20240423_00h19m51s_grim.png


20240423_00h20m04s_grim.png
 
cheers mate,
it looks like void linux also has the nvidia proprietary drivers

and a rootfs tar that you could extract to create the file system in the jail
 
Hey,Mate. I checked your post about setup davinci resolve in Ubuntu jail.

This is very exciting but it is also not easy. Appreciate your time and patience and effort to make it work. ?

Is dual boot Linux an easier and viable alternative option to this?

I wonder what make people using FreeBSD so persistent to try wine and VM and jail to running other os in order to utilize other os features and apps.

Don’t get me wrong I really like FreeBSD as server OS as well as a general purpose desktop OS for everyday use. :)
 
The only thing makes me run Windows and MacOS and Linux is about 3-5 apps and workflows in those OS not transferable and working natively in FreeBSD.
 
Hey,Mate. I checked your post about setup davinci resolve in Ubuntu jail.

This is very exciting but it is also not easy. Appreciate your time and patience and effort to make it work. ?

Is dual boot Linux an easier and viable alternative option to this?

I wonder what make people using FreeBSD so persistent to try wine and VM and jail to running other os in order to utilize other os features and apps.
Hi Mate, to be honest installing Davinci Resolve on Linux using either Ubuntu or Fedora is a pain

There are only a couple of extra steps to install Davinci Resolve in a Jail compared to bare metal Linux,
like creating the devfs.rules, fstab and setting up pulseaudio

you should use the nvidia 535 driver on freebsd and not the 550 driver
which seems to have issues with cuda

Once you set it up resolve in the jail it works perfectly
You do need a recent Nvidia gpu and 16 gb of ram though

If you need any help installing resolve give me a shout

i think people on Freebsd try running different os's is for two reasons

1 - to run applications that arent available on Freebsd like Davinci Resolve

2 - Freebsd has the linuxulator, jails and byhve built in so it makes it easy run other os's
 
Can you document the steps to get the audio passed from the jail to the host? I’m trying to get a jail working with desktop as well, but no audio devices are found.
HI Mate, heres my notes on setting up a Ubuntu Jail with pulseaudio


pulseaudio section

 
Hi Mate, to be honest installing Davinci Resolve on Linux using either Ubuntu or Fedora is a pain

There are only a couple of extra steps to install Davinci Resolve in a Jail compared to bare metal Linux,
like creating the devfs.rules, fstab and setting up pulseaudio

Once you set it up resolve in the jail it works perfectly
You do need a recent Nvidia gpu and 16 gb of ram though

If you need any help installing resolve give me a shout

i think people on Freebsd try running different os's is for two reasons

1 - to run applications that arent available on Freebsd like Davinci Resolve

2 - Freebsd has the linuxulator, jails and byhve built in so it makes it easy run other os's

Thank you so much for sharing the guide,Mate.

I really like FreeBSD as server OS as well as a general purpose desktop OS for everyday use. :)

I would like to replace Linux and any other close source OS with really Free OS like BSD.
I use suckless softwares like dwm dmenu and st But IBM redhat is killing X11.

Systemd, PipeWire, and Wayland are all controlled by Red Hat. The decisions made by Red Hat, as a company, determine the entire software ecosystem of Linux. Such development is unhealthy; many useful software like init, PulseAudio, and X11 have been abandoned and development has ceased.

FreeBSD is the last refuge.
 
Last edited:
dwl and tofi are wayland versions of dwm and dmenu
and work really well

i made a tutorial about installing dwl
dwl doesnt have as many patches as dwm though


good article about Ubuntu 24.04 making it harder to install software with deb's

 
dwl and tofi are wayland versions of dwm and dmenu
and work really well

i made a tutorial about installing dwl
dwl doesnt have as many patches as dwm though


good article about Ubuntu 24.04 making it harder to install software with deb's

Thanks for sharing this. I do not like Ubuntu forced user to use snaps. That is like Microsoft and Apple. I would check your tutorial on dwl. Cheers ,Mate:)
 
Snaps exist to solve a problem on Linux that we dont have on Freebsd

trying to avoid dependency hell

I do not get why FreeBSD does not have dependency problems?

Pkg manager also has dependency for installing packages in FreeBSD as well?

Lot of people using Arch Linux, Arch Linux is community based, they have problem of lacking people to maintain a package.

I frequently have problems of using pacman or yay to install packages, lots of packages do not exist anymore.

I recommend try install either artix Linux (Arch without systemd) or void Linux BSD like Linux in jail.
 
I already enabled the widevine I can see the module is activated on chrome://component
But I do not know why Spotify is not working.
 
Back
Top