FreeBSD review and howtos from a Linux user

3 03 2008

I recently decided to give the new 7.0 release of FreeBSD a go and was fairly impressed. I did use BSD along time ago on a home server for a few months but pretty much forgot everything about it from back then.

FreeBSD Screenshot

Introduction
Firstly FreeBSD refers to both a kernel and userspace tools making it a whole operating system (userspace tools being the basic programs like shells and copy/move commands), this is different to Linux which is just a kernel and distros are technically called GNU/Linux to show that it is using the GNU userspace tools. You can install the GNU userspace tools on FreeBSD and you can also get GNU/FreeBSD hybrids such as the Debian GNU/kFreeBSD, and there was work on a Gentoo/FreeBSD but it never went anywhere, although there not really used much. Theres also not a huge point in either since all the userspace tools are based on the original Unix ones and try to mee POSIX standards etc %90 of the functionality is the same. There are some differences, for instance ‘ls –color’ on FreeBSD is ‘ls -G’, some commands require the flags to be in the correct order so ‘cp /directory /somewhere -rf’ won’t work as -rf is at the end instead of the start befoure the directories, when hitting the down arrow at the end of a man page it will exit on FreeBSD.

The other important difference between BSD’s and Linux is the license they use, Linux uses the GPL and BSD uses the BSD license. The GPL is actually more restrictive but in a way that is designed to guarantee everyones overall freedoms, by enforcing that the source remains open when redistributed. The BSD license basically says you can do whatever you want provided you keep the credits in, including taking the source and closing it or relicensing it. Apple took the FreeBSD userspace tools for OSX (and the Mach microkernel)

The difference in the kernels means that hardware is going to behave differently, device names in /dev/ are diffrent for starters. Ethernet cards have names that match the device model, for instance instead of “/dev/eth0” you might have “/dev/re0”. My harddrive is “/dev/ad10s1” instead of “/dev/sda1” There will be differences in the hardware that is supported, wifi is apparently better on FreeBSD although there has been a lot of work in the Linux area recently and some of the drivers have been ported across (leading to some controversy due to the relicensing of BSD code under the GPL, although it has apparently been resolved).

The overall system feels fairly similar to Slackware and Gentoo, except with better package management IMHO.

Installing
Installing isn’t particularly hard, if you have installed either, its not a Ubuntu style userfriendly distro so you do need to partition and such but it didn’t require heaps of planning and was fairly hassle free. There is also the handy FreeBSD handbook which is actually fairly good, normally when I get told to read opensource documentation I find a bunch of out of date or setup in a completely different way by everyone but the guide writers. You can get away with only getting the 1st CD since that contains the basic system and if you don’t choose much in the way of packages you won’t need the others. If however you do get asked to insert the 2nd or 3rd CDs, at that stage you can just ctrl+c and reboot into a working distro and use ‘sysinstall’ to make any additional changes. Set the root password with ‘passwd’ and add a user account with ‘adduser’.

One installed you need to setup stuff, once again if your a Gentoo user this is familiar. FreeBSD has binary packages that can be retrieved automatically via ftp by using the ‘pkg_add -r ‘ command. FreeBSD however also can compile packages from source using ports, this is similar to Gentoo’s portage which was heavily inspired by ports. Ports seems a simpler and more stable system than portage with which I have had problems maintaining when updating packages can break or lock other packages.

Firstly I had some problems with my USB keyboard, in the end I had to disable USB legacy in the BIOS which was blocking BSD from using it for some reason, this has the unfortunate side effect of disabling the keyboard in the boot loader but its not needed for now.

Ports
Ports is the system that FreeBSD uses to get source code for packages, compile and install it. It is similar to Portage as it used ports as inspiration. Compiling from source has advantages over using binary packages. For instance patent issues aren’t a problem because its the source code, I am not a lawyer but source code itself cannot be patented as its a blueprint not an actual thing, and compiling the code your self is possibly ok since you can apparently violate patents for personal use (not too sure on that, some talk here, at the very least it means that to enfoce the patent requires going after individuals rather than FreeBSD so home users are unlikly to be at risk (unless patent lawyers frequent your premises), it also allows for people in countries without such laws access to the code), but as I said I’m not a lawyer and haven’t bothered to find much in the way sources. Secondly you get more control over what features you want in your program and thirdly you can optimize the program for a specific architecture.

