Venturing to FreeBSD on a Lenovo X220
(PCem, Virtualbox, Bhyve, XFCE, Webcamd and permissions, etc)
an episode about an undertaking with FreeBSD on a Lenovo X220
Setting up video driver for Intel was Easy
Setting up the video card driver as per FreeBSD handbook was straightforward I followed the steps and I had it working after installing Xorg and Gnome as one of the first steps.
Graphics tearing on Gnome even after optimization tricks shared by others
Even after some optimization tricks other people shared I still had tearing regarding GPU performance or something I decided to try on XFCE before I tried to dig deeper into the issue.
Suprisingly enough on XFCE everything was smooth and tearing is non issue over there, could be from laptop performs better on XFCE lower resource hungry DE or just simply it fits better… but thats where I stay.
XFCE works very smooth and uses few resources its very light on this about 8 year old laptop with 8 GB Ram DDR3.
With the help of apps like Albert I can have a workaround for Gnome´s Application viewer feature ( i think its called like this) where You could see the open apps and type in the search bar to find an app and launch it … Albert lets me look-search in these same indexed apps and i can launch any (also google search, etc like Alfred on the Mac) and XFCE´s application drawer icon or how its called let me get with one click on my panel a list of open apps and it also shows on which workspace I have it open and i can switch to the selected one with One click… Like this with this two mentioned workaround I can use XFCE the same way i was using Gnome Application viewer screen and I dont feel like Im loosing on functionality at all. Im sure there is even some way to make it work from Albert some way ( to be able to search or lookup in my open apps and switch to them that way I just did not figure out how just yet )
While it has definitely less plugins or modules available for XFCE´s panels than Gnome does as probably the developer base is smaller including the userbase for sure.. But I like it more and more and I did not regret switching to XFCE on my main workstation as well from Gnome just recently.
When I first installed VLC player I did from the binary repositories and as I often use samba shares to keep my files including TV Series or Movies.. I realized quick that each time I was trying to drag and drop a multimedia file from file browser to vlc i got an error.
The same file played perfectly fine when I had it on my local machine.
After some google-ing around I figured it had to do with Samba credentials and/or missing Samba Feature n VLC — however my username password on the local machine under BSD is the same as on the NAS/Samba share…I know its probably not the best practice but just bare with me . ( where the manuals told me to check under preferences… i was missing the menu option)
I uninstalled the binary package and reinstalled from Portstree where indeed amongst the configurable build option Samba support was one of the ones which could be selected.
The building ( including some others as well) was giving me constantly some error message regarding some perl version mismatch altough I had the system updated with freebsd-update fetch and freebsd-update install to the latest build. This issue eventually i resolved after some google-ing someone recommended to do a separate update for the Portstree/Portscollection itself using portsnap fetch portsnap update and portsnap extract command and it resolved this issue and VLC and those other previously failing apps were building correctly this time.
And of course once built from Ports with the Samba feature now baked in , my issue was resolved at once.
When it comes to packages You have relatively similar choices as of You used to Linux OS’es
You can install binary packages from repository with pkg install …. You can build things from source … or use a system for me most similar to Slackware´s Slackbuiids system called Ports tree which is the mix of source code + specialized build scripts for make and whatnot to do an easy one step build process on FreeBSD similar to Slackbuilds… just a make install clean or a make configure before that to configure build options if any exists for Your app.
Regarding virtualiation I tried with more or less success to make Virtualbox and PCem run ( both from binary packages and from Portstree) and also Bhyve with a debian 9.9 iso if I recall
In the case of Virtualbox i had varied success Im sure thanks to my not enough google’ing or inability to find all the configuration steps I had to.
I managed to get that far wih Virtualbox that I am able to spin up a virtualmachine ( tried to install windows 7 guest just to try it for PCem under windows) i get booted into the installer which eventually finds the virtualbox harddrive and installation starts but around 5-10% of the installation it gives some error either not being able to communicate with the source ISO cdrom file OR with the target HDD..it is unclear for me why or which part fails there… it also becomes quiet unresponsive even hangs and I am unable to kill the running VM most of the time… I did install in both cases virtualbox and the kernel package or module including the guestaddition modul or package as well.. So thats that my steps into Virtualbox (( never had an issue with this on Linux so its coming from my inability and lack of knowledge to configure and set this up properly on a BSD system I guess.. I hope with time this will change ))
In the case of PCem. From ports tree it builds a newer version than from binary package if I recall. However in both cases I spent 2-3 days figuring out where to put the ROMs for it as I found no written instructions for it nowhere. Eventually You need to place the roms folder to /usr/local/bin folder per default where pcem binary is being placed as well and/or use the provided pcem.cfg file in the same path to specify roms and nvr paths different than the one mentioned , also make sure the folder has chmod properly set so in case You run pcem as a non root user it can access the mentioned roms folder.
The bad thing is that for some reason I tried various roms/configs and I get a lot of segmentation fault errors on the console and it breaks the app/closes it… I was not able to make a single 286 machine with a simple HDD and install MSDOS 3.20 f.e to install GEMDesktop and GEM Writer suite on top f.e ..// hence I tried the Virtualbox approach with Windows 7 to run PCem there as it works under Windows just fine for the same I tried //
I also tried bhyve … with little info I could found on it how to use…with various success again thanks to my inability and inexperence when it comes to a BSD system. I managed to spin up a debian 9.9 vm installation but after to boot it up again / when it comes to the step reboot I got stuck and couldnt figure out how (( i even did start and stop scripts for it as mentioned in the steps outlined I left in the links ))
Some screenshots of the Virtualbox behaviour:
The same ISO installs just fine using the same HW settings (ram, hdd size, etc.) on Linux under VIrtualbox. The versions of VirtualBox on FreeBSD and Linux however differ where Linux having the latest 6.1 version version 5.X on FreeBSD.
The Virtualbox VM installed using the ISO and prepared under Linux boots and works fine under FreeBSD in Virtualbox.
Lenovo X220´s builtin Webcam and Webcamd daemon
It took me a few days and some google-ing and Mastodon questions to figure out this one and I have it 80% working the way I want it.
To use the builtin webcam on my Lenovo X220 I have to use a daemon called webcamd.
It can list and recognize the usb interfaces builtin like the webcam in the lenovo x220 and create a /dev/video device for the webcam for FreeBSD so applications like Firefox with Jitsi meet video meetings f.e and Wecamoid app can find it and use it ( Iridium chromium based browser for some reason unable to find it when I use with jitsi meet website to conclude meeting.. while other online webcam checker websites do work)
The issues I faced there once I figured out reading a post about someone with the same issue of a Lenovo X220 was that webcamd daemon to work needs to load a kernel module called cuse.ko (cuse4bsd). Second thing is that once the kernel module is loaded the webcamd daemon has to be run ( so it creates those /dev/video interfaces mentioned previously) and no matter i tried from my normal user which is member of wheel group it refused to load with anything else than being run under from root account.
Once I figured this one out .. Interestingly enough the apps like Firefox with Jitsi meet video meeting website or Webcamoid app were still not finding my webcam tough the webcamd daemon was running and /dev/video interface was created
After some google-ing and asking around in Mastodon including a certain Black Cat from Miami I know ( literally a CAT not a person referred to with the slang word Cat) turned out that any user i want to be able to access/use the webcam with has to be added to some additional groups than just wheel … some post i found apart from operator also mentioned groups like video and media as well if im not mistaken.
Once I added my normal user to these groups… once i started webcamd daemon from root ( as the kernel module seems to be loading OK from /boot/loader.conf ) it creates the /dev/video interface and if I start now webcamoid or firefox with Jitsi meet video chat website now its able to find and use the integrated webcam. This is what I call 80% working as I want it to but as a service it works 100% means it does what it has to .. its just commodity level 80% for now … Perhaps some scripts .sh could take care of the rest and then it d be a near OOB experience.
My main issues to iron out remains Virtualization. Id like to fix Virtualbox and be able to use bhyve more. Regarding PCem I can accept if it is something which works best on Linux/Windows cause I can always spun up a VM and just use it there tough being able to use it on FreeBSD would be the best…
Apart from all I did I outlined above I only missed to put into /etc/rc.conf webcamd_enable=”YES” now after reboot i dont need to do anything and the webcam is there up and ready to work when I need it 🙂 100% Resolved
What am I missing:
The only thing I miss and found no way around it is a piece of software I need to use to be able to connect to my VDI at work .. called VMWare Horizon Client – Horizon View or Vmware View Client .. all those names are commonly used. It does have a linux native build and it works on linux just fine ( on my Fedora box) but on BSD and on the portstree it seems unexistent.
I have no knowledge if the Linux compatibility library on FreeBSD would be able to make this piece of software work.
This missing piece of software is one of the main reason why I can not migrate my daily driver / main workstation to FreeBSD for the moment ( as I am confident that the rest of the mentioned issues I face at the moment can be solved with proper knowledge and experience)
Some Closing Thoughs:
As You can see from my example BSD is NOT Linux. While many things and knowledge can come handy from Linux world when You find Yourself at a BSD prompt it is still a completely different Beast. And We did not even mention other still commercially available UNIX variants like Solaris, AIX or HP-UX or the Pre-UNIX VMS and OpenVMS derived from it.
Also it must be said that while Linux has bigger userbase out there ( i am not referring to enterprise users or companies but normal general folks) they (Linux) also have a much bigger pile of cash as a form of donation from BIG corporations through the Linux Foundation like AT&T, Intel , Microsoft , Fujitsu, Google, Samsung Nec, Huawei just to name a few from their Platinum donors . They also have a lot of Gold and Silver members too.
The annual membership fee:
Platinum members is $500K+
Gold is $100K
Silver is $5K to $20K
This means Linux in general has a lot more to work with.. A LOT MORE. They can afford to pay developers full time , can attract talent easier ( with money its always easier) and pretty much can bridge certain gaps over with money when they have to ( f.e if they need to implement feature X. in Linux they can use the money to pay a full time developer for example to work on this as a contract or project based job for them)
This will eventually result of course in more traction and weight out there in the open source community. They can organize more and bigger events , afford top dollar panelists or speakers from enterprises whom maybe even keen to participate once they paid out the big annual fees mentioned above to push their ideas or to have a form of say in whats happening and whats trending in the open source and respectively Linux community.
Now BSD in the other hand, specifically FreeBSD through the FreeBSD foundation at the moment of writing this article, they have around 355 donors showing on their website with a raised amount of 327 000 US Dollars towards a goal of 1 250 000 US Dollars. Thats 2,5 Platinum donors fee of the Linux Foundation.
In delight of this I must say its very impressive what FreeBSD achieves with the help and the power of pretty much only coming from the Open Source / BSD Community.
Also regarding their infrastructural structure, FreeBSD is not a One Man Show with a couple of Leautenants like in the case of Linux by Linus Torvalds being in charge with a few key people above him. FreeBSD in this sense feels to me more like a community and less like the Corleone family Linux seems to me most of the time.
Im sure if more of Us Donates to BSD Foundations then BSD could be more and better than it is now in terms of available software and perhaps even broader hardware support OOB ( or maybe its just me guessing)
But one thing is true for sure… With Money and a lot of it , its easier to change the world.
Using bhyve on FreeBSD a link I found which got me up 80% more or less
Bhyve on FreeBSD hanbook
Interesting article on VMS Vs UNIX
BSD Vs Linux from the FreeBSD Handbook
The Linux Foundation