Solved linuxulator switching to non root user in the chroot to run davinci resolve

ding ding, round 3

i disabled linux and enabled ubuntu in my rc.conf

Code:
linux_enable="NO"
ubuntu_enable="YES"

edited my freebsd fstab

/etc/fstab

Code:
# Device        Mountpoint    FStype    Options        Dump    Pass#
/dev/gpt/efiboot0        /boot/efi    msdosfs    rw        2    2
/dev/nda0p3.eli        none    swap    sw        0    0
# linux
proc                            /proc           procfs  rw      0       0
#linprocfs                       /compat/linux/proc    linprocfs    rw    0    0
#linsysfs                        /compat/linux/sys    linsysfs    rw    0    0
# ubuntu
devfs           /compat/ubuntu/dev      devfs           rw,late                      0       0
tmpfs           /compat/ubuntu/dev/shm  tmpfs           rw,late,size=1g,mode=1777    0       0
fdescfs         /compat/ubuntu/dev/fd   fdescfs         rw,late,linrdlnk             0       0
linprocfs       /compat/ubuntu/proc     linprocfs       rw,late                      0       0
linsysfs        /compat/ubuntu/sys      linsysfs        rw,late                      0       0
/tmp            /compat/ubuntu/tmp      nullfs          rw,late                      0       0
/home           /compat/ubuntu/home     nullfs          rw,late                      0       0

rebooted

logged in the chroot as root

Code:
sudo chroot /compat/ubuntu /bin/bash

then installed the needed packages

Code:
apt install nvidia-driver-535 nvidia-cuda-toolkit ocl-icd-opencl-dev libglu1-mesa libfuse2 initramfs-tools

no errors

but when i run nvidia-smi in the chroot

Code:
nvidia-smi

i get this error

Code:
Failed to initialize NVML: Driver/library version mismatch
NVML library version: 535.154

which is weird because i installed nvidia-driver-535 in the chroot
which is the same version as on the host

nvidia-smi on freebsd

Code:
nvidia-smi

output