Setting up ports, If you want to grab a new snapshot of ports you will need to run ‘portsnap fetch’ followed by ‘portsnap extract’. If you already have “/usr/ports” perhapses because you chose it when the installer asked you can apparently ‘cd /usr/ports’ followed by ‘make update’. This should use portsnap to update it. The full was about a 50mb download when I did it with ‘portsnap fetch’.

Ports has a similar thing to Gentoo’s portage useflags called KNOBS, you can see a whole list of them in /usr/ports/KNOBS. I believe you can also set CFLAGS like in Gentoo although I havn’t bothered.

Desktop
If your using it on the desktop you will need to install xorg and a desktop environment, you can “pkg_add -r gnome2” to do that, which should pull in all the dependencies. Alternatively to build from source: cd /usr/ports/x11/gnome2 && make install clean
If you want to use gdm add gdm_enable=”YES” to /etc/rc.conf. If you don’t want Gnome you can so whatever other environment you want, Fluxbox, XFCE, KDE, etc… You will need to edit ~/.xinitrc and add “gnome-session”, “fluxbox” or whatever. You can then ‘startx’. At this point there will be a bunch of programs you need to install either from ports or with pkg_add -r such as firefox, pidgin, vlc (although totem should be in if you did gnome2), music players, etc…

Shell
The default shell csh might not be to your liking, a lot of people are experienced with bash which is the choice of most Linux distros although personally I prefer zsh which has better tab completion and fancy prompts included. ‘pkg_add -r zsh’ or ‘pkg_add -r bash’ or install them from ports. Then run ‘chsh’ which will give you a vi window, change the “Shell: /usr/bin/csh” to “Shell: /usr/local/bin/zsh”. Bash users will need to change it to bash obviously. If vi is a problem for you, you can probally edit ‘/etc/passwd’ with whatever you want. You will need to setup your shell rc, ~/.zshrc for zsh (although it has a config window on first time login).

Sound
You will probably need to enable sound, Theres a handy howto here, but basically ‘kldload snd_driver’, ‘cat /dev/sndstat’, look for the driver name right after “kld”, add DRIVERNAME_load=”YES” to /boot/loader.conf

Mount Linux ext3 Drive
Mounting your Linux drive, add the following entry to /etc/fstab: /dev/ad10s2 /mnt/ubuntu ext2fs rw 0 0 with whatever changes you need for your device name or mount point. You will need to make the mount point to with ‘mkdir /mnt/ubuntu’. If you get the error “mount: /dev/ad10s2 : Invalid argument” this could be because your drive is unclean, you will need to install the /usr/ports/sysutils/e2fsprogs/ and run ‘fsck.ext3 /dev/ad10s2’ (Assuming your using ext3).

NTFS read/write with NTFS-3g
Mounting a NTFS drive with read/write is a bit more work, you need to install ‘/usr/ports/sysutils/fusefs-ntfs’, however it needs the userspace source. You can get this with ‘sysinstall’ choosing “Configure>Distributions>src>All”, this will grab all the source its probably not all required but I couldn’t find the specific package and its handy to have the rest around anyway. Once you have that you can ‘ntfs-3g /dev/ad10s1 /mnt/windows’. Adding an fstab entry is again a bit problematic. Under 7.0 the mount command has had hardlinks to what it can call, mount_ntfs-3g isn’t in that list so you either need to patch mount or rename the current mount_ntfs, and link ntfs-3g in its place. Without that this was throwing an “mount: /dev/ad10s1 : Operation not supported by device” error.

