Running Skype on FreeBSD by Cheating
One of my goals with installing FreeBSD on my laptop was to be able to use it full-time for work when working from home. For this I needed to be able to accomplish all of my normal daily tasks without sneaking off to boot up a Windows machine or something. Most of what I needed was pretty straight forward, I spend most of my time in a terminal, ssh’d into various machines at work, in Wireshark, or in a Web Browser, all of which work perfectly on FreeBSD.
Of the few programs that were more difficult, Skype ended up being the most difficult by far. There are of course other voice chat programs, but since Skype is what the rest of my team uses, its what I need to use. Modern Skype clients just aren’t available for FreeBSD. It would seem otherwise, looking at Google, but all of the methods people used in the past to get it working are no longer applicable. There was an old skype client in ports that used to work, but that doesn’t support the modern protocols skype uses. In theory you should be able to run the linux skype client using the linux-emulation layer, but people online didn’t seem to be having any luck with it, so I didn’t even try that route. There were some posts on-line from people claiming success using the Skype WebClient under FreeBSD by playing with UserAgent strings, but It didn’t work for me– I could log in to skype, but not successfully make calls.
With all native solutions off the table, I figured a Virtual Machine running Linux and a Skype client would be a good alternative and should be pretty easy to set up. It ended up being much more difficult than I expected. Creating a Debian Linux VM and installing skype for Linux in it wasn’t too hard. Getting Skype to show up on my X desktop under FreeBSD by ssh’ing into the VM and forwarding X wasn’t too hard either. But thats where my luck ended, getting audio working smoothly almost killed me.
I started out with bhyve, but quickly found that bhyve supports audio applications in theory, and thats about it. I moved over to VirtualBox to discover audio didn’t work reliably for me there either. Audio would work for a few minutes, and then stop playing until I restarted the VM. I tried all of the audio options available, I even tried installing VirtualBox from source so I could enable the PulseAudio back-end, but still with no luck.
What finally worked for me was to install PulseAudio on my FreeBSD host and set it up to listen to network audio on a TCP port. Then in the VM I set the PULSE_SERVER environment variable to tell Skype itself to send audio over the network to my host. This doesn’t use PulseAudio for VirtualBox, in fact VirtualBox doesn’t need any sound support at all. The Skype Application just sends whatever audio it wants to output over the network instead. At first the audio was very choppy, but I was able to resolve this by increasing the buffering on PulseAudio on the host.
Finally Skype audio calls and I can join all my Skype meetings for work while running FreeBSD on my laptop (and cheating by running Linux in a VM, but that’s life). I can also see co-worker’s screens that they share and see their video feeds if they enable one (though frame rate is poor due to using X forwarding). However I’ve not yet found a way to share my own screen with this setup which is kind of a bummer, and I can’t send a video feed of myself (which I don’t care about at all). Presumably I would be able to use a USB webcam if I could pass it through to VirtualBox, but VirtualBox on FreeBSD only supports USB 1.1 and my webcam is USB 2