Code:
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.146.02             Driver Version: 535.146.02   CUDA Version: N/A      |
|-----------------------------------------+----------------------+----------------------+
| 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   55C    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                                                           |
+---------------------------------------------------------------------------------------+
[

i set home to nullfs in freebsd fstab
but it doesnt show the contents of the home directory on the freebsd host

maybe missing something
 
blacklisted the Nouveau nvidia driver

Code:
vi /etc/modprobe.d/blacklist-nvidia-nouveau.conf

added the following code

Code:
blacklist nouveau
options nouveau modeset=0

update-initramfs

Code:
update-initramfs -u

these are the steps i had to use when i was running ubuntu on this laptop

still get this error

Code:
Failed to initialize NVML: Driver/library version mismatch
NVML library version: 535.154
 
I see some errors related to a bad installation of the nvidia-driver. On the Linuxulator you should install the same nvidia driver version that you have on FreeBSD and for this you should install it using my method. My method install only the libraries and it allows to get the exact version you need. Installing it using ubuntu apt is not flexible the same.
 
the nvidia version on freebsd is

Driver Version: 535.146.02

on ubuntu the version is

NVML library version: 535.154

so that seem to be the issue

i also need to work out how to use nullfs to access freebsd home directory from ubuntu
 
looks like there is a slight mismatch between the nvidia-graphics-drivers-535 on freebsd and ubuntu

i dont know if its possible to add a repo on ubuntu to add a specific version of the nvidia driver

otherwise the solution looks like you will have to manually download the driver


ziomario code

Code:
TMPDIR=/home/user/TMP ./NVIDIA-Linux-x86_64-535.146.02.run \
    --install-compat32-libs \
    --no-nvidia-modprobe --no-backup --no-kernel-module \
    --no-x-check --no-nouveau-check \
    --no-cc-version-check --no-kernel-module-source \
    --no-check-for-alternate-installs \
    --install-libglvnd --skip-depmod --no-systemd
 
ubuntu jammy has the correct version of the nvidia driver 535.146.02
to match the one on the freebsd host

the problem is jammy has 700 permissions for /bin/bash
so you can only run everything as root

so i installed focal and thought maybe if i upgrade from focal to jammy it might work
no luck

when you upgrade focal to jammy the permissions on /bin/bash get changed to 700
obviously a bug with jammy and the linuxulator

i see Alain De Vos has come across the same problem with Debian bookworm

 
no problem mate
just wish i had better news about getting resolve working

basically the problem is as follows

you need the same nvidia driver in the chroot as on the host

ubuntu jammy has the matching nvidia driver we need version 535.146.02
but jammy and debian bookworm both seem to have 700 permissions on binaries like /bin/bash

so you can only run as root in the chroot
that would mean running resolve as root which isnt a good idea

looks like ubuntu and debian are a dead end

i was wondering if we could use create an arch linux chroot
because there is a resolve package on arch aur

arch wiki resolve

so you wouldnt have to use the makeresolvedeb script

there is a talk from Charlie Li about setting up an arch chroot


there are 2 freebsd pacman packages

Code:
pkg search pacman

archlinux-pacman-6.0.2 Package manager from Arch Linux
pacman-6.0.2 Package manager from Arch Linux

i came across this project on github a couple of hours ago

Arch Linux Compat on FreeBSD


heres the tutorial page


arch linux rc.d script


the github page says the project has been tested on

FreeBSD 13.2
FreeBSD 14.0-BETA4
FreeBSD 14.0-RC1
FreeBSD 14.0-RC2
FreeBSD 14.0
FreeBSD 14.0-p3
FreeBSD 14.0-p4
FreeBSD 15-CURRENT

so it looks like its possible to create an arch chroot
the only question is if arch has the matching version of the nvidia driver

i havent tried using the steps project yet

i thought id post the links to the project,
so we could get some peer review on the steps outlined to see if they the proper way to create an arch chroot
 
---> looks like ubuntu and debian are a dead end

at all. I'm using ubuntu 22.04 and ubuntu 23.10 on the Linuxulator and I don't get your error.
 
---> looks like ubuntu and debian are a dead end

at all. I'm using ubuntu 22.04 and ubuntu 23.10 on the Linuxulator and I don't get your error.

HI Mate, are you running as root or a non root account in the chroot

if i run these steps jammy has 700 permissions on /bin/bash

create the mount points

Code:
sudo mkdir -p {/compat/ubuntu/dev/fd,/compat/ubuntu/dev/shm,/compat/ubuntu/home,/compat/ubuntu/tmp,/compat/ubuntu/proc,/compat/ubuntu/sys}

debootstrap

Code:
sudo debootstrap --arch=amd64 --no-check-gpg jammy /compat/ubuntu

list ubuntu

Code:
ls /compat/ubuntu/bin/bash

output

Code:
-rwx------  1 root wheel 964536 09 Feb  2024 /compat/linux/bin/bash

list /compat/linux

Code:
ls /compat/linux/bin/bash

ouput

Code:
-rwxr-xr-x  1 root wheel 964536 24 Nov  2021 /compat/linux/bin/bash

if i install focal the permission are correct
but if upgrade to jammy the permission on /bin/bash get changed to 700

i have been through all the options with debootstrap and none of them fix the issue
 
Can you look into using Rocky? That's where I'm running DaVinci right now.

that would probably be a better idea than using arch
its just a matter of figuring out how to install rocky

there is actually a Rocky Linux ISO release by resolve
from the Linux_Installation_Instructions.pdf including in the resolve download zip

Installing DaVinci Resolve’s Rocky Linux ISO

For users setting up new systems or looking to use a standardized DaVinci Resolve environment, a standard Rocky Linux 8.6 ISO is
available to download at:

(MD5: https://downloads.blackmagicdesign.com/DaVinciResolve/DaVinci-Resolve-Linux-RockyLinux_8.6.txt).

The installer takes care of all dependencies - including standard libraries, Nvidia drivers and DeckLink drivers. When the installation is
complete, you can reboot the system once, and download and install DaVinci Resolve using the instructions above. When upgrading
DaVinci Resolve, please check this section in the new installer for any special instructions you may need for the new version

just wondering if you mount the iso and extract into the chroot
maybe not that would be too easy
 
bash on my Ubuntu 22.10 and 23.10 has permissions 777 and I can start programs as a normal user. I can switch from root to the normal user with : su - user

Screenshot_2024-02-10_00-50-34.jpg
 
are the steps you are using to install ubuntu any different from mine

the only other thing i can think of is that i have /compat/linux installed
just wondering if that causes some kind of conflict with ubuntu jammy
 
i tried installing ubuntu in /usr/local/compat/ubuntu

which is what Charlie Li is doing in the video i posted,
difference is he is use arch

create the chroot directories

Code:
sudo mkdir -p {/usr/local/compat/ubuntu/dev/fd,/usr/local/compat/ubuntu/dev/shm,/usr/local/compat/ubuntu/home,/usr/local/compat/ubuntu/tmp,/usr/local/compat/ubuntu/proc,/usr/local/compat/ubuntu/sys}

debootstrap

Code:
sudo debootstrap --arch=amd64 --no-check-gpg jammy /usr/local/compat/ubuntu

list /bin/bash in the chroot

Code:
ls -l /usr/local/compat/ubuntu/bin/bash

output

Code:
-rwx------  1 root wheel 1396520  6 Jan  2022 /usr/local/compat/ubuntu/bin/bash

same result 700 permissions
 
you could try to reinstall the linuxulator on /compat/linux or better,make a fresh installation of FreeBSD (the version that you are running on your PC) then copy and paste /compat/linux to your current FreeBSD system...
 
/compat/linux is fine just was trying to exclude it as a cause of the issue

running debootstrap with no options still sets the permissions to 700

Code:
sudo debootstrap jammy /usr/local/compat/ubuntu

run after creating the mount points obviously

i have also tried

Code:
--variant=buildd

and

Code:
--no-merged-usr

installing focal which doesnt have the issue then upgrading to jammy sets the permissions on /bin/bash 700

debootstrap is a standalone program so i cant think of anything else on the system that is causing the issue

i should have called this post my struggle
but that doesnt translate well into German

post with a similar issue


"All files installed by debootstrap had rwx------ permissions, therefore any user except root can't execute any command!
Giving execute permission to programs and libs fix this."
 
changing the permissions on /bin/bash to add group access lets you use su - username to switch user

but then commands like ls still give you permission denied
so the only solution is to correct the permissions on all binaries and libs so that a non root user has access
 
I didn't use linuxator on FreeBSD for more than 10 years. Just my 2c: There's absolutely no reason for bash to have permissions 700. Not in the emulated word, not in the real Linux world.
What is your umask settings when you use debootstrap? Nevertheless, why don't you just change the permissions to 755 as one would expect it to be ?
 
your right the permissions shouldnt be 700
bash only has 700 permissions on jammy but not on focal

i was trying to find the cause of the issue,
changing the permissions will hopefully fix the issue
 
also you dont need to edit your freebsd fstab and add the mount points for ubuntu
the ubuntu rc.d script does that automatically

as pointed out by SirDice

"You can remove the filesystems from fstab, they'll get automatically mounted when /etc/rc.d/linux is started nowaday"

in this post


enabling the ubuntu service mounts all the mount points

Code:
sudo sysrc linux_enable="NO"
sudo sysrc ubuntu_enable="YES"
sudo service ubuntu start
mount

output

Code:
devfs on /compat/linux/dev (devfs)
fdescfs on /compat/linux/dev/fd (fdescfs)
tmpfs on /compat/linux/dev/shm (tmpfs, local)
devfs on /compat/ubuntu/dev (devfs)
fdescfs on /compat/ubuntu/dev/fd (fdescfs)
tmpfs on /compat/ubuntu/dev/shm (tmpfs, local)
/home on /compat/ubuntu/home (nullfs, local, noatime, nfsv4acls)
linprocfs on /compat/ubuntu/proc (linprocfs, local)
linsysfs on /compat/ubuntu/sys (linsysfs, local)
/tmp on /compat/ubuntu/tmp (nullfs, local, noatime, nosuid, nfsv4acls)
fdescfs on /dev/fd (fdescfs)

however i do notice these 3 lines

Code:
devfs on /compat/linux/dev (devfs)
fdescfs on /compat/linux/dev/fd (fdescfs)
tmpfs on /compat/linux/dev/shm (tmpfs, local)

so maybe you do need to edit your some of your fstab
will have to check that out
 
because jammy has the nvidia 535.146.02 driver
which is the same version of the driver on the freebsd host

focal doesnt have a matching driver
so when you run nvidia-smi in the focal chroot it fails

because the focal nvidia driver has a mismatch
 
I have upgraded ubuntu 22.04 to 23.04 and 23.04 to 23.10 because 22.04 became too old. And on the host and on the linuxulator I have installed the nvidia driver : 535.146.02 using "my" method.
 
Back
Top