nVidia drivers
The drivers work quite well on FreeBSD 7.0 but only on i386 (64bit is out of luck thanks to closed source nvidia drivers, 64bits OS is mostly useless anyway), the official ones refuse to install for me but the ones in ports work. Firstly you need the kernel source code installed, if you followed the NTFS-3g instructions above you will have the source already. If not you can specify just the base and sys source in sysinstall which is all thats needed for the drivers. Then cd /usr/ports/x11/nvidia-driver && make install clean Add this to /boot/loader.conf nvidia_load="YES" Now you need an xorg.conf file, by default BSD just relies on the autoconfig magic in the latest xorg releases so we need to force it to generate one with: Xorg -configure then copy the newly created xorg.conf.new to /etc/X11/xorg.conf. If you don’t want to edit the xorg by hand cd /usr/ports/x11/nvidia-xconfig && make install clean then nvidia-xconfig will change the “nv” driver to “nvidia”.

Compiz Fusion
Firstly if your on nVidia hardware you need to enable some xorg.conf settings, you can do them with nvidia-xconfig if you installed it above nvidia-xconfig --composite && nvidia-xconfig --render-accel && nvidia-xconfig --add-argb-glx-visuals -d 24

Now install Compiz with: cd /usr/ports/x11-wm/compiz-fusion && make install clean When you want to start it use LIBGL_ALWAYS_INDIRECT=1 compiz --sm-disable --replace ccp and for the Emerald decorationsemerald --replace. I had some problems with emerald not starting right away and drawing no decorations but after a while it loaded fine without me noticing and now starts fine. You will probably want to make Compiz start automatically, there are various guides on Compiz around that give you different ways. The config programs should be in System>Preferences for Compiz and Emerald, otherwise use ‘ccsm’ and ’emerald-theme-manager’.

updatedb
For those of you who use ‘locate’ command to find files, you will probably want to update the database, you might have already noticed that ‘updatedb’ isn’t a command. The actual command is ‘/usr/libexec/locate.updatedb’ but this will give you a warning as running it as root will expose hidden files that only root or specific users should see to the database (not such a problem for single users), you can however run the cron job manually for a safer database with: /etc/periodic/weekly/310.locate

Flash
One of the main problems with Desktop FreeBSD is that Flash has no native port for FreeBSD thanks to Adobe (Even though there is a Solaris port thanks to Sun working with Adobe, you can have your say on the flash development blog, also an online petition exists for what little use they are with over 5000 signatures(and spam bots)). There has been some talk on the mailing lists of a native FreeBSD port.

The only real solutions seems to be to use Flash 7 or possibly Windows Firefox under Wine ☹ (PC-BSD Apparently ship a Windows Firefox PBI)

If you want to try the Linux version of Flash 9 which freezes for me (and everyone apparently), you need to install the Linux plugin /usr/ports/www/linux-flashplugin9 and the wrapper /usr/ports/www/nspluginwrapper/. Then run nspluginwrapper -v -a -i to register the plugin. Check in ‘about:plugins’. Alternatively you can try Flash7 with a wrapper, there is also another wraooer /usr/ports/www/linuxpluginwrapper but it wouldn’t install for me.

ETQW [unsolved]
I though I would give ETQW a go under FreeBSD, unfortunately I ran into problems with the Linux compatibility layer, I’ll post the steps here in case its of use to someone trying to do something similar or can offer a solution.

Firstly the installer didn’t give the default path but entering one works however it then failed to make the path so you need to make it manually, then it failed to read from the cdrom (although I didn’t really look into it since you can just copy the files across manually, possibly manually mounting it manually would have solved it). Copy the correct files into the base directory.

When running the etqw binary I get an error about missing sdl libraries “./etqw.x86: error while loading shared libraries: libSDL-1.2.so.0: cannot open shared object file: No such file or directory”, You can fix this with cd /usr/ports/devel/linux-sdl12/ && make install clean

You will need to brand you etqw binaries as Linux ones, change to your etqw directory and run brandelf -t linux * also brandelf -t linux pb/* might be needed.

Then run: portmaster emulators/linux_base-fc4 to get all the Linux compatibility stuff installed (if using portmaster you need /usr/ports/ports-mgmt/portmaster/ installed)

Then there I got “./etqw.x86: error while loading shared libraries: /usr/local/lib/libX11.so.6: ELF file OS ABI invalid”, make sure that /usr/ports/x11/linux-xorg-libs/ is installed.

For the error “./etqw.x86: error while loading shared libraries: libjpeg.so.62: ELF file OS ABI invalid”, make sure you have “/usr/ports/graphics/linux-jpeg”. You can also try ‘sysctl kern.fallback_elf_brand=3’. But those didn’t work for me, I notice that etqw ships its own libjpeg, I tried replacing that with the /usr/compat/linux/usr/lib/libjpeg.so.62 one it seems to work but now I get another error “./etqw.x86: error while loading shared libraries: /usr/local/lib/libX11.so.6: ELF file OS ABI invalid”, possible its loading the ones in /usr/local/lib instead of /usr/compat/linux/usr/X11R6/lib/libX11.so.6 but I don’t know and thats about all I can think of now.

Also make sure you have linux_enable=”YES” in /etc/rc.conf and run ‘/etc/rc.d/abi restart’ to enable the compatibility layer stuff if you didn’t already have it done.

Wine
Wine works fine under FreeBSD, to install: cd /usr/ports/emulators/wine && make install clean

Mounting samba shares
Firstly you need to install Samba with /usr/ports/net/samba3/ && make install clean then you can manually mount it with the following: mount_smbfs //username@host/share /mnt/mointpoint

the -o options that you use in Linux such as username, password, credentials don’t work on FreeBSD’s version. If you want to make it automated, edit /etc/fstab and add: //username@server/share /mnt/mountpoint smbfs rw 0 0 Then edit /etc/nsmb.conf and check the example near the end. Alternatively you can put them in ~/.nsmb.conf for a per user solution.


Actions

Information

26 responses

16 03 2008
Antonios

Nice overview. I was looking for a way to properly set compiz up and your instructions helped much. Thanks!

25 05 2008
Robvdl

I’m having the same issue with Compiz and the window border not coming up. I have not been able to fix the problem. I have found out that heaps of people are having the same issue, but I can’t find any specific guides on how to fix this with FreeBSD, so I am kind of stuck.

I get the following message:

compiz (decoration) – Warn: Property ignored because version is 20061011 and decoration plugin version is 20070319

After some googling, I found out that could mean: Emerald is not in sync with your decoration plugin. Most likely, you are using a beryl version of emerald, and that won’t work with compiz. Uninstall emerald and install the version from the same repository as your version of compiz.

The thing is, I am not using emerald at that point…

If I do use emerald instead:

emerald –replace

Then nothing happens at all, it happily continues to use metacity that way, with no error messages or anything.

I tied many different configurations in my xorg.conf, I also tried to uninstall emerald and rebuild compiz fusion without it, but no matter what I try — it just won’t work.

For now, I am giving up on using Compiz Fusion on FreeBSD, as I already have it in Ubuntu, although it would have been relly nice to get it going in FreeBSD.
Reply With Quote

31 05 2008
Thomas Sowell

This page has the most information I could find on Google about ETQW on FreeBSD, so here I shall document my experience with the same.

Assuming basic Linux environment packages are already installed… The only additional packages I need were linux-sdl12, linux-openal, and linux-jpeg.

I downloaded the Linux client installer from ftp://ftp.idsoftware.com/idstuff/etqw

The installer checks /etc/mtab to guess where the DVD is mounted. This won’t work in FreeBSD, but you can trick it by adding a line like “/dev/cdrom /mnt udf ro 0 0” to /compat/linux/etc/mtab and mounting the DVD on /compat/linux/mnt. (The first time I did this, I had no trouble, but last time the kernel would panic during installation. Mounting the DVD elsewhere and manually copying its contents to /compat/linux/mnt allowed me to proceed with the install)

After installation, the binary will be looking for shared libraries in the wrong locations. There may be a better way to fix this, but I just created symlinks for each library:
ln -s /compat/linux/usr/X11R6/lib/libX11.so.6 /compat/linux/usr/local/lib
ln -s /compat/linux/usr/X11R6/lib/libXext.so.6 /compat/linux/usr/local/lib
ln -s /compat/linux/usr/lib/libGL.so.1 /compat/linux/usr/local/lib
ln -s /compat/linux/usr/lib/libGLcore.so.1 /compat/linux/usr/local/lib
ln -s /compat/linux/usr/lib/libnvidia-tls.so.1 /compat/linux/usr/local/lib

You’ll be able to run it now, but there won’t be any sound. Start etqw to create its configuration directory in $HOME, then exit. To get sound working, edit ~/.etqwcl/base/etqwconfig.cfg and change the line
seta s_driver "alsa"
to
seta s_driver "oss"

2 06 2008
Gigi

Nice review and good instructions. Very good work.

2 06 2008
Fahad

Really a very nice and informative article, help me a lot.
Appreciate it.
Thanks!

2 06 2008
she

The biggest difference is, why should one switch from Linux to FreeBSD?
I dont see a compelling advantage of FreeBSD.
Both seem to be EXTREMELY similar, the license difference is probably the thing that sets both worlds apart most. The tools are pretty much the same.
Who cares if its GNU cp or FreeBSD cp? As long as it does the job………..

3 06 2008
davemc

she – “why should one switch from Linux to FreeBSD?
I dont see a compelling advantage of FreeBSD.”

The BSD’s are UNIX. Linux is UNIX like, from what I understand of the whole mess anyway. This gives a clearer picture:

http://upload.wikimedia.org/wikipedia/commons/7/77/Unix_history-simple.svg

Anyway, your right, and I do agree. I am a veteran user of both Gentoo and BSD and am now a very happy Ubuntu and Fedora user. There is also the issue of the FSF and GPL vs. BSD licencing issue. On top of all that, the BSD’s and Gentoo are exceptionally un-userfriendly, and really are a true backroom geek’s wet dream. Definitely NOT for the masses.

4 06 2008
H3g3m0n

FreeBSD is often considered more stable and secure than Linux, if you are looking for and easy to use desktop distro then its probably not a good choice compared to Ubuntu, Fedora OpenSuSe etc… There are DesktopBSD and PC-BSD distros that are aimed at this market but I cannot comment on how well they do compared to Linux desktop distros, I would guess isn’t not as good if only due to the lack of widespread usage (less users means less developers).

If however you want a server distro, or you want a tweakable desktop system that doesn’t abstract the core system away with GUI interfaces and such (ie editing text files vs network manager), or a system that builds everything from source code, then you might like to give it a try. If your a Gentoo user then its very similar, in fact I prefer FreeBSD’s ports build system to Gentoo’s.

Another advantage is support for ZFS in the kernel, Linux currently only has a FUSE module (although there where those Linus with sun developer pictures recently that could indicate we will be getting real support, but I won’t hold my breath http://blogs.sun.com/jimgris/entry/zfs_pics )

6 06 2008
7 06 2008
anomie

Not a bad collection of anecdotes and tips. Thanks for putting this together.

WRT the flash conundrum:
>> The only real solutions seems to be to use Flash 7 or possibly Windows Firefox under Wine

I run Windows Firefox under wine, and it works quite well.

11 07 2008
he

@she

I was linux user from…very long time ago 🙂 and I was scary to install BSD. but about one year ago I installed FreeBSD and I love it. It is UNIX, clear and simple. IMO much more secure than linux.
Okay there is a problem with Flash 9 but Gnash works okay for me.

22 08 2008
sostenible

The flashplugin issue is easily solved by installing from ports the linux version of firefox and after the linux-flasplugin9.

You just have to be sure that you first have a Linux Compatibility Layer installed (you can find them in ports / emulators). In any case, in DesktopBSD when you install from ports the linux-firefox version it will already pull down a FC4 compatibility layer.

In my case I’ve been using Ubuntu since its first version, this is years ago. However, these last 2 versions have increasingly encouraged me to leave this distro as stability is becoming an issue. As I don’t like the rpm system I only had Debian or moving elsewhere. A week ago I had my first incursion into the BSD territory with PC-BSD (I saw it caos, I never got to understand how to deal with pbi, ports, etc., extremelly confusing to me).

2 days later I installed DesktopBSD 1.6 and there it is since then: fully configured, everything works perfect…….what can I say: it’s my new OS, hopefully for at least as many years as Ubuntu has been!!!

I just have one issue: I can’t get NTRConnect to work, which I could in Ubuntu. And I need it as I have to access my work-at-home computer remotely from other computers located behind restrictive firewalls that do not allow external IP / port access.

In the meanwhile I will install a virtual windows, probably running on QEMU, in order to connect to it through LogMeIn and, once in windows, connect internally though VNC to DesktopBSD. This is what I used to do (but using Virtualbox) on Ubuntu, until NTRconnect came out a year ago with a linux compatible version – to act as a server, all are client compatible with linux –

4 11 2008
mark

Technically, FreeBsd is not unix.
BSD began life as unix, and many parts of the *nix systems we know today where 1st implemented in Berkley UNIX.
However due to lawsuits by AT&T, any proprietary UNIX code was removed from BSD and its variants.
The BSDs today are also only “unix-like”, and this is not soley (as some like to claim) due to the rights on the name “unix”

4 03 2009
22 08 2009
saleas

mark,
You proved that you know nothing about unix history.
You are confused… FreeBSD IS Unix (Linux is NOT for sure, it is just a kernel of a student, not a complete operating system…).

Yes, a FEW parts of AT&T code have been re-written due to the lawsuits, but the main dispute was the Unix trademark, AKA MONEY.

The AT&T and the rest of Unices benefited by BSD development team, which was the first that introduced the TCP/IP and many other crucial subsystems and evolved the AT&T unix to a modern operating system.

19 10 2009
raul

Hi…
I’m using FreeBSD and others flavors of BSD too, it is a great OS, but well, there is an issue in FreeBSD 7.1 related to Amarok, Xine, and setting up these programs for a good performance.

The case is Amarok does not play mp3 properly, mp3 are cut into “samples”, like they should be “echoed” to the output.
And Xine does not play videos anyway.

But, in example, in DesktopBsd, all it is set up correctly, working fine…the problem is that this system has not documentation, and it was not possible to me to get the list of dependencies and installed files/libraries for Amarok and Xine.

I want to work with FreeBSD 7.1 or upper, not DesktopBSD…does anybody how to get the configuration for Amarok and Xine and transfer it to FreeBSD 7.1

Thanks

24 03 2010
FreeBSD 7.3 is Out! | Operating System Blog

[…] LWN 7.x: Linuxoid (Russian) • WordPress • Software in Review • Free Software Magazine 6.x: Blogspot • Polishlinux • ServerWatch • […]

7 04 2010
john

Thanks for the informative article. What’s the program in the image? Is that some kind of virtual desktop program, or just a creative rendering for the article?

7 04 2010
H3g3m0n

@john: It’s Compiz… It’s been around for many years now, it ships with just about every Linux distro (although you probably need to install the ccsm settings program to enable the cube mode).

8 04 2010
john

Thanks. My WM of choice has been Blackbox for awhile now, but that one looks interesing. Cheers.

19 05 2010
subtlefuge » Links Emporium

[…] FreeBSD review and howtos from a Linux user […]

30 05 2010
[En desarrollo] FreeBSD 8.1-BETA1 « Gustavo Pimentel's GNU/Linux Blog

[…] Linuxoid (Russian) • WordPress • Software in Review • Free Software […]

3 07 2010
19 03 2011
EleMeNt HaCkEr

شكرا .. 🙂

5 01 2012
Sammy

Gentoo’s port system isn’t like FreeBSD’s.

It’s the other way around. Gentoo modeled their ports system after FreeBSD (and OpenBSD borrowed it too).

As an avid FreeBSD user I find this mildly annoying.

28 03 2012