[Linuxulator] How to run Google Chrome (linux-binary) on FreeBSD

scottro

Daemon

Reaction score: 901
Messages: 2,049

In case it's of any use, I also installed mpv. If I play a video straight from mpv, as opposed to going through the web browser, sound is fine.

I wonder if this has something to do with what we use for window manager. Maybe some of the desktop environments have something extra that we don't know about that is missing in window managers like openbox or dwm. (Just a guess, no intelligent knowledge behind that guess, save for anecdotal experience on Linux where something would only work for those using say, Gnome, as opposed to dwm.)
 
OP
P

patovm04

Member

Reaction score: 61
Messages: 63

This works great, except sound doesn't work. I'm able to play Netflix, but sound doesn't work on any site. I tried installing pulseaudio in the ubuntu chroot, but it said it was already installed:

pulseaudio is already the newest version (1:13.99.1-1ubuntu3).

Sound works fine in regular chromium on FreeBSD 12.2. Any idea why it doesn't work with the Ubuntu chroot?
I think I discovered what the problem was!
You need to have pulseaudio installed both on FreeBSD and inside Ubuntu chroot. I didn't know it was necessary, but have just confirmed it. So just do this:
sudo pkg install pulseaudio
And reboot so it takes effect.
Another thing to add to my Guide above :)
 
OP
P

patovm04

Member

Reaction score: 61
Messages: 63

In case it's of any use, I also installed mpv. If I play a video straight from mpv, as opposed to going through the web browser, sound is fine.

I wonder if this has something to do with what we use for window manager. Maybe some of the desktop environments have something extra that we don't know about that is missing in window managers like openbox or dwm. (Just a guess, no intelligent knowledge behind that guess, save for anecdotal experience on Linux where something would only work for those using say, Gnome, as opposed to dwm.)
Try installing pulseaudio also on your FreeBSD system:
sudo pkg install pulseaudio
Then reboot and see if your sound works
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

I tried that, but it doesn't seem to solve the problem. (I should add that even though I'm not having success, it's still a good thing that some folks can now get Netflix working properly. Even for me, I'm running it, so the video portion works, thanks to you.
 
OP
P

patovm04

Member

Reaction score: 61
Messages: 63

I tried that, but it doesn't seem to solve the problem. (I should add that even though I'm not having success, it's still a good thing that some folks can now get Netflix working properly. Even for me, I'm running it, so the video portion works, thanks to you.
Hmm, it's a shame it didn't work for you. If it's of any help, I'm running KDE Plasma 5. Maybe your hypothesis about desktop environments is not wrong after all...
 

zgee

New Member

Reaction score: 1
Messages: 2

Thanks for the howto!
I initially ran into the same problem as a few others reported, regarding having no sound.
This was when launching Brave and Chrome from a fresh FreeBSD 12.2 install with a minimal x11-wm/i3 setup, after following your steps.
I then tried installing x11/kde5 and without modifying any values in /usr/local/etc/pulse/default.pa I now have sound in both Brave and Chrome. Pretty cool!
 
OP
P

patovm04

Member

Reaction score: 61
Messages: 63

Thanks for the howto!
I initially ran into the same problem as a few others reported, regarding having no sound.
This was when launching Brave and Chrome from a fresh FreeBSD 12.2 install with a minimal x11-wm/i3 setup, after following your steps.
I then tried installing x11/kde5 and without modifying any values in /usr/local/etc/pulse/default.pa I now have sound in both Brave and Chrome. Pretty cool!
Nice! Thanks for sharing!
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

Decided I would try that too. Turned out to require 578 packages downloaded take 4 something gigs, 1 GB of download. Don't know if I'd try it on a machine that I was using for something else (though, to be realistic, on modern machines, it isn't such a big deal.

I didn't make any other changes, just installed kde5 but continued using openbox for X. However, still no sound for me. First World Problem?
 
OP
P

patovm04

Member

Reaction score: 61
Messages: 63

Decided I would try that too. Turned out to require 578 packages downloaded take 4 something gigs, 1 GB of download. Don't know if I'd try it on a machine that I was using for something else (though, to be realistic, on modern machines, it isn't such a big deal.

I didn't make any other changes, just installed kde5 but continued using openbox for X. However, still no sound for me. First World Problem?
But did you try it from a plasma 5 session instead of openbox?
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

No, I just ran openbox. But I just tried in plasma, having to install sddm first. :), and still no luck. This may be a Just Me(TM) problem, so don't spend time trying to fix it, but I thank you very much for your efforts so far.
 
OP
P

patovm04

Member

Reaction score: 61
Messages: 63

No, I just ran openbox. But I just tried in plasma, having to install sddm first. :), and still no luck. This may be a Just Me(TM) problem, so don't spend time trying to fix it, but I thank you very much for your efforts so far.
Hahaha ok :(
 

lme@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 304
Messages: 776

No, I just ran openbox. But I just tried in plasma, having to install sddm first. :), and still no luck. This may be a Just Me(TM) problem, so don't spend time trying to fix it, but I thank you very much for your efforts so far.
You can still watch silent films *runs away*
 

st1905

Member

Reaction score: 7
Messages: 41

Try copying /usr/local/etc/asound.conf to /compat/linux/etc/asound.conf

And run speaker-test
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

Ahah, that seems to do it IF I use kde. So for me, I have to take the extra steps of running, (after booting into text mode) sudo service sddm onestart, then logging in to KDE, then running chrome or brave. But I do get Netflix with sound. Thank you!

EDIT. I typed too soon. Upon a reboot, sound no longer worked. Tried rebooting a few times, but no luck.
That's alright, though, it worked once, which means it may be a Just Me issue. And it shows that it is possible.
 

mrclksr

Active Member

Reaction score: 145
Messages: 165

scottro :
I had the same problem. The solution is basically to tell pulseaudio clients where to find sound by setting the socket path via the PULSE_SERVER environment variable.
Create a wrapper script under /usr/local/bin/chrome to start /compat/linux/bin/chrome:
Bash:
#!/bin/sh

get_pa_sock_path()
{
    PA_SOCK_PATH=$(sockstat | awk -v me=$(whoami) -F'[ \t]+' '
        $1 == me && $2 == "pulseaudio" && $6 ~ /native/ {
            print $6;
            exit 0
        }'
    )
}

get_pa_sock_path
if [ ! -S "$PA_SOCK_PATH" ]; then
    while killall pulseaudio; do
        sleep 0.5
    done
    pulseaudio --start
    get_pa_sock_path
fi
[ -S "$PA_SOCK_PATH" ] && export PULSE_SERVER=unix:$PA_SOCK_PATH
/compat/linux/bin/chrome
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

By golly, that not only seems to have worked, but also to let me run it from openbox rather than using sddm to start kde to start chrome. Thank you!.

Also, for those who like brave-browser, just change the last word of that script from chrome to brave and it works (with sound) in brave browser too.

Thanks again. And of course thanks to patovm04 who started the whole thing.

Next step, when I get around to it, is doing a fresh install without KDE and seeing if it will work with just openbox. But, I don't know when I'll get to that. Regardless, I'm happy now.
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

Ok, again thanks to patovm04 and mrclksr. (I find if I put the @ in front of a user name, it shows
Code:
[USER] [/USER]
tags so I've stopped using it till it gets fixed. Anyway, I did a fresh install, this time, only installing openbox. I used mrclksr's script, and, even without all the KDE stuff, it worked. I had to restart each browser (brave and chrome) before sound worked, but I can now watch Netflix on FreeBSD, which, even though I barely use it (mostly my wife, who is Japanese, uses it to watch various Japanese and Korean dramas), it's good to know I can use it.
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

I'm going to add, though this is obvious. (But I missed it till I gave it a bit of thought). If you use another language and are having font trouble in chrome or brave, you have to install the fonts in Ubuntu, doing a chroot to /compat/linux. In my case, I just use my wife's profile and it's in Japanese, so even though I had necessary fonts installed in FreeBSD, I was still seeing squares in Netflix, where there should have been Japanese writing. So, I did a chroot to /compat/linux and ran
Code:
apt-get install fonts-takao-mincho
which fixed the problem. So, if you use a language other than English, be sure to install the fonts in /compat/linux. Fonts installed in the host FreeBSD system don't seem to have an effect.
 

scottro

Daemon

Reaction score: 901
Messages: 2,049

This also allows one to watch Amazon Prime video, which you can't do in regular FreeBSD.
 

mrclksr

Active Member

Reaction score: 145
Messages: 165

I'm going to add, though this is obvious. (But I missed it till I gave it a bit of thought). If you use another language and are having font trouble in chrome or brave, you have to install the fonts in Ubuntu, doing a chroot to /compat/linux. In my case, I just use my wife's profile and it's in Japanese, so even though I had necessary fonts installed in FreeBSD, I was still seeing squares in Netflix, where there should have been Japanese writing. So, I did a chroot to /compat/linux and ran
Code:
apt-get install fonts-takao-mincho
which fixed the problem. So, if you use a language other than English, be sure to install the fonts in /compat/linux. Fonts installed in the host FreeBSD system don't seem to have an effect.



You can symlink the fonts and icons installed under /usr/local/share/ to the jail to make them available to the applications running in it:

Code:
# ln -s /usr/local/share/icons/* /compat/linux/usr/share/icons/
# ln -s /usr/local/share/fonts/* /compat/linux/usr/share/fonts/
 
Top