[Update] For new instructions targeting FreeBSD 13.0 and newer, please see:
https://forums.freebsd.org/threads/linuxulator-how-to-install-brave-linux-app-on-freebsd-13-0.78879/
Important notes:
1) Tested upon FreeBSD 12.2-RELEASE. Used Ubuntu-based linux compat instead of default CentOS one.
2) Sound, webcam, microphone, hardware acceleration all properly work. Widevine support too (Netflix, Spotify, Amazon Prime Video, HBO Max, etc).
3) The /home and /tmp directories will be shared between FreeBSD and Linux apps.
4) To successfully run Google Chrome, we rely on games/linux-steam-utils workarounds.
5) Due to all sorts of problems encountered while using /compat/ubuntu as the chroot location, I've opted to use /compat/linux instead, although it's discouraged as it conflicts with CentOS-based ports. This means you need to remove any linux-c7* port you may have and avoid installing them afterwards too.
6) I recommend (although is not a requirement as far as I know) to use a tmpfs /tmp. This is not the case when using ZFS default installation, but can be easily fixed. Assuming the ZFS pool is named "zroot":
# First reboot into single-user mode.
# Remount root filesystem as read/write:
# Destroy /tmp from zroot:
# Add entry to /etc/fstab to use tmpfs for /tmp:
# Reboot back to normal multi-user mode.
Let's begin:
# Enable linux compatibility layer:
# Start linux service:
# Install needed packages:
# Copy the useful files to a temporary folder:
# Uninstall linux-steam-utils and all its dependencies:
# Move back /usr/local/steam-utils-bak to the correct location:
# Just to be sure to start clean:
# Create necessary mount points for a working linuxulator:
# Make sure your /etc/fstab looks like this:
# Mount needed filesystems:
# Install Ubuntu 20.04 into /compat/linux:
# Fix APT package manager:
# Enable more repositories:
# Add Chrome repository:
# Fetch Chrome signing key:
# Create custom Chrome launcher script and make it executable:
# Edit it so it has this content:
# Fix broken symlink:
# Set correct timezone inside your chroot:
# Make sure everything is properly mounted:
# Chroot into your linux environment:
# Choose your timezone:
# Install some required programs (except for ttf-mscorefonts-installer which is optional):
# Install Google Chrome:
# Exit chroot
# Exit su
# Now create a .desktop file to launch Chrome as any other app:
# Make it contain something like this:
*Note: Syncing or accessing your google account won't work. It will display:
"Couldn't sign you in This browser or app may not be secure. Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in."
To fix this, change your user agent to Firefox, for instance, and login to Gmail (keep it logged in). Then change your user agent back to default and turn on sync. User-Agent Switcher and Manager extension is what worked for me ?
Also be aware that if you didn't have pulseaudio already installed on FreeBSD, a reboot may be required to get sound working within Google Chrome.
If you happen to still have sound issues, please see comment #43.
That's all!
Many thanks to Alex S. (shkhln) for his games/linux-steam-utils port, and Alexandru Hamedu (st1905) for helping in all sorts of things earlier when trying to set up a CentOS-based linuxulator.
Sources:
https://wiki.freebsd.org/LinuxJails
https://wiki.freebsd.org/LinuxApps
https://wiki.freebsd.org/Linuxulator
https://help.ubuntu.com/lts/installation-guide/armhf/apds04.html
https://github.com/AppImage/AppImageKit/issues/98
https://pastebin.com/1W9Fh3e9
EDIT 1: Replaced
EDIT 2: Reworded the point about using a tmpfs /tmp to make it clearer.
EDIT 3: Added a workaround to be able to log in to google accounts, and fix syncing.
EDIT 4: Added pulseaudio as a required package for both FreeBSD and the Ubuntu chroot. This should fix sound output in most of the cases.
EDIT 5: Added fonts-symbola to fix some missing characters.
EDIT 6: Rewrote Chrome launcher script to fix PWA (Progressive Web Apps).
EDIT 7: Added link to a fix by "mrclksr" that explains how to tell pulseaudio clients where to find sound.
https://forums.freebsd.org/threads/linuxulator-how-to-install-brave-linux-app-on-freebsd-13-0.78879/
Important notes:
1) Tested upon FreeBSD 12.2-RELEASE. Used Ubuntu-based linux compat instead of default CentOS one.
2) Sound, webcam, microphone, hardware acceleration all properly work. Widevine support too (Netflix, Spotify, Amazon Prime Video, HBO Max, etc).
3) The /home and /tmp directories will be shared between FreeBSD and Linux apps.
4) To successfully run Google Chrome, we rely on games/linux-steam-utils workarounds.
5) Due to all sorts of problems encountered while using /compat/ubuntu as the chroot location, I've opted to use /compat/linux instead, although it's discouraged as it conflicts with CentOS-based ports. This means you need to remove any linux-c7* port you may have and avoid installing them afterwards too.
6) I recommend (although is not a requirement as far as I know) to use a tmpfs /tmp. This is not the case when using ZFS default installation, but can be easily fixed. Assuming the ZFS pool is named "zroot":
# First reboot into single-user mode.
# Remount root filesystem as read/write:
mount -u /
# Destroy /tmp from zroot:
zfs destroy -f zroot/tmp
# Add entry to /etc/fstab to use tmpfs for /tmp:
printf "tmpfs\t/tmp\ttmpfs\trw,mode=1777\t0\t0\n" >> /etc/fstab
# Reboot back to normal multi-user mode.
Let's begin:
su
# Enable linux compatibility layer:
sysrc linux_enable=YES
# Start linux service:
service linux start
# Install needed packages:
pkg install linux-steam-utils debootstrap pulseaudio
# Copy the useful files to a temporary folder:
cp -R /usr/local/steam-utils /usr/local/steam-utils-bak
# Uninstall linux-steam-utils and all its dependencies:
pkg delete linux-steam-utils && pkg autoremove
# Move back /usr/local/steam-utils-bak to the correct location:
mv /usr/local/steam-utils-bak/ /usr/local/steam-utils
# Just to be sure to start clean:
rm -Rf /compat/linux
# Create necessary mount points for a working linuxulator:
mkdir -p /compat/linux/dev/fd && mkdir /compat/linux/dev/shm && mkdir /compat/linux/proc && mkdir /compat/linux/sys && mkdir /compat/linux/home && mkdir /compat/linux/tmp
# Make sure your /etc/fstab looks like this:
Code:
tmpfs /tmp tmpfs rw,mode=1777 0 0
procfs /proc procfs rw,late 0 0
fdescfs /dev/fd fdescfs rw,late 0 0
linprocfs /compat/linux/proc linprocfs rw,late 0 0
linsysfs /compat/linux/sys linsysfs rw,late 0 0
devfs /compat/linux/dev devfs rw,late 0 0
fdescfs /compat/linux/dev/fd fdescfs rw,late,linrdlnk 0 0
tmpfs /compat/linux/dev/shm tmpfs rw,late,mode=1777 0 0
/home /compat/linux/home nullfs rw,late 0 0
/tmp /compat/linux/tmp nullfs rw,late 0 0
# Mount needed filesystems:
mount -al
# Install Ubuntu 20.04 into /compat/linux:
debootstrap --arch=amd64 --no-check-gpg focal /compat/linux
# Fix APT package manager:
printf "APT::Cache-Start 251658240;" > /compat/linux/etc/apt/apt.conf.d/00aptitude
# Enable more repositories:
printf "deb http://archive.ubuntu.com/ubuntu/ focal main restricted universe multiverse" > /compat/linux/etc/apt/sources.list
# Add Chrome repository:
printf "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /compat/linux/etc/apt/sources.list.d/google-chrome.list
# Fetch Chrome signing key:
fetch -o /compat/linux/ https://dl.google.com/linux/linux_signing_key.pub
# Create custom Chrome launcher script and make it executable:
touch /compat/linux/bin/chrome && chmod +x /compat/linux/bin/chrome
# Edit it so it has this content:
Code:
#!/compat/linux/bin/bash
export CHROME_PATH="/opt/google/chrome/chrome"
export CHROME_WRAPPER="`readlink -f "$0"`"
export LD_LIBRARY_PATH=/usr/local/steam-utils/lib64/fakeudev
export LD_PRELOAD=/usr/local/steam-utils/lib64/webfix/webfix.so
export LIBGL_DRI3_DISABLE=1
exec -a "$0" "$CHROME_PATH" --no-sandbox --no-zygote --test-type --v=0 "$@"
# Fix broken symlink:
cd /compat/linux/lib64/ && rm ./ld-linux-x86-64.so.2 ; ln -s ../lib/x86_64-linux-gnu/ld-2.31.so ld-linux-x86-64.so.2
# Set correct timezone inside your chroot:
printf "%b\n" "0.0 0 0.0\n0\nUTC" > /compat/linux/etc/adjtime
# Make sure everything is properly mounted:
mount -al
# Chroot into your linux environment:
chroot /compat/linux /bin/bash
# Choose your timezone:
dpkg-reconfigure tzdata
# Install some required programs (except for ttf-mscorefonts-installer which is optional):
apt update ; apt install -y gnupg pulseaudio fonts-symbola ttf-mscorefonts-installer
# Install Google Chrome:
apt-key add linux_signing_key.pub && apt update && apt install -y google-chrome-stable
# Exit chroot
exit
# Exit su
exit
# Now create a .desktop file to launch Chrome as any other app:
touch ~/.local/share/applications/google-chrome.desktop
# Make it contain something like this:
Code:
[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
Name=Google Chrome
Comment=Google web browser based on WebKit
Icon=google-chrome
Exec=/compat/linux/bin/chrome
Categories=Application;Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;
StartupNotify=true
*Note: Syncing or accessing your google account won't work. It will display:
"Couldn't sign you in This browser or app may not be secure. Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in."
To fix this, change your user agent to Firefox, for instance, and login to Gmail (keep it logged in). Then change your user agent back to default and turn on sync. User-Agent Switcher and Manager extension is what worked for me ?
Also be aware that if you didn't have pulseaudio already installed on FreeBSD, a reboot may be required to get sound working within Google Chrome.
If you happen to still have sound issues, please see comment #43.
That's all!
Many thanks to Alex S. (shkhln) for his games/linux-steam-utils port, and Alexandru Hamedu (st1905) for helping in all sorts of things earlier when trying to set up a CentOS-based linuxulator.
Sources:
https://wiki.freebsd.org/LinuxJails
https://wiki.freebsd.org/LinuxApps
https://wiki.freebsd.org/Linuxulator
https://help.ubuntu.com/lts/installation-guide/armhf/apds04.html
https://github.com/AppImage/AppImageKit/issues/98
https://pastebin.com/1W9Fh3e9
EDIT 1: Replaced
sudo
for su
to fix some of the commands above.EDIT 2: Reworded the point about using a tmpfs /tmp to make it clearer.
EDIT 3: Added a workaround to be able to log in to google accounts, and fix syncing.
EDIT 4: Added pulseaudio as a required package for both FreeBSD and the Ubuntu chroot. This should fix sound output in most of the cases.
EDIT 5: Added fonts-symbola to fix some missing characters.
EDIT 6: Rewrote Chrome launcher script to fix PWA (Progressive Web Apps).
EDIT 7: Added link to a fix by "mrclksr" that explains how to tell pulseaudio clients where to find sound.
Last edited: