Tag Archives: x11

FreeBSD Desktop – Part 26 – Configuration – Conferencing and Meetings

For years I thought that online video conferencing and/or meetings would not be possible on FreeBSD. One of the first things I done on each of my laptops was to disable Camera and Microphone (along with Bluetooth) to save some battery time. While the Microphone would probably work I did not even tried to use it – did not had such needs to record anything with my laptop.

As time passed by I thought that maybe I will try what is the state of using Camera on FreeBSD and also how it is doing in the video conferencing/meetings space.


I was really astonished by the results … at least on my ThinkPad W520.

The Table of Contents for the article:

  • Camera Setup
  • Microphone Setup
    • ThinkPad Microphone Easter Egg
  • Meetings
  • Closing Thoughts

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Camera Setup

I enabled Camera and Microphone in the BIOS (leaving Bluetooth disabled) and booted up my FreeBSD 13.0 as usual.

I then installed needed packages which are:

  • multimedia/v4l-utils – Video4Linux utilities
  • multimedia/v4l_compat – Video4Linux IOCTL header files
  • multimedia/pwcview – Video4Linux PWC webcam viewer
  • multimedia/webcamd – port of Linux USB webcam and DVB drivers

We will also need to load cuse.ko kernel module at each boot. We will use /etc/rc.conf for that.

# pkg install v4l-utils v4l_compat webcamd pwcview

# vi /etc/rc.conf

  kld_list="${kld_list} cuse"


My Camera is listed at the end of the usbconfig(8) command.

% usbconfig 
ugen1.1: <0x1912 XHCI root HUB> at usbus1, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen2.1: <0x1033 XHCI root HUB> at usbus2, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen3.1: <intel ehci="" root="" hub=""> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.1: <intel ehci="" root="" hub=""> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen3.2: <vendor 0x8087="" product="" 0x0024=""> at usbus3, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.2: <vendor 0x8087="" product="" 0x0024=""> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=SAVE (0mA)
ugen0.3: <vendor 0x0765="" product="" 0x5001=""> at usbus0, cfg=0 md=HOST spd=LOW (1.5Mbps) pwr=ON (100mA)
ugen0.4: <logitech usb="" receiver=""> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (98mA)
ugen0.5: <chicony electronics="" co.,="" ltd.="" integrated="" camera=""> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (200mA)

We can also use webcamd(8) to list available cameras in the system.

% webcamd -l
Available device(s):
webcamd [-d ugen1.1] -N 0x1912-XHCI-root-HUB -S unknown -M 0
webcamd [-d ugen2.1] -N 0x1033-XHCI-root-HUB -S unknown -M 0
webcamd [-d ugen3.1] -N Intel-EHCI-root-HUB -S unknown -M 0
webcamd [-d ugen0.1] -N Intel-EHCI-root-HUB -S unknown -M 1
webcamd [-d ugen3.2] -N vendor-0x8087-product-0x0024 -S unknown -M 0
webcamd [-d ugen0.2] -N vendor-0x8087-product-0x0024 -S unknown -M 1
webcamd [-d ugen0.3] -N vendor-0x0765-product-0x5001 -S unknown -M 0
webcamd [-d ugen0.4] -N Logitech-USB-Receiver -S unknown -M 0
webcamd [-d ugen0.5] -N Chicony-Electronics-Co---Ltd--Integrated-Camera -S unknown -M 0
Show webcamd usage:
webcamd -h

We will use above webcamd(8) output to add needed webcamd_0_flags in the /etc/rc.conf file.

# vi /etc/rc.conf

  webcamd_0_flags="-d ugen0.5"


We also need to add ourselves to the webcamd group.

# pw groupmod webcamd -m vermaden

# grep webcamd /etc/group 

We can now start the webcamd(8) daemon.

# service webcamd start
Starting webcamd.
webcamd 99884 - - Attached to ugen0.5[0]

# ls -l /dev/video*
crw-rw---- 1 webcamd operator 2, 5 2021-05-09 11:36 /dev/video0
crw-rw---- 1 webcamd operator 2, 6 2021-05-09 11:36 /dev/video1

We will now use pwcview(1) to check how the Camera works.

% pwcview
Webcam set to: 320x240 (sif) at 5 fps

Here is how it looks.


Works! I pixelised the output as I do not have an instagrammer soul …

You can start pwcview(1) with larger resolution when needed.

Camera at mine ThinkPad W520 tops at 1280×720 resolution (HD) and 30 fps for refresh rate.

% pwcview -d /dev/video0 -f 30 -s uxga
Webcam set to: 1280x720 (uxga) at 30 fps

Here is the list of most popular resolutions.

========= ========== ===============
CGA        320x200
SIF        352x240
CIF        352x288
EGA        640x350
VGA        640x480
4SIF/QSIF  704x480   (Quad SIC)
4CIF/QCIF  704x576   (Quad CIF)
SVGA       800x600
XGA       1024x768
720p      1280x720   (HD)
SXGA      1280x1024  (1.3 Megapixel)
WXGA      1366x768   (HD+)
SXGA+     1400x1050
16CIF 	  1408x1152 
WSXGA     1600x1024
UXGA      1600x1200  (2.0 Megapixel)
WSXGA+    1680x1050
1080p     1920x1080  (FullHD)
WUXGA     1920x1200
QXGA      2048x1536  (3.0 Megapixel)
QSXGA     2560x2048  (5.0 Megapixel)
WQSXGA    3200x2048
QUXGA     3200x2400
2160p     3840x2160  (4K)
WQUXGA	  3840x2400

You may also try multimedia/cheese which has more ‘desktop’ interface when plain and simple pwcview(1) tool.

# pkg install multimedia/cheese
% cheese


You may also test your camera online – https://www.onlinemictest.com/webcam-test/ – for example here.


Microphone Setup

You may test your microphone with audio/audacity or multimedia/ffmpeg for example.

You as well use the – https://www.onlinemictest.com/ – online test for your mic.


You can also use audio/sox to record your sound in the terminal.

# pkg install sox celluloid

% pkg which -o $( which rec )
/usr/local/bin/rec was installed by package audio/sox

% rec test.wav

Input File     : 'default' (ossdsp)
Channels       : 2
Sample Rate    : 48000
Precision      : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

In:0.00% 00:00:06.66 [00:00:00.00] Out:315k  [ =====|===== ] Hd:1.9 Clip:0    ^C

% celluloid test.wav

You hear your recording for example in the celluloid(1) player.


ThinkPad Microphone Easter Egg

After I successfully tested the Camera on my ThinkPad W520 I then moved to Microphone testing … to just find out that my microphone is totally deaf. I could not record any sound with audacity(1) or ffmpeg(1).

At the beginning I first suspected it was a FreeBSD problem … unjustifiably fortunately.

Switching Microphone to [Enabled] in the ThinkPad W520 BIOS requires special procedure as shown on the BIOS screenshot below πŸ™‚


1. Set the Microphone to [Enabled].
2. Select Save and Exit option in BIOS.
3. Power off laptop.
4. Disconnect AC power for at least 10 seconds (battery can be attached).
5. Power on laptop.
6. Boot FreeBSD as usual and now recording on Microphone works like a charm πŸ™‚

Why so strange enabling procedure? Some people suggested that it needs to be that complicated to make sure that any third party will not enable your Microphone without your knowledge. Security concerns. Makes sense.


I was able to successfully start/join Google Meet and Zoom and also Teams meetings with this setup. I have also tested and added Jitsi Meet.

Sometimes it just required to use www/chromium instead of my default www/firefox browser.

Here is the detailed list of what works where.

Closing Thoughts

Hope that will helps some of you to use join your meetings on FreeBSD system.


FreeBSD Desktop – Part 25 – Configuration – Random Terminal Theme

Some time ago when I was mostly writing about Openbox setup I also showed how to setup xterm(1) so it will start with new random theme with each start. Since then I reworked that feature a little and also added random theme and background selection for urxvt(1) terminal. This post will guide you through the needed steps to make that setup working.


You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

I already once wrote about random xterm(1) themes in the FreeBSD Desktop – Part 12 – Configuration – Openbox part – but I really wanted to expand that topic and also include other terminals.

After trying many terminal emulators – some more bulky like Konsole/GNOME Terminal/XFCE Terminal/MATE Terminal – some more lightweight like st(1)/rox-term(1)/eterm(1)/… – I always went back to the most old-school and basic one – good old xterm(1) terminal. Mostly because of its good compatibility with all UNIX systems – especially the older ones like IBM AIX or HP-UX. I do not remember last time when I had to manage these archaic systems but the respect for xterm(1) remains.


The other one that always got my attention was urxvt(1) terminal. Unfortunately it has some issues with fonts rendering – making larger spaces between the lines and making fonts bigger for example – but as I also like bitmap fonts like CLEAN or FIXED – so I use bitmap fonts for urxvt(1).

Recently also sakura(1) got my attention – but it’s theming possibilities are even more limited then xterm(1) with themes/colors hardcoded directly into the source code. That is why I will omit it in this article – but I mention it since its also nice terminal.

This is the Table of Contents for this article.

  • xterm(1)
    • Proper Font Selection
    • Selecting Text for Copy/Paste
    • Selection Buffers and Keyboard Shortcuts
    • Increase/Decrease Font Size on the Fly
    • Copy/Paste with [CTRL]+[SHIFT]+[C/V]
    • Interactive Menus
    • Random xterm(1) Theme
  • urxvt(1)
    • Tabbed Interface
    • Daemon and Client Mode
    • Random urxvt(1) Theme and Background
  • sakura(1)
    • Different sakura(1) Themes
  • RAM Usage Comparison
  • CPU Time Usage Comparison


First lest start with some reasonable configuration in the ~/.Xdefaults file. Alternatively some people use ~/.Xresources file. You can use any of them. Just pick one and stick to it.

! -----------------------------------------------------------------------------
  xterm*allowBoldFonts:     true
  xterm*allowWindowOps:     true
  xterm*boldMode:           false
  xterm*charClass:          33:48,35:48,37:48,43:48,45-47:48,64:48,95:48,126:48,35:48,58:48,63:48,61:48,44:48,38:48,59:48
  xterm*cursorBlink:        false
  xterm*cutNewline:         true
  xterm*faceName:           consolas
  xterm*faceSize:           11
  xterm*fastScroll:         true
  xterm*fullscreen:         false
  xterm*iconHint:           /home/vermaden/.icons/vermaden/xterm.xpm
  xterm*internalBorder:     1
  xterm*jumpScroll:         true
  xterm*keepSelection:      true
  xterm*loginShell:         true
  xterm*metaSendsEscape:    true
  xterm*multiScroll:        true
  xterm*omitTranslation:    fullscreen
  xterm*on4Clicks:          group
  xterm*on5Clicks:          page
  xterm*saveLines:          1024000
  xterm*scaleHeight:        1.0
  xterm*scrollKey:          true
  xterm*scrollTtyOutput:    false
  xterm*selectToClipboard:  true
  xterm*SimpleMenu*font:    -*-clean-*-*-*-*-*-*-*-*-*-*-iso8859-2
  xterm*termName:           xterm-256color
  xterm*title:              xterm
  xterm*veryBoldColors:     14
  xterm*VT100*geometry:     150x40
  xterm*VT100*translations: #override                                             \n\
                            <btn1up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0) \n\
                            Ctrl <key> minus: smaller-vt-font()                   \n\
                            Ctrl <key> plus: larger-vt-font()                     \n\
                            Ctrl Shift <key> C: copy-selection(CLIPBOARD)         \n\
                            Ctrl Shift <key> V: insert-selection(CLIPBOARD)

I will not discuss all possible settings as they are well described in the xterm(1) man page but I will comment some more useful and interesting ones.

Proper Font Selection

This advice is not limited to xterm(1) but its worth to mention it. Many times after adding fonts to my system – and renaming them to my ‘standard’ which looks like that one below I was asking myself how to properly specify the variant I need.

% ls -1 ~/.fonts/ubuntu-mono*

The answer to that question comes with fc-match(1) from fontconfig package. Check my ‘queries’ below.

% fc-match consolas:bold
consolas-bold.ttf: "Consolas" "Bold"

% fc-match consolas     
consolas.ttf: "Consolas" "Regular"

% fc-match consolas:bold:italic
consolas-bold-italic.ttf: "Consolas" "Bold Italic"

Selecting Text for Copy/Paste

The xterm*charClass defines which sets of characters should be treated the same when doing cut and paste. Especially with double-clicking the text. The setting above I use is based on 15 years of experience and seems to work best. You are of course encouraged to investigate the CHARACTER CLASSES section of the xterm(1) man page to read more on this topic.

The xterm*on4Clicks and xterm*on5Clicks are not used by default while xterm*on2Clicks are predefined as word and xterm*on3Clicks as line values. This is why I added them so you can select entire group with xterm*on4Clicks and entire page with xterm*on5Clicks option. Alternatively you can also use some fancy regex for some of these ‘CLICKS’ but I never thought about a REGEX that would be useful here – maybe you will come with something sensible.

Here are these ‘CLICKS’ in action.

First the xterm*on2Clicks with word selection. This is when the xterm*charClass is taken into account – what is word and that is not πŸ™‚


Then xterm*on3Clicks with line selection.


Now xterm*on4Clicks with group selection.


Finally the xterm*on5Clicks entire page selection.


Selection Buffers and Keyboard Shortcuts

The last interesting option is xterm.VT100.translations which is used for keyboard shortcuts.

The first one select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0) is better described in the https://davidsimmons.com/soft/xtermhacks/ page from 2005. I will try to short the meritum here. The X11 applications have two different selection buffers:

CLIPBOARD – selection buffer used for cut/paste functions – you select/highlight text and then select Copy from context menu or use [CTRL]+[C] shortcut. Then you use Paste or [CTRL]+[C] shortcut.

PRIMARY – this one receives data when user selects/highlights text with mouse. None other operations such as Copy or Paste are needed. You end selecting the text and its already in PRIMARY buffer. You then paste it with MIDDLE mouse button.

Using the option above selecting/highlighting the text in xterm(1) copies the text into both selection buffers simultaneously. You can now either Paste it info Firefox or hit MIDDLE mouse button to paste it in other xterm(1) terminal. Best of both worlds.

If that setting does not suit you then use the xterm*selectToClipboard instead. When set to true it copies selected text to CLIPBOARD buffer and when set to false it copies selection to the PRIMARY one.

Increase/Decrease Font Size on the Fly

I always missed the shortcuts to decrease or increase font size on the fly in xterm(1) and for many years I believed that its just not possible and then I found some blog post (do not remember which one now of course) in which I found these settings and started to use them.

They are smaller-vt-font() and larger-vt-font() for decrease and increase respectively with [CTRL]+[-] and [CTRL]+[+] shortcuts – keep in mind that [SHIFT] is not used here.

Copy/Paste with [CTRL]+[SHIFT]+[C/V]

If by some reason you prefer to copy and paste by using [CTRL]+[SHIFT]+[C] and [CTRL]+[SHIFT]+[V] shortcuts then copy-selection(CLIPBOARD) and insert-selection(CLIPBOARD) will do the needed job here. As you probably guessed you can use PRIMARY instead of CLIPBOARD here if that is what you desire.

Interactive Menus

The xterm(1) comes with three different interactive menus. I will now show all three of them here with screenshots.

Menu displayed with clicking [CTRL]+[LEFT-MOUSE-BUTTON] in the terminal area.


Menu displayed with clicking [CTRL]+[MIDDLE-MOUSE-BUTTON] in the terminal area.


Menu displayed with clicking [CTRL]+[RIGHT-MOUSE-BUTTON] in the terminal area.


Random xterm(1) Theme

To have random xterm(1) theme on every startup you need four things:

I gathered all these themes all over the Internet, only the VERMADEN and VERMADEN-OLD themes are created by me.

Little preview of some of the included xterm(1) themes.


From now on to have random xterm(1) theme at each start always start it with ~/scripts/xterm.sh script. The script itself is not very complicated. It just draws random theme from the ~/.config/Xdefaults/themes dir – then loads the ~/.Xdefaults config – then merges the colors from chosen random theme – and finally starts new xterm(1) instance.



I use urxvt(1) less often but still sometimes I want to use bitmap fonts instead.


For a start here is the urxvt(1) configuration in the ~/.Xdefaults file.

! -----------------------------------------------------------------------------
  urxvt.letterSpace:    0.0
! urxvt.font:           xft:monaco:pixelsize=9,style=regular,minspace=True
  urxvt.font:           -*-clean-*-*-*-*-*-*-*-*-*-*-iso8859-2
  urxvt.boldFont:       -*-clean-*-*-*-*-*-*-*-*-*-*-iso8859-2
  urxvt.iconFile:       /home/vermaden/.icons/vermaden/xterm.xpm
  urxvt.geometry:       150x40
  urxvt.cutchars:       ,;
  urxvt.scrollBar:      false
  urxvt.imLocale:       en_US.UTF-8
  urxvt.loginShell:     true
  urxvt.saveLines:      1024000
  urxvt.inheritPixmap:  false
  urxvt.shading:        20
  urxvt.xftAntialias:   true
  urxvt.jumpScroll:     true
  urxvt.tintColor:      black
  urxvt.internalBorder: 2
  urxvt.cursorBlink:    false
  urxvt.cursorColor:    #dd9900
  urxvt.cursorColor2:   #000000
  urxvt.colorBD:        #dddddd
  urxvt.colorIT:        #bbbbbb
  urxvt.colorUL:        #999999
  urxvt.underlineColor: #999999

Tabbed Interface

To get tabs in urxvt(1) add the following option to the ~/.Xdefaults configuration file.

  urxvt.perl-ext-common:   default,tabbed

With this option you will open new tab with [SHIFT]+[DOWN] shortcut.

To switch between the tabs left and right use [CTRL]+[SHIFT]+[LEFT] and [CTRL]+[SHIFT]+[RIGHT] shortcut respectively.

You can also use [CTRL]+[LEFT] and [CTRL]+[RIGHT] to move current tab left and right.

The timeless [CTRL]+[D] – which of course is not a strictly urxvt(1) shortcut but a general shortcut for closing all terminals.


Daemon and Client Mode

The urxvt(1) can be run in special daemon mode where you start one urxvtd(1) server and many urxvtc(1) clients.

% urxvtd
rxvt-unicode daemon listening on /home/vermaden/.urxvt/urxvtd-w520.local.

Now you will start each new urxvt(1) terminal with urxvtc(1) command.

The drawback of that approach is that when urxvtd(1) dies or crashes then also all your urxvtc(1) client terminals disappear πŸ™‚

Random urxvt(1) Theme and Background

To have random urxvt(1) theme and background on every startup you need four things:

Little preview of some of the included urxvt(1) themes and backgrounds.


From now on to have random urxvt(1) theme at each start always start it with ~/scripts/urxvt.sh script. The script for urxvt(1) is little more advanced. First it draws random theme from the ~/.config/Xdefaults/themes dir – then checks if its DARK or LIGHT theme – then draws either random LIGHT or DARK background from the ~/.config/Xdefaults/urxvt dir – finally loads the ~/.Xdefaults config and then merges the colors from chosen LIGHT or DARK theme. Of course then it finally starts new urxvt(1) instance.



The more modern and GTK based sakura(1) also supports tabs. To open new tab use [CTRL]+[SHIFT]+[T] shortcut. To switch between the tabs use [CTRL]+[ALT]+[LEFT] and [CTRL]+[ALT]+[RIGHT] shortcuts. You can also move tab between left and right with [CTRL]+[SHIFT]+[LEFT] and [CTRL]+[SHIFT]+[RIGHT].


One things that sakura(1) impresses me is that you can scale down its window and then scale that window up and the contents that did not fit in the window after downscalling are back again in the terminal. Doing the same operation in xterm(1) or urxvt(1) terminals will result in these characters being lost. The output is also dynamically ‘fit’ into the new larger window while maintaining the new lines etc. Besides that nice feature it is small and fast and uses relatively small amount of RAM.


Different sakura(1) Themes

If you would also like to start sakura(1) with different theme everytime the options are quite limited here. The palettes and color sets are hardcoded into the sakura(1) source code.

I will not show you how to modify them using the FreeBSD Ports system.

The sakura(1) port is located at /usr/ports/x11/sakura directory. For the record – I use WRKDIRPREFIX option in the /etc/make.conf file. This means that when I type make extract in the /usr/ports/x11/sakura dir the work directory will not be created at /usr/ports/x11/sakura/work directory but at /usr/ports/obj/usr/ports/x11/sakura/work instead. That way I can clean my Ports tree fast by removing the /usr/ports/obj directory.

We will now extract and patch the sakura(1) port on FreeBSD.

% grep WRKDIRPREFIX /etc/make.conf

# cd /usr/ports/x11/sakura

# make patch

# cd /usr/ports/obj/$( pwd )/work/*/src || cd work/*/src

# pwd

# grep -m 1 DEFAULT_PALETTE sakura.c
#define DEFAULT_PALETTE "tango"

# grep -o -E '[a-z]+_palette\[PALETTE_SIZE\]' sakura.c

As you can see the default sakura(1) palette is Tango. Fortunately you can use palette=solarized_dark option in the ~/.config/sakura/sakura.conf config file to change it into Solarized Dark for example.

Besides hardcoded palettes sakura(1) also has several Color Sets.

If you would like to make random theme (from the hardcoded ones) for each start you would have to use this syntax with prepared dedicated config files for each palette.

% sakura --config-file ~/.config/sakura/sakura.solarized_dark.conf --colorset 1 
% sakura --config-file ~/.config/sakura/sakura.tango.conf          --colorset 3

I do not use sakura(1) that much so I was too lazy to write random startup theme script also for it πŸ™‚

Changing sakura(1) palette or color set manually is shown below.




RAM Usage Comparison

Just started xterm(1) terminal takes about 16 MB or RAM as you have seen on the urxvt(1) screenshots. The urxvt(1) started without tabs uses more then 2 TIMES of xterm(1) terminal RAM usage. The urxvt(1) started in tabbed mode uses more then 3 TIMES of xterm(1) terminal RAM usage. The sakura(1) also uses more then 3 TIMES of xterm(1) terminal RAM usage.

Table below shows RAM usage comparison. I have added more feature packed mate-terminal(1) to the list and also added the st(1) minimalistic terminal from Suckless project for compassion.

    64  mate-terminal
    53  sakura
    52  urxvt (tabbed)
    38  urxvt
    16  xterm
    12  st

CPU Time Usage Comparison

I also made simple benchmark of the CPU used. The ‘benchmark’ was to check how much time each terminal would take to print output ofΒ  dmesg | lolcat -b -r command. Here xterm(1) does not shine that much.

0:00.93  xterm
0:00.82  mate-terminal
0:00.52  sakura
0:00.43  urxvt
0:00.23  st

The above ‘benchmark’ was was quite ‘hard’ because of all the colors generated by lolcat(1) command. Lets try something more practical now. We will measure CPU time used to display out of the find find /usr/local/share/doc command.

0:01.34  xterm
0:01.18  mate-terminal
0:00.85  sakura
0:00.32  urxvt
0:00.28  st

Seems that lolcat(1) was not that ‘hard’. The st(1) minimalistic terminal really seems to suck less here πŸ™‚


FreeBSD Desktop – Part 24 – Configuration – Universal File Opener

More then a decade ago when I started to use X11 as a desktop – on Linux then with KDE3 and later with Fluxbox. At first I thought that files are opened by appropriate applications not by their extension as in Windows systems but according to their Magic Numbers. I do not have to tell you how much disappointed I was when I learned the truth πŸ™‚

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.


Its a short story about cleaning the mess that XDG does and also using custom *.desktop handlers to open the files in the way you want. It know its in the FreeBSD Desktop series but actually it will work on any X11 desktop like Linux or Illumos.

The Table of Contents for the article is right below here.

  • XDG Utils
  • Now You See Me
  • Mime Apps Handlers
  • Generation of Handlers
  • Alternatives

Lets start then.

XDG Utils

After years of using X11 on FreeBSD now with Openbox as my daily driver I used so called xdg-utils package with its *.desktop files. That sometimes driven me nuts. Mess everywhere with doubled ‘the same’ applications listed as possible choices to open a file … almost randomly generated new *.desktop handlers with ‘new’ applications specified to open some files … another dozen of generated *.desktop files from WINE installations … it can only challenge the bullshit and mess of Windows Registry … not sure which one is more messed up (of course its Windows Registry but still).

The xdg-mime(1) is often not useful at all then determining the file type.

$ xdg-mime query filetype FILE.pdf

$ xdg-mime query default application/pdf

If minimalistic mupdf approach is not for you then you can select Atril for example … but you first need to know that is the handler name for the Atril application. You can find that out fast like that.

% find ~/.local/share/applications /usr/local/share/applications | grep atril

We now have the Atril handler name. To set it as new default application for PDF files type the following.

$ xdg-mime default atril.desktop application/pdf

$ xdg-mime query default application/pdf

But this is rather unique moment when XDG works as designed. More often it looks like that.

$ xdg-mime query filetype FILE.doc

$ xdg-mime query filetype FILE.docx

$ xdg-mime query filetype FILE.xls

$ xdg-mime query filetype FILE.xlsx

So when you now ask for application/zip type then what should pop up? LibreOffice for Word/Excel documents or Engrampa for ZIP files?

% xdg-mime query default application/zip                                     

Not very helpful …

Now You See Me

After almost accepting the current ‘tragic’ state of it I came with other idea – to create mine simplified launcher for many of these file types. It started small and is still quite small. The only thing I do now is that I only add new apps for file extensions that are not yet defined.

Its called see.sh and its function is dual:
– to easily replace XDG settings in one place as file opener
– as command line opener for single or multiple files

The construction of see.sh is really simple. It utilizes the idea behind the quote of Antoine de Saint-Exupery which goes like that – “Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” – its really simple and has nothing to remove from it.

I really appreciate that idea that I now do not have to remember which application is needed (and how its spelled besides the zsh(1) TAB completion) to open any file in command line. Its also faster to type then xdg-open(1) and I am sure that its settings were not modified by some third party app that I just installed because its hardcoded in it.

I also really like see.sh for being very elastic for the environment variables with which the needed application can be started. For example my default DPI for X11 session since more then a decade is 75. That makes fonts little smaller – more information fits on the available screen space. The GTK2/GTK3 applications do not need any tweaks and always look decent or even great but QT5 (and QT4 not so long ago) apps are real bitches when you want to force them to look the way you want (look nice) – especially when run without fully fledged KDE or PLASMA environment. One of such applications is LibreOffice. It looked great when it used GTK framework but after they moved to QT it started to look very ugly with my 75 DPI setting. This is how it looks with its environment unmodified.

Thanks to see.sh I can start LibreOffice with different DPI environment setting then 75 and it looks little better with DPI set to 80. LibreOffice started with QT_FONT_DPI=80 option does not look that bad now – its fonts are not that small and ugly anymore.

Now the text labels on LibreOffice menus are more readable but also not too large.

You may also customize see.sh to first create a backup copy before editing certain files or email them – only your imagination limits you here.

I also wanted its see.sh name to be short and fast to type so with completions its just see[TAB] and then a filename. Of course you may want to rename it to shorter version (or create alias) as see without extension but i like to keep my scripts with extension to distinguish them from native commands – but that is me.

First see.sh detects if one or multiple arguments (files) have been passed to it. If its just a single file then see.sh detects its extension and launches the configured application for it.

If file does not have extension then it checks file’s Magic Number. Currently only detection for plain text files is implemented with file(1) command.

If you pass multiple arguments (files) to see.sh then separate see.sh processes will be launched against each given file in parallel. Recursion generally.

Every time you select new application in graphical mode the new *.desktop file is created as a result with userapp-${APPNAME}-${RANDOM_STRING}.desktop name under ~/.local/share/applications directory. I am not sure that its the tidiest way possible. Often very ugly and strange handler filenames are generated – with spaces or quotation marks. Its really far from UNIX way of doing things and its philosophy.

This is how ~/.local/share/applications directory looked on my machine after some time. Notice the selected file.

After some cleanup and modifications it looks little better.

The XDG keeps its associations in the ~/.config/mimeapps.list file. Have a look how messed it gets after some usage.

After some more cleanup and removal of all unneeded userapp-${APPNAME}-${RANDOM_STRING}.desktop entries it starts to look more organized.

Every time see.sh will find out that it does not have handler for a file it will gracefully remind one to configure it.

Mime Apps Handlers

Many of these *.desktop handlers are not present anymore … but which one? Here is a handy one liner that will either show you the full path of the handler or ‘NOPE’ when one does not exists. This will also tell you if its your ‘custom’ handlers at ~/.local/share/applications or the ‘default’ ones that come with packages and installed software located at /usr/local/share/applications location.

% awk -F'=' '{print $2}' ~/.config/mimeapps.list \
    | tr ';' '\n' \
    | sort -u \
    | sed 1d \
    | while read I
        echo ${I}
        find \
          ~/.local/share/applications \
          /usr/local/share/applications \
            | grep "/${I}" || echo NOPE

Well … maybe not exactly ONE liner but a useful command that will do it πŸ™‚

Here is its output.









If you just want to check which ones are missed then add grep -B 1 NOPE at the end.

% awk -F'=' '{print $2}' ~/.config/mimeapps.list \
    | tr ';' '\n' \
    | sort -u \
    | sed 1d \
    | while read I
        echo ${I}
        find \
          ~/.local/share/applications \
          /usr/local/share/applications \
            | grep "/${I}" || echo NOPE
      done | grep -B 1 NOPE

Here is the (un)expected output.

You can safely remove all missing *.desktop handlers from the ~/.config/mimeapps.list file. You may use sed(1) or graphical editor if that suits you better. The logic behind it is to remove all instances of for example presentations-free18.desktop and then find and replace all instances of doubled semicolons ‘;;‘ into single one ‘;‘.

Generation of Handlers

To generate new *.desktop handlers in orderly fashion you can use mine generate-desktop-handler.sh script. It will create new handler in the ~/.local/share/applications directory and it will make sure you are creating one with an application that actually exists. Here is how it works. I have created new handler for my random-wallpaper-always.sh for setting up random wallpaper from specified directory or to set wallpaper from exact specified file as argument.

% generate-desktop-handler.sh                                       
usage: generate-desktop-handler.sh FILE

% generate-desktop-handler.sh non-existing-executable
NOPE: executable 'non-existing-executable' not found in ${PATH}

% generate-desktop-handler.sh random-wallpaper-always.sh 
INFO: handler '~/.local/share/applications/random-wallpaper-always.sh.desktop' was successfully generated

% cat ~/.local/share/applications/random-wallpaper-always.sh.desktop
[Desktop Entry]
Exec=random-wallpaper-always.sh %f

After you have created new random-wallpaper-always.sh.desktop handler you may want to add it to some image file type like JPG or PNG. In the example below I will add it to JPG file.

First right click on a JPG file with mouse and select Open With and then Other Application….

The select random-wallpaper-always.sh.desktop handler on the list. Make sure to UNCHECK the Remember this application for … files option. If you do not do that it will be the DEFAULT application from now and everytime you would want to open JPG file you will set it as wallpaper πŸ™‚

You may verify that new option is added by right clicking the JPG file and selecting Properties and then go to Open With tab. The random-wallpaper-always.sh.desktop handler will be one of the configured handlers for JPG files – but not the default one.

Now you can see that random-wallpaper-always.sh.desktop handler is available to use when selecting the Open With submenu.

As simple as that – and with tidiness as well.


There are some other alternatives to XDG but I am more then sure that most or all X11 applications support XDG way of doing things while not support the other alternative ones. Thus its far less hustle with just making XDG work as desired by generating needed handlers and using see.sh instead of using them and wasting even more time on the topic – at least that is my current experience.

Feel free to share your thoughts on the topic – maybe you will show me even better approach to this.


FreeBSD Desktop – Part 23 – Configuration – Herbe Notifications

I do not use notifications. Dunno really why – seems I just did not needed them. The idea of Do Not Disturb Mode on the desktop/laptop is very strange to me as I ALWAYS work in the Do Not Disturb Mode since I do not use any notifications. Today I came across very small and compact solution for notifications on X11 desktop – herbe – as its author describes it – its daemon-less notifications without D-Bus. Minimal and lightweight.

I was curious if it works on FreeBSD and apparently it is πŸ™‚

Today I will show you how to build, configure and use herbe as part of FreeBSD Desktop series.

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.


We will use the compact git-lite package from FreeBSD which has less dependencies then the default git package. Then we will clone the herbe repository.

# pkg install git-lite
% git clone https://github.com/dudik/herbe
Cloning into 'herbe'...
remote: Enumerating objects: 228, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (38/38), done.
remote: Total 228 (delta 21), reused 11 (delta 4), pack-reused 186
Receiving objects: 100% (228/228), 152.95 KiB | 272.00 KiB/s, done.
Resolving deltas: 100% (118/118), done.
$ cd herbe
% ls -l
total 23K
-rw-r--r-- 1 vermaden vermaden  650 2021-04-18 19:18 config.def.h
-rw-r--r-- 1 vermaden vermaden 5268 2021-04-18 19:18 herbe.c
-rw-r--r-- 1 vermaden vermaden 1070 2021-04-18 19:18 LICENSE
-rw-r--r-- 1 vermaden vermaden  425 2021-04-18 19:18 Makefile
-rw-r--r-- 1 vermaden vermaden 5578 2021-04-18 19:18 README.md


We will need a tiny one line patch to make it build on FreeBSD.

This FreeBSD patch for Makefile file is available here:

… or diff(1) directly here:

We will now apply that patch.

% fetch https://patch-diff.githubusercontent.com/raw/dudik/herbe/pull/16.diff
% patch < 16.diff 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
|diff --git a/Makefile b/Makefile
|index 3225e36..69c8efc 100644
|--- a/Makefile
|+++ b/Makefile
Patching file Makefile using Plan A...
Hunk #1 succeeded at 1.

The herbe is now buildable on FreeBSD.

There are also other available patches – herbe patches – available here.

From all of them I find Vertical Stacking patch the most interesting. We will also apply it.

% fetch https://patch-diff.githubusercontent.com/raw/dudik/herbe/pull/19.diff
% patch < 19.diff 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
|diff --git a/herbe.c b/herbe.c
|index 51d3990..8bfdbc1 100644
|--- a/herbe.c
|+++ b/herbe.c
Patching file herbe.c using Plan A...
Hunk #1 succeeded at 7.
Hunk #2 succeeded at 80.
Hunk #3 succeeded at 162.
Hunk #4 succeeded at 188.
Hunk #5 succeeded at 218.
Hunk #6 succeeded at 230.


You can additionally patch herbe so it will be configurable by using ~/.Xresources or ~/.Xdefaults files. IMHO its so small and compiles in second that its not needed but if you would like to also apply it then its available here – Xresources – in the patches section.

I have chosen to configure it using the config.def.h file. Here are my values.

% cat config.def.h
static const char *background_color    = "#222222";
static const char *border_color        = "#666666";
static const char *font_color          = "#eeeeee";
static const char *font_pattern        = "Ubuntu Mono:size=10";
static const unsigned line_spacing     = 5;
static const unsigned int padding      = 15;

static const unsigned int width       = 550;
static const unsigned int border_size = 4;
static const unsigned int pos_x       = 15;
static const unsigned int pos_y       = 45;

enum corners corner = TOP_RIGHT;

static const unsigned int duration = 5; /* in seconds */

#define DISMISS_BUTTON Button1
#define ACTION_BUTTON Button3


The build process could not be simpler. Just type make and you are done.

% make 
cp config.def.h config.h
cc herbe.c -Wall -Wextra -pedantic -I/usr/local/include -L/usr/local/lib -lX11 -lXft -I/usr/local/include/freetype2 -pthread -o herbe

% file -s herbe | tr ',' '\n'
herbe: ELF 64-bit LSB executable
 version 1 (FreeBSD)
 dynamically linked
 interpreter /libexec/ld-elf.so.1
 for FreeBSD 13.0 (1300139)
 with debug_info
 not stripped

% ./herbe 
Usage: ./herbe body


I did not yet implemented herbe anywhere on my scripts so I will use this simple ‘mockup’ to show you what to expect.

% \
  herbe "Wifi connection 'wireless' is not connected." \
& herbe "Removable storage /dev/da0 automounted at /media/da0 with exFAT filesystem." \

Here is how it looks in real life X11 session.

As you can see it works very well and its ultra fast. Its also very light on system resources.

% ps aux | grep -e RSS -e herbe -e sshd
vermaden 41909   0.0  0.1    19568    9128  3  S+   20:22       0:00.02 herbe Message.
root        38   0.0  0.1    20948    8340  -  Is   Thu23       0:00.00 /usr/sbin/sshd

As you can see its RAM usage is very little – as little as sshd daemon.


FreeBSD Desktop – Part 22 – Configuration – Aero Snap Extended

I like to post new articles and solutions when I think they are ready. Production tested and stable. Well thought and tested … or at least trying to make things as good as possible in the available time window. Perfectionism definitely does not help making often articles on the blog.

Today’s solution is not perfect but I will ‘ship it’ anyway because good and done is better then perfect. I wanted to rework it so many times that I stopped counting … and I really would like to continue the series – thus I have made a conscious decision to finally release it and hope that maybe someone else will have better ideas to make it better. I really wanted to provide pixel perfect solution with as much screen space used as possible but to deliver it as it is I tested it only on the resolution I use the most – the FullHD one with 1920×1080 pixels.

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Aero Snap

Today I would like to share with You what I call Aero Snap Extended. The original Aero Snap was introduced in Windows 7 and this is how it is described in the Wikipedia page – “Dragging a window to the right or left side of the desktop causes the window to fill the respective half of the screen. Snapping a window to the top of the screen maximizes it. Windows can be resized by stretching them to touch the top or bottom of the screen, which fully increases their vertical screen estate, while retaining their width, these windows can then slide horizontally if moved by the title bar, or pulled off, which returns the window to its original height. In spite of the “Aero” moniker, this feature is available if one uses the Classic theme. This feature is also available on Windows 10.”

This is like the original Aero Snap looks like.


The idea behind original Aero Snap was pretty simple. Its basically these four shortcuts.

[WIN] + [LEFT] – will place window on the left half of the screen.
[WIN] + [RIGHT] – will place window on the right half of the screen.
[WIN] + [UP] – will maximize the window.
[WIN] + [DOWN] – will minimize the window.

Aero Snap Extended

Mine Aero Snap Extended is … well more extended πŸ™‚

As usual its just a small POSIX /bin/sh compatible shell script. There are only two dependencies for it – the /usr/local/bin/xdpyinfo from xdpyinfo package and /usr/local/bin/wmctrl from wmctrl package. At the beginning of the script you will find several ‘settings’ that you may find needed to be tuned to your needs. Most important ones are MARGIN_TOP/MARGIN_LEFT/MARGIN_RIGHT options. Unfortunately MARGIN_BOTTOM is not implemented. Sorry.


Here are the shortcuts that I use for mine version but You may of course use other key then [WIN] for it.

(L) [WIN] + [LEFT] – will place window on the left half of the screen.
(R) [WIN] + [RIGHT] – will place window on the right half of the screen.
(U) [WIN] + [UP] – will place window on the upper half of the screen.
(D) [WIN] + [DOWN] – will place window on the lower half of the screen.

Here is ASCII diagram for its graphical visualization.

+------+------+  +-------------+
|      |      |  |     (U)     |
|      |      |  |             |
| (L)  |  (R) |  +-------------+
|      |      |  |             |
|      |      |  |     (D)     |
+------+------+  +-------------+

… and also a live screenshots.



(SL) [WIN] + [SHIFT] + [LEFT] – will place window on the left half of the screen taking 2/3 space of the screen.
(SR) [WIN] + [SHIFT] + [RIGHT] – will place window on the right half of the screen taking 1/3 space of the screen.
(SU) [WIN] + [SHIFT] + [UP] – will place window on the upper half of the screen taking 2/3 space of the screen.
(SD) [WIN] + [SHIFT] + [DOWN] – will place window on the lower half of the screen taking 1/3 space of the screen.

Here is ASCII diagram for its graphical visualization.

+--------+----+  +-------------+
|        |    |  |    (SU)     |
|        |    |  |             |
|  (SL)  |(SR)|  |             |
|        |    |  +-------------+
|        |    |  |    (SD)     |
+--------+----+  +-------------+

… and also a live screenshots.



The above shortcuts are quite simple and easy to remember.

Now here comes when this is more interesting.

Most keyboards – at least those with the best possible keyboard layout in the world – the ANSI standard keyboard (includes 7-row ThinkPad keyboards – have these three keys one next to another – [CTRL] [WIN] [ALT] – some call the [WIN] key as [SUPER] instead. I use [WIN] as it takes shorter to write and it shows where this key came from.

The 87 keys ANSI stand alone keyboard.


The ThinkPad T420s keyboard.


Now back to topic.

How to use these three keys to send windows to various places of the screen to make it easy to memorize and also not to break existing shortcuts … I think I found a way.

{ [CTRL] [WIN] } [ALT] – these two will send windows to the left side of the screen.

[CTRL] { [WIN] [ALT] } – these two will send windows to the right side of the screen.

Now to the point …

(Q1) [CTRL] + [WIN] + [UP] – will take window to the left and upper part of the screen – taking 1/4 of its space.
(Q2) [CTRL] + [WIN] + [DOWN] – will take window to the left and lower part of the screen – taking 1/4 of its space.
(Q3) [WIN] + [ALT] + [UP] – will take window to the right and upper part of the screen – taking 1/4 of its space.
(Q4) [WIN] + [ALT] + [DOWN] – will take window to the right and lower part of the screen – taking 1/4 of its space.

Now for some the exact 1/4 screen for each of these windows may be not suitable.

Thus I also added a modified versions with [SHIFT] key.

(S1) [SHIFT] + [CTRL] + [WIN] + [UP] – will take window to the left and upper part of the screen – taking 2/3 of horizontal and 2/3 vertical space of the screen.
(S2) [SHIFT] + [CTRL] + [WIN] + [DOWN] – will take window to the left and lower part of the screen – taking 2/3 of horizontal and 1/3 vertical space of the screen.
(S3) [SHIFT] + [WIN] + [ALT] + [UP] – will take window to the right and upper part of the screen – taking 1/3 of horizontal and 2/3 vertical space of the screen.
(S4) [SHIFT] + [WIN] + [ALT] + [DOWN] – will take window to the right and lower part of the screen – taking 1/3 of horizontal and 1/3 vertical space of the screen.

Here is ASCII diagram for its graphical visualization.

+------+------+  +--------+----+
| (Q1) | (Q3) |  |  (S1)  |(S3)|
|      |      |  |        |    |
+------+------+  |        |    |
|      |      |  +--------+----+
| (Q2) | (Q4) |  |  (S2)  |(S4)|
+------+------+  +--------+----+

… and also a live screenshots.



Now you have about 95% variations of needed windows places in the keyboard shortcuts.

There are also several complementary addons like making the window centered on the screen but without making it cover the whole screen. As I already use other originated from Windows [ALT] + [ESC] shortcut to send the current windows to the ‘back’ I also added [WIN] + [ESC] for this feature.

(C) [WIN] + [ESC] – place current window centered on screen covering about 2/3 of its space.

As it was relatively easy and fast I also added fullscreen option.

(F) [CTRL] + [ALT] + [F] – make current window go fullscreen

+-------------+  +-------------+
|             |  | +---------+ |
|             |  | |         | |
|     (F)     |  | |   (C)   | |
|             |  | |         | |
|             |  | +---------+ |
+-------------+  +-------------+

… and also a live screenshot.



The Aero Snap Extended has the following options.

% aero-snap.sh

  aero-snap.sh OPTION


  L - place window on left  half of screen
  R - place window on right half of screen
  T - place window on upper half of screen
  B - place window on lower half of screen

  SHIFT-L - place window on left  half of screen taking 2/3 space
  SHIFT-R - place window on right half of screen taking 1/3 space
  SHIFT-T - place window on upper half of screen taking 2/3 space
  SHIFT-B - place window on lower half of screen taking 1/3 space

  TL - place window to left/upper  part of screen
  TR - place window to left/lower  part of screen
  BL - place window to right/upper part of screen
  BR - place window to right/lower part of screen

  SHIFT-TL - use left/upper  part with 2/3 of H. and 2/3 V. space
  SHIFT-TR - use left/lower  part with 2/3 of H. and 1/3 V. space
  SHIFT-BL - use right/upper part with 1/3 of H. and 2/3 V. space
  SHIFT-BR - use right/lower part with 1/3 of H. and 1/3 V. space

  C - center window covering about 2/3 of screen
  F - make current window go fullscreen
  Q - remove fullscreen property from window

The Aero Snap Extended can be downloaded from here – aero-snap.sh – the usual place for my scripts.

Openbox Integration

Because of WordPress limitation I will not post Openbox configuration here but You will also find a link to that content in the text form below.


Here is this configuration in text form – rc.xml.openbox.aero.config – from the same location.

More then a year after I implemented this way of tiling on Openbox I found out that its also possible to use that ‘natively’ on Openbox using ‘direct’ Openbox configuration rules.


It definitely should be faster and easier to implement – not to mention that external dependencies will not be available – but a script allows more tuning and flexibility.

Other Window Managers

If you are not into Openbox then you may create these shortcuts using xbindkeys for example.

Future Work

Mine Aero Snap Extended could use some polish and especially testing in the other resolutions the the well tested 1920×1080.



FreeBSD GNOME 3 Fast Track

This article is dedicated to Abraham Joseph who recently asked me if I could make an article on how to configure GNOME 3 on FreeBSD 12.2. At the moment 12.2-RC3 version is available so that is what I used but it will be the same on FreeBSD 12.2-RELEASE (or 12-STABLE). All commands here are executed as root user.

Here is the Table of Contents for this article.

  • Install
  • Connection to Internet
    • LAN with DHCP
    • LAN with Static IP Address
    • WIFI
    • DNS
  • Packages
  • Settings
  • GNOME 3
  • Fix the Icons
  • Rest of the Setup
  • UPDATE 1 – GDM Icons Fixed


First you will have to install FreeBSD. You may use FreeBSD Handbook or one of my guides – Install FreeBSD 12 – available here.

Connection to Internet

Then after booting to new system you need to get connectivity to the Internet. If its LAN connection then its pretty fast. Its for em0 interface.


# ifconfig em0 up
# dhclient em0

… assuming that you are on the LAN network with DHCP enabled.

To make it permanent put below line to the /etc/rc.conf file.


LAN with Static IP Address

If not then execute these for static IPv4 connection on your em0 interface.

First add these two lines to the /etc/rc.conf file.

ifconfig_em0="inet up"

This is how you /etc/rc.conf file should look like now assuming that you want IP address and gateway.

# grep -A 1 ifconfig /etc/rc.conf
ifconfig_em0="inet up"

Then restart the netif and routing services.

# /etc/rc.d/netif restart
# /etc/rc.d/routing restart


If you want to use WiFi to connect to the Internet then its slightly more typing. On my system I have iwn0 wireless card so that is what I will use here. The SSID is the name of your WiFi network and PSK is password for that network.

# sysctl -n net.wlan.devices
# ifconfig wlan0 create wlandev iwn0
# wpa_passphrase SSID PSK >> /etc/wpa_supplicant.conf
# wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
// wait for CONNECTED state and hit [CTRL]-[Z]
# bg
# dhclient wlan0

To make it permanent across reboots add these to /etc/rc.conf file. I assume that information about your network is already in the /etc/wpa_supplicant.conf file generated by the wpa_passphrase(8) command above.

ifconfig_wlan0="WPA SYNCDHCP"


Last but not least you also need DNS. Put your favorite here or just paste the one below.

# echo nameserver > /etc/resolv.conf


We will now switch to the latest branch or pkg(8) repository and install needed gnome3 and xorg packages.

# sed -i '' s/quarterly/latest/g /etc/pkg/FreeBSD.conf

# grep /latest /etc/pkg/FreeBSD.conf
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",

# pkg install -y gnome3 xorg

# pkg stats | head -3
Local package database:
        Installed packages: 523
        Disk space occupied: 3 GiB


Now you need to add ‘yourself’ to wheel and video groups.

# pw groupmod video -m yourself

# pw groupmod wheel -m yourself

GNOME 3 can not live without the /proc filesystem.

# cat << EOF >> /etc/fstab
proc  /proc  procfs  rw  0  0

Enable needed services.

# sysrc dbus_enable=YES

# sysrc hald_enable=YES

# sysrc gdm_enable=YES

# sysrc gnome_enable=YES

Enable EVDEV support.

# cat << EOF >> /etc/sysctl.conf

Make the boot process faster and more clean.

# cat << EOF >> /boot/loader.conf

Done. Now you can reboot into your new GNOME 3 system on FreeBSD.

# reboot


Your GNOME 3 desktop is now ready and you can login. For the purpose of this article I used asd user.






The default font sizes on GNOME 3 are way too big for me so I tweaked them to 0.8 scale as shown on last screenshot. I also set the font in Terminal app to Monospaced.

Fix the Icons

As you probably saw on the screenshots above the buttons on the windows are broken. There is very simple fix for that. Like shown below on the screenshots first open the Tweak Tool. Then go to Appearance page. The 3rd item from top on the right panel (under the Themes sign) is Icons – please set it to Gnome.





Viola! Now all icons look properly now.

Rest of the Setup

Now there are some things that will need be addressed.

Like with the drawing below, you have just drawn the circles πŸ™‚


Just kidding πŸ™‚

Add your favorite applications with pkg(8) like LibreOffice or Firefox for example.

If you run GNOME 3 on a laptop, then I would suggest adding net-mgmt/networkmgr package to get Networkmgr networking manager from GhostBSD.

I would also suggest using some of the FreeBSD Desktop series articles for the completeness of your GNOME 3 setup. If you need to tweak X11 then check X11 Window System part. I would also suggest visiting Configuration – Fonts & Frameworks for fonts fine tuning. If you want to have automatic mounting of removable media (and you probably do) then check Configuration – Automount Media part. If its laptop then tuning the power management will give you extra battery time. Check the details at The Power to Serve – FreeBSD Power Management part. As you are using GNOME 3 you may want to check Dash to Dock plugin or use Plank described in the Configuration – Plank – Skippy-XD part. If you did not liked the net-mgmt/networkmgr package (Networkmgr from GhostBSD) you may want to try my network.sh solution – FreeBSD Network Management with network.sh – described here.

Not sure what else I can add here as I do not use GNOME 3 daily.

UPDATE 1 – GDM Icons Fixed

Thanks to Romain Tartiere from bsd.network the icons in GDM are now also fixed. The package graphics/ligvrsvg2-rust is now preferred instead of the graphics/librsvg2 package which was used previously.

Here is how now the GDM login page looks like.



FreeBSD Desktop – Part 21 – Configuration – Compton

In this article of the FreeBSD Desktop series I will talk Compton setup – the one that does not breaks, displays everything properly and does not consume 100% of your CPU time, as unfortunately Compton is a real bitch when it comes to proper setup.

The Compton is X11 compositor.

It allows the following features on X11 desktop:

  • transparent windows/menus/titlebars/borders
  • shadows and colored shadows
  • fading effects
  • background bluring

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Here is how example Compton looks in action.


To install Compton on FreeBSD just use the default packages as shown below.

# pkg install compton

X11 Configuration

This is the graphics card configuration I have for X11:

% cat /usr/local/etc/X11/xorg.conf.d/card.conf
Section "Device"
  Identifier "Card0"
  Driver "modesetting"
  Option "DPMS"
  Option "AccelMethod" "glamor"

… and the meritum of this article – the Compton config file:

% cat ~/.config/compton.conf
backend = "glx";
shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 12;
shadow-offset-x = -15;
shadow-offset-y = -15;
shadow-opacity = 0.7;
shadow-exclude = [
    "! name~=''",
    "name = 'Notification'",
    "name = 'Plank'",
    "name = 'Docky'",
    "name = 'Kupfer'",
    "name = 'xfce4-notifyd'",
    "name *= 'VLC'",
    "name *= 'compton'",
    "name *= 'Chromium'",
    "name *= 'Chrome'",
    "name *= 'Firefox'",
    "class_g = 'Conky'",
    "class_g = 'dzen'",
    "class_g = 'dzen2'",
    "class_g = 'Kupfer'",
    "class_g = 'Synapse'",
    "class_g ?= 'Notify-osd'",
    "class_g ?= 'Cairo-dock'",
    "class_g ?= 'Xfce4-notifyd'",
    "class_g ?= 'Xfce4-power-manager'"
shadow-ignore-shaped = false;
menu-opacity = 1;
inactive-opacity = 0.9;
active-opacity = 1;
frame-opacity = 0.9;
inactive-opacity-override = false;
alpha-step = 0.06;
blur-background-fixed = false;
blur-background-exclude = [
    "window_type = 'dock'",
    "window_type = 'desktop'"
fading = true;
fade-delta = 4;
fade-in-step = 0.03;
fade-out-step = 0.03;
fade-exclude = [ ];
mark-wmwin-focused = true;
mark-ovredir-focused = true;
use-ewmh-active-win = true;
detect-rounded-corners = true;
detect-client-opacity = true;
refresh-rate = 0;
vsync = "opengl-swc";
dbe = false;
paint-on-overlay = true;
sw-opti = false;
unredir-if-possible = true;
focus-exclude = [ ];
detect-transient = true;
detect-client-leader = true;
    tooltip =
        fade = true;
        shadow = false;
        opacity = 0.85;
        focus = true;

While the above config works very well I will also add same Compton configuration file but with comments.

% cat ~/.config/compton.conf
# Backend

# Backend to use: "xrender" or "glx".
# GLX backend is typically much faster but depends on a sane driver.
backend = "glx";

# GLX Backend

# GLX backend: Copy unmodified regions from front buffer instead of redrawing them all.
# Tests with nvidia-drivers show 10% decrease in performance when whole screen
# is modified but 20% increase when only 1/4 is modified.
# Tests on nouveau show terrible slowdown.
# Useful with --glx-swap-method as well.
# glx-copy-from-front = false;

# GLX backend: Use MESA_copy_sub_buffer to do partial screen update.
# Tests on nouveau shows 200% performance boost when only 1/4 of screen is updated.
# May break VSync and is not available on some drivers.
# Overrides --glx-copy-from-front.
# glx-use-copysubbuffermesa = true;

# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes
# but is known to break things on some drivers (LLVMpipe).
# Recommended if it works.
# glx-no-rebind-pixmap = true;

# GLX backend: GLX buffer swap method we assume.
# Could be:
# - undefined (0)
# - copy (1)
# - exchange (2)
# - buffer-age (-1)
# The undefined is slowest and safest (default value).
# Copy is fastest but may fail on some drivers.
# buffer-age means auto-detect using GLX_EXT_buffer_age supported by some drivers.
# Useless with --glx-use-copysubbuffermesa.
# Partially breaks --resize-damage.
# Defaults to undefined.
# glx-swap-method = "undefined";

# Shadows

# Enabled client-side shadows on windows.
shadow = true;

# Do not draw shadows on DND windows.
# no-dnd-shadow = true;

# Avoid drawing shadows on dock/panel windows.
no-dock-shadow = true;

# Zero part of shadow's mask behind window. Fix some weirdness with ARGB windows.
clear-shadow = true;

# The blur radius for shadows. (default 12)
shadow-radius = 12;

# The left offset for shadows. (default -15)
shadow-offset-x = -15;

# The top offset for shadows. (default -15)
shadow-offset-y = -15;

# The translucency for shadows. (default .75)
shadow-opacity = 0.7;

# Set if you want different colour shadows
# shadow-red = 0.0;
# shadow-green = 0.0;
# shadow-blue = 0.0;

# The shadow exclude options are helpful if you have shadows enabled.
# Due to way compton draws its shadows certain applications will have
# visual glitches (most applications are fine - only apps that do weird
# things with xshapes or argb are affected).
# The "! name~=''" part excludes shadows on any "Unknown" windows.
# This prevents visual glitch with XFWM alt-tab switcher.
shadow-exclude = [
    "! name~=''",
    "name = 'Notification'",
    "name = 'Plank'",
    "name = 'Docky'",
    "name = 'Kupfer'",
    "name = 'xfce4-notifyd'",
    "name *= 'VLC'",
    "name *= 'compton'",
    "name *= 'Chromium'",
    "name *= 'Chrome'",
    "name *= 'Firefox'",
    "class_g = 'Conky'",
    "class_g = 'dzen'",
    "class_g = 'dzen2'",
    "class_g = 'Kupfer'",
    "class_g = 'Synapse'",
    "class_g ?= 'Notify-osd'",
    "class_g ?= 'Cairo-dock'",
    "class_g ?= 'Xfce4-notifyd'",
    "class_g ?= 'Xfce4-power-manager'"

# Avoid drawing shadow on all shaped windows (see also: --detect-rounded-corners)
shadow-ignore-shaped = false;

# Opacity

# Opacity for menu items.
menu-opacity = 1;

# Opacity for inactive windows.
inactive-opacity = 0.9;

# Opacity for active windows.
active-opacity = 1;

# Opacity for active frame of windows.
frame-opacity = 0.9;

# Opacity for inactive frame of windows.
inactive-opacity-override = false;

# Alpha step.
alpha-step = 0.06;

# Dim inactive windows. (0.0 - 1.0)
# inactive-dim = 0.2;

# Do not let dimness adjust based on window opacity.
# inactive-dim-fixed = true;

# Blur background of transparent windows. Bad performance with X Render backend.
# GLX backend is preferred.
# blur-background = true;

# Blur background of opaque windows with transparent frames as well.
# blur-background-frame = true;

# Do not let blur radius adjust based on window opacity.
blur-background-fixed = false;

# Blue exclude list.
blur-background-exclude = [
    "window_type = 'dock'",
    "window_type = 'desktop'"

# Fading

# Fade windows during opacity changes.
fading = true;

# The time between steps in fade in milliseconds (default 10).
fade-delta = 4;

# Opacity change between steps while fading in (default 0.028).
fade-in-step = 0.03;

# Opacity change between steps while fading out (default 0.03).
fade-out-step = 0.03;

# Fade windows in/out when opening/closing
# no-fading-openclose = true;

# Specify a list of conditions of windows that should not be faded.
fade-exclude = [ ];

# Other

# Try to detect WM windows and mark them as active.
mark-wmwin-focused = true;

# Mark all non-WM but override-redirect windows active (e.g. menus).
mark-ovredir-focused = true;

# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of
# using FocusIn/Out events. Usually more reliable but depends on EWMH-compliant WM.
use-ewmh-active-win = true;

# Detect rounded corners and treat them as rectangular when --shadow-ignore-shaped is on.
detect-rounded-corners = true;

# Detect _NET_WM_OPACITY on client windows useful for window managers not passing
# _NET_WM_OPACITY of client windows to frame windows. This prevents opacity ignore
# for some apps. Without this enabled xfce4-notifyd is 100% opacity no matter what.
detect-client-opacity = true;

# Specify refresh rate. With 0 compton will detect this with X RandR extension.
refresh-rate = 0;

# Set VSync method. VSync methods currently available:
# - none: No VSync
# - drm: VSync with DRM_IOCTL_WAIT_VBLANK. May only work on some drivers.
# - opengl: VSync with SGI_video_sync OpenGL extension. Only on some drivers.
# - opengl-oml: VSync with OML_sync_control OpenGL extension. Only on some drivers.
# - opengl-swc: VSync with SGI_swap_control OpenGL extension. Only on some drivers.
#               Works with GLX backend. Known to be most effective on many drivers.
#               Does not control paint timing - only buffer swap is affected.
#               Does not have effect of --sw-opti unlike other methods. Experimental.
# - opengl-mswc: Try to VSync with MESA_swap_control OpenGL extension.
#                Basically same as opengl-swc above except extension we use.
vsync = "opengl-swc";

# Enable DBE painting mode - use with VSync to (hopefully) eliminate tearing.
dbe = false;

# Painting on X Composite overlay window. Recommended.
paint-on-overlay = true;

# Limit repaint at most once every 1 / refresh_rate second to boost performance.
# This should not be used with --vsync drm/opengl/opengl-oml as they essentially does
# --sw-opti* job unless you wish to have lower refresh rate than actual value.
sw-opti = false;

# Unredirect all windows if full-screen window is detected to maximize performance
# for full-screen windows - like games. Known to cause flickering when
# redirecting/unredirecting windows. Paint-on-overlay may flicker less.
unredir-if-possible = true;

# Specify list of conditions of windows that should always be considered focused.
focus-exclude = [ ];

# Use WM_TRANSIENT_FOR to group windows in same group focused at same time.
detect-transient = true;

# Use WM_CLIENT_LEADER to group windows in same group focused at same time.
# WM_TRANSIENT_FOR has higher priority if --detect-transient is enabled too.
detect-client-leader = true;

# Window Type Settings

    tooltip =
        # fade: Fade particular type of windows.
        fade = true;
        # shadow: Give those windows shadow
        shadow = false;
        # opacity: Default opacity for type of windows.
        opacity = 0.85;
        # focus: Whether to always consider windows of this type focused.
        focus = true;

Not sure what else could I add here so this means the end of this article πŸ™‚


FreeBSD Desktop – Part 20 – Configuration – Unlock Your Laptop with Phone

I really do not like the smart card ecosystem – probably because it will be a big PITA to setup such subsystem on FreeBSD to make it lock/unlock my laptop with a smart card – not to mention of it will be even possible because of probable lack of drivers for a laptop builtin smart card reader. I mention it because you can lock and unlock your laptop with such smart card in very fast way.

Some people use finger prints readers (for fast workstation/laptop unlock purpose) – but its the same case scenario as with smart card – the time needed to setup it properly. Not to mention that is not that fast anyway as I often see my colleagues swinging the finger over the fingerprint reader over and over again so it will finally work the 7th time …

… but you wan also lock and unlock your UNIX laptop with your phone – by just attaching it to your device – this is where the FreeBSD’s devd(8) subsystem come handy.

Today I will show you how to lock/unlock your laptop with your phone.

You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

Keep in mind that in order to make it work you need to attach the phone to laptop using cable that supports data transfer – it will not work with cables that only provide power for charging your phone.

Device Detection

First we need to detect what device will be your locker/unlocker.

Stop the devd(8) daemon.

# service devd stop
Stopping devd.
Waiting for PIDS: 71455.

Now start it in ‘foreground’ for debug purposes and then attach your phone. The command below with grep(1) will help you to find needed information.

# devd -d 2>&1 | grep --line-buffered 'Processing event' | grep --line-buffered DEVICE
Processing event '!system=USB subsystem=DEVICE type=ATTACH ugen=ugen2.3 cdev=ugen2.3 vendor=0x04e8 product=0x6860 devclass=0x00 devsubclass=0x00 sernum="31000e243eb5a12e" release=0x0400 mode=host port=2 parent=ugen2.2'

I have highlited the needed information.

Do not stop this process yet.

Now you know which device will be your locker/unlocker and what even the devd(8) daemon gets when you attach your phone.

Things to note hare are:


This data above is more then enough to unlock your workstation.

Now detach your phone from the computer. You will see the DETACH even similar to the one below.

Processing event '!system=USB subsystem=DEVICE type=DETACH ugen=ugen2.3 cdev=ugen2.3 vendor=0x04e8 product=0x6860 devclass=0x00 devsubclass=0x00 sernum="31000e243eb5a12e" release=0x0400 mode=host port=2 parent=ugen2.2'

Now you know the event that will be spawned when you detach your phone.

Stop the foreground devd(8) daemon and start the service traditionally.

# devd -d 2>&1 | grep --line-buffered 'Processing event' | grep --line-buffered DEVICE
Processing event '!system=USB subsystem=DEVICE type=ATTACH ugen=ugen2.3 cdev=ugen2.3 vendor=0x04e8 product=0x6860 devclass=0x00 devsubclass=0x00 sernum="31000e243eb5a12e" release=0x0400 mode=host port=2 parent=ugen2.2'
Processing event '!system=USB subsystem=DEVICE type=DETACH ugen=ugen2.3 cdev=ugen2.3 vendor=0x04e8 product=0x6860 devclass=0x00 devsubclass=0x00 sernum="31000e243eb5a12e" release=0x0400 mode=host port=2 parent=ugen2.2'
# service devd start
Starting devd.

Commands for Events

Now, what action or command should be executed when you attach or detach your phone? That depends on which screen locker you are using on your X11 setup.

I for example use the mate-screensaver for this purpose.

The ATTACH event in my case would be to kill the current process mate-screensaver which will unlock the screen and then start it again for the next lock purposes – below is the command that I will run for the ATTACH event.

pkill -9 mate-screensaver && su -l vermaden -c 'env DISPLAY=:0 mate-screensaver' &

The DETACH event will be notifying the mate-screensaver to lock the screen – here is the command that will be used for that purpose.

su -l vermaden -c 'env DISPLAY=:0 mate-screensaver-command --lock' &


Here is how the devd(8) config file for my phone would look like.

# cat /usr/local/etc/devd/phonelock.conf

notify 100 {
    match "system" "USB";
    match "subsystem" "DEVICE";
    match "type" "ATTACH";
    match "vendor" "0x04e8";
    match "product" "0x6860";
    match "sernum" "31000e243eb5a12e";
    action "pkill -9 mate-screensaver && su -l vermaden -c 'env DISPLAY=:0 mate-screensaver' &";

notify 100 {
    match "system" "USB";
    match "subsystem" "DEVICE";
    match "type" "DETACH";
    match "vendor" "0x04e8";
    match "product" "0x6860";
    match "sernum" "31000e243eb5a12e";
    action "su -l vermaden -c 'env DISPLAY=:0 mate-screensaver-command --lock' &";

Now restart the devd(8) daemon so it will read new configuration files.

# service devd restart
Stopping devd.
Waiting for PIDS: 1458.
Starting devd.

Viola! Now you can lock and unlock your screen just by attaching or detaching your phone. I do not have any fancy video on how it behaves but you must trust me that is less then a second to lock and unlock the laptop now – be sure to keep and additional eye on your phone now, as it can unlock the access to all your files now πŸ™‚

You can of course use any USB device or even network actions – any event that is supported by the devd(8) daemon.

You can of course create such lock/unlock config when you attach/detach your phone and additionally configure power down action when you detach other USB device.

I forgot to mention it, that method does not disables the ‘classic’ password authentication – it just adds automatic screen lock/unlock when you attach your phone – you can still login (unlock) using just password on the mate-screensaver lock screen.

UPDATE 1 – Better devd Sniffing – Better Unlock Method

As oh5nxo from Reddit suggested its not needed to stop devd and start it in ‘debug’ mode – its easier just to attach to its ‘pipe’ with nc(1) tool.

# nc -U /var/run/devd.pipe

There is also no need to kill(1) the mate-screensaver command, its more elegant to just send the mate-screensaver-command --unlock command.

Below is the updated /usr/local/etc/devd/phonelock.conf config file for the devd(8) daemon.

# cat /usr/local/etc/devd/phonelock.conf

notify 100 {
    match "system" "USB";
    match "subsystem" "DEVICE";
    match "type" "ATTACH";
    match "vendor" "0x04e8";
    match "product" "0x6860";
    match "sernum" "33000e343fb4a42d";
    action "su -l vermaden -c 'env DISPLAY=:0 mate-screensaver-command --unlock' &";

notify 100 {
    match "system" "USB";
    match "subsystem" "DEVICE";
    match "type" "DETACH";
    match "vendor" "0x04e8";
    match "product" "0x6860";
    match "sernum" "33000e343fb4a42d";
    action "su -l vermaden -c 'env DISPLAY=:0 mate-screensaver-command --lock' &";


FreeBSD Desktop – Part 19 – Configuration – Plank – Skippy-XD

Long time no see :). In this article of the FreeBSD Desktop series we will add Plank and Skippy-XD to the existing setup.

I will share with You Plank configuration along with theme that fits to the rest of the setup. Plank is an open implementation of the ideas that was brought to life by Mac OS X (macOS) Dock. We will also add Skippy-XD tool that implements Mac OS X (macOS) Expose ideas.

One my ask why use Plank while we already have Tint2 for similar purposes? While both support autohide I prefer to see Tint2 all the time to get basic/fast idea about what is launched on which desktop and have Plank hidden as it does not hurt and sometimes helps.

Here is both Mac OS X (macOS) Dock and Expose in action.


You may want to check other articles in the FreeBSD Desktop series on the FreeBSD Desktop – Global Page where you will find links to all episodes of the series along with table of contents for each episode’s contents.

To install both Plank and Skippy-XD on FreeBSD just use the default packages as shown below.

# pkg install skippy-xd plank


Here is how Plank dock composes with the rest of the setup.


The Plank dock comes with graphical preferences window if needed but you need to launch it from the command line as plank --preferences command.


Here is the used Plank theme which is kept in the ~/.local/share/plank/themes/vermaden/dock.theme file.

% grep '^[^#]' ~/.local/share/plank/themes/vermaden/dock.theme




And here are mine Plank dock settings which are kept in the ~/.config/plank/dock1/settings file.

% grep '^[^#]' ~/.config/plank/dock1/settings



You may wonder why the XD in the Skippy name. Its because Skippy started as a pure software solution – which unfortunately was quite slow – especially in the times when Skippy was introduced, and it was about a decade ago. Then Skippy developers rewrote it to use the – new then XDAMAGE module for X11 – from this change Skippy started to work almost instantly – and this was marked in its name and it remains to this date as Skippy-XD.

This is how Skippy-XD looks like.


The Skippy-XD does not need/support themes – it just has a configuration file located at ~/.config/skippy-xd/skippy-xd.rc place.

% grep '^[^#]' ~/.config/skippy-xd/skippy-xd.rc

distance = 50
useNetWMFullscreen = true
ignoreSkipTaskbar = true
updateFreq = 30.0
lazyTrans = true
pipePath = /tmp/skippy-xd-fifo
movePointerOnStart = true
movePointerOnSelect = true
movePointerOnRaise = true
switchDesktopOnActivate = true
useNameWindowPixmap = false
forceNameWindowPixmap = false
includeFrame = true
allowUpscale = true
showAllDesktops = true
showUnmapped = true
preferredIconSize = 32
clientDisplayModes = thumbnail icon filled none
iconFillSpec = orig mid mid #666666
fillSpec = orig mid mid #FFFFFF
background =

showAll = true

tint = black
tintOpacity = 0
opacity = 200

tint = #202020
tintOpacity = 64
opacity = 255

show = true
followsMouse = true
offsetX = 20
offsetY = 20
align = left
border = #111111
background = #333333
opacity = 128
text = #eedddd
textShadow = none
font = ubuntu-10:weight=normal

miwMouse1 = focus
miwMouse2 = close-ewmh
miwMouse3 = iconify

One of the nice features of Skippy-XD is that you can configure it per desktop or globally per all currently existing virtual desktops. I also prefer to display window thumbnails only from the windows that exist on the current desktop. You can of course change that behavior with the Skippy-XD config file.


Fix Broken Dependency on FreeBSD

Dunno about you but I update my packages often … and I have lots of them, more then 1000 actually.

% pkg info | wc -l

… but its not much, they are mostly dependencies to to software that I use.

For example I need Openbox and X11 but to use them I need 300+ dependencies in libraries and protocols, and its OK, that’s how it works … but sometimes after the upgrade one or two applications forbid to start because of missing dependency. I would sa that it happens one in twenty to thirty updates (1/20 – 1/30) which is very rare and even if it happens its very easy to solve. I also happened to me on Linux systems many times so its not FreeBSD only related, its just how open source desktop/laptop market works πŸ™‚

Today’s victim will be Chromium. I generally use Firefox but sometimes when a page behaves strangely in Firefox I verify this behavior in Chromium. I also use Chromium as file opener (or file browser should I say) for the *.htm/*.html/*.chm local files. But this time it forbid to start, so I went to the command line to check what went wrong.

% chrome
Shared object "libx264.so.155" not found, required by "libavcodec.so.58"

… a missing dependency in the form of libx264.so.155 library.

Reckless Symlink

This method is considered dangerous or quick and dirty way of fixing such problems – it can also introduce other problems by itself – but still – in many cases it temporary solves the problem.

… and its exactly that – a quick fix till the ffmpeg package finishes its rebuild – it takes longer then pkg upgrade command but when I need Chromium now its NOW, not later when ffmpeg package will be rebuilt. This problem is caused by lack of guts of the FreeBSD project to provide lame package. OpenBSD guys does not have problem with that but FreeBSD guys do, so to have MP3 support in ffmpeg you need to first manually build lame package and then select it as option in ffmpeg and again built is as package … and do that everytime you run pkg upgrade command … which is PITA to say the least.

This is why I use pkg-recompile.sh script for that purpose – to not do that β€˜by hand’ everytime I update packages (which is about two times a week). This is the β€˜workflow’ if I can call it like that:

# pkg upgrade
# pkg-recompile.sh build

Lets verify it something else is not missing for Chromium then.

% which chrome

% ldd /usr/local/bin/chrome
ldd: /usr/local/bin/chrome: not a dynamic executable

So /usr/local/bin/chrome is just a wrapper, let’s see what it contains.

% cat /usr/local/bin/chrome

if [ "`/sbin/sysctl -n $SYSCTL`" = 0 ] ; then
        cat << EOMSG
For correct operation, shared memory support has to be enabled
in Chromium by performing the following command as root :

sysctl $SYSCTL=1

To preserve this setting across reboots, append the following
to /etc/sysctl.conf :

        exit 1
ulimit -c 0
exec /usr/local/share/chromium/chrome ${1+"$@"}

So our binary actually is /usr/local/share/chromium/chrome file, lets check it with ldd(8) then.

% ldd /usr/local/share/chromium/chrome
        libthr.so.3 => /lib/libthr.so.3 (0x809b78000)
        libX11.so.6 => /usr/local/lib/libX11.so.6 (0x809da0000)
        libX11-xcb.so.1 => /usr/local/lib/libX11-xcb.so.1 (0x80a0df000)
        libxcb.so.1 => /usr/local/lib/libxcb.so.1 (0x80a2e0000)
        libXcomposite.so.1 => /usr/local/lib/libXcomposite.so.1 (0x80a506000)
        libXcursor.so.1 => /usr/local/lib/libXcursor.so.1 (0x80a708000)
        libXdamage.so.1 => /usr/local/lib/libXdamage.so.1 (0x80a913000)
        libXext.so.6 => /usr/local/lib/libXext.so.6 (0x80ab15000)
        libXfixes.so.3 => /usr/local/lib/libXfixes.so.3 (0x80ad26000)
        libXi.so.6 => /usr/local/lib/libXi.so.6 (0x80af2b000)
        libXrender.so.1 => /usr/local/lib/libXrender.so.1 (0x80b139000)
        libXtst.so.6 => /usr/local/lib/libXtst.so.6 (0x80b342000)
        libgmodule-2.0.so.0 => /usr/local/lib/libgmodule-2.0.so.0 (0x80b547000)
        libglib-2.0.so.0 => /usr/local/lib/libglib-2.0.so.0 (0x80b74a000)
        libgobject-2.0.so.0 => /usr/local/lib/libgobject-2.0.so.0 (0x80ba61000)
        libgthread-2.0.so.0 => /usr/local/lib/libgthread-2.0.so.0 (0x80bcab000)
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x80beac000)
        libnss3.so => /usr/local/lib/nss/libnss3.so (0x80c0b7000)
        libsmime3.so => /usr/local/lib/nss/libsmime3.so (0x80c3e3000)
        libnssutil3.so => /usr/local/lib/nss/libnssutil3.so (0x80c60d000)
        libplds4.so => /usr/local/lib/libplds4.so (0x80c83d000)
        libplc4.so => /usr/local/lib/libplc4.so (0x80ca40000)
        libnspr4.so => /usr/local/lib/libnspr4.so (0x80cc44000)
        libdl.so.1 => /usr/lib/libdl.so.1 (0x80ce83000)
        libcups.so.2 => /usr/local/lib/libcups.so.2 (0x80d084000)
        libxml2.so.2 => /usr/local/lib/libxml2.so.2 (0x80d315000)
        libfontconfig.so.1 => /usr/local/lib/libfontconfig.so.1 (0x80d6a8000)
        libdbus-1.so.3 => /usr/local/lib/libdbus-1.so.3 (0x80d8ef000)
        libexecinfo.so.1 => /usr/lib/libexecinfo.so.1 (0x80db40000)
        libkvm.so.7 => /lib/libkvm.so.7 (0x80dd43000)
        libutil.so.9 => /lib/libutil.so.9 (0x80df51000)
        libXss.so.1 => /usr/local/lib/libXss.so.1 (0x80e165000)
        libwebpdemux.so.2 => /usr/local/lib/libwebpdemux.so.2 (0x80e367000)
        libwebpmux.so.3 => /usr/local/lib/libwebpmux.so.3 (0x80e56b000)
        libwebp.so.7 => /usr/local/lib/libwebp.so.7 (0x80e775000)
        libfreetype.so.6 => /usr/local/lib/libfreetype.so.6 (0x80ea05000)
        libjpeg.so.8 => /usr/local/lib/libjpeg.so.8 (0x80ecbb000)
        libexpat.so.1 => /usr/local/lib/libexpat.so.1 (0x80ef4e000)
        libharfbuzz.so.0 => /usr/local/lib/libharfbuzz.so.0 (0x80f179000)
        libdrm.so.2 => /usr/local/lib/libdrm.so.2 (0x80f458000)
        libXrandr.so.2 => /usr/local/lib/libXrandr.so.2 (0x80f66b000)
        libgio-2.0.so.0 => /usr/local/lib/libgio-2.0.so.0 (0x80f875000)
        libavcodec.so.58 => /usr/local/lib/libavcodec.so.58 (0x80fe00000)
        libavformat.so.58 => /usr/local/lib/libavformat.so.58 (0x811800000)
        libavutil.so.56 => /usr/local/lib/libavutil.so.56 (0x811c52000)
        libopenh264.so.4 => /usr/local/lib/libopenh264.so.4 (0x811eca000)
        libasound.so.2 => /usr/local/lib/libasound.so.2 (0x8121da000)
        libsnappy.so.1 => /usr/local/lib/libsnappy.so.1 (0x8124de000)
        libopus.so.0 => /usr/local/lib/libopus.so.0 (0x8126e6000)
        libpangocairo-1.0.so.0 => /usr/local/lib/libpangocairo-1.0.so.0 (0x812956000)
        libpango-1.0.so.0 => /usr/local/lib/libpango-1.0.so.0 (0x812b63000)
        libcairo.so.2 => /usr/local/lib/libcairo.so.2 (0x812db1000)
        libGL.so.1 => /usr/local/lib/libGL.so.1 (0x8130d8000)
        libpci.so.3 => /usr/local/lib/libpci.so.3 (0x813366000)
        libatk-1.0.so.0 => /usr/local/lib/libatk-1.0.so.0 (0x813571000)
        libatk-bridge-2.0.so.0 => /usr/local/lib/libatk-bridge-2.0.so.0 (0x81379c000)
        libatspi.so.0 => /usr/local/lib/libatspi.so.0 (0x8139cc000)
        libFLAC.so.8 => /usr/local/lib/libFLAC.so.8 (0x813bfd000)
        libgtk-3.so.0 => /usr/local/lib/libgtk-3.so.0 (0x814000000)
        libgdk-3.so.0 => /usr/local/lib/libgdk-3.so.0 (0x8148b9000)
        libcairo-gobject.so.2 => /usr/local/lib/libcairo-gobject.so.2 (0x814bb0000)
        libgdk_pixbuf-2.0.so.0 => /usr/local/lib/libgdk_pixbuf-2.0.so.0 (0x814db8000)
        libxslt.so.1 => /usr/local/lib/libxslt.so.1 (0x814fdb000)
        libz.so.6 => /lib/libz.so.6 (0x815218000)
        liblzma.so.5 => /usr/lib/liblzma.so.5 (0x815430000)
        libm.so.5 => /lib/libm.so.5 (0x815659000)
        librt.so.1 => /usr/lib/librt.so.1 (0x815886000)
        libc++.so.1 => /usr/lib/libc++.so.1 (0x815a8c000)
        libcxxrt.so.1 => /lib/libcxxrt.so.1 (0x815d5a000)
        libc.so.7 => /lib/libc.so.7 (0x800823000)
        libXau.so.6 => /usr/local/lib/libXau.so.6 (0x815f79000)
        libXdmcp.so.6 => /usr/local/lib/libXdmcp.so.6 (0x81617c000)
        libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x816381000)
        libpcre.so.1 => /usr/local/lib/libpcre.so.1 (0x81667c000)
        libffi.so.6 => /usr/local/lib/libffi.so.6 (0x81691a000)
        libgnutls.so.30 => /usr/local/lib/libgnutls.so.30 (0x816b21000)
        libavahi-common.so.3 => /usr/local/lib/libavahi-common.so.3 (0x816ed4000)
        libavahi-client.so.3 => /usr/local/lib/libavahi-client.so.3 (0x8170e0000)
        libcrypt.so.5 => /lib/libcrypt.so.5 (0x8172ef000)
        libelf.so.2 => /lib/libelf.so.2 (0x81750e000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x817725000)
        libbz2.so.4 => /usr/lib/libbz2.so.4 (0x817934000)
        libgraphite2.so.3 => /usr/local/lib/libgraphite2.so.3 (0x817b48000)
        libswresample.so.3 => /usr/local/lib/libswresample.so.3 (0x817d71000)
        libvpx.so.6 => /usr/local/lib/libvpx.so.6 (0x818000000)
        libdav1d.so.1 => /usr/local/lib/libdav1d.so.1 (0x818411000)
        libmp3lame.so.0 => /usr/local/lib/libmp3lame.so.0 (0x818732000)
        libtheoraenc.so.1 => /usr/local/lib/libtheoraenc.so.1 (0x8189b3000)
        libtheoradec.so.1 => /usr/local/lib/libtheoradec.so.1 (0x818be2000)
        libvorbis.so.0 => /usr/local/lib/libvorbis.so.0 (0x818df3000)
        libvorbisenc.so.2 => /usr/local/lib/libvorbisenc.so.2 (0x819024000)
        libx264.so.155 => not found (0)
        libx265.so.170 => /usr/local/lib/libx265.so.170 (0x819400000)
        libxvidcore.so.4 => /usr/local/lib/libxvidcore.so.4 (0x819b4b000)
        libva.so.2 => /usr/local/lib/libva.so.2 (0x819e70000)
        libgmp.so.10 => /usr/local/lib/libgmp.so.10 (0x81a096000)
        libva-drm.so.2 => /usr/local/lib/libva-drm.so.2 (0x81a316000)
        libva-x11.so.2 => /usr/local/lib/libva-x11.so.2 (0x81a518000)
        libvdpau.so.1 => /usr/local/lib/libvdpau.so.1 (0x81a71d000)
        libpangoft2-1.0.so.0 => /usr/local/lib/libpangoft2-1.0.so.0 (0x81a920000)
        libfribidi.so.0 => /usr/local/lib/libfribidi.so.0 (0x81ab36000)
        libpixman-1.so.0 => /usr/local/lib/libpixman-1.so.0 (0x81ad4c000)
        libEGL.so.1 => /usr/local/lib/libEGL.so.1 (0x81b016000)
        libpng16.so.16 => /usr/local/lib/libpng16.so.16 (0x81b24e000)
        libxcb-shm.so.0 => /usr/local/lib/libxcb-shm.so.0 (0x81b489000)
        libxcb-render.so.0 => /usr/local/lib/libxcb-render.so.0 (0x81b68b000)
        libxcb-dri3.so.0 => /usr/local/lib/libxcb-dri3.so.0 (0x81b898000)
        libxcb-xfixes.so.0 => /usr/local/lib/libxcb-xfixes.so.0 (0x81ba9b000)
        libxcb-present.so.0 => /usr/local/lib/libxcb-present.so.0 (0x81bca2000)
        libxcb-sync.so.1 => /usr/local/lib/libxcb-sync.so.1 (0x81bea4000)
        libxshmfence.so.1 => /usr/local/lib/libxshmfence.so.1 (0x81c0aa000)
        libglapi.so.0 => /usr/local/lib/libglapi.so.0 (0x81c2ab000)
        libxcb-glx.so.0 => /usr/local/lib/libxcb-glx.so.0 (0x81c505000)
        libxcb-dri2.so.0 => /usr/local/lib/libxcb-dri2.so.0 (0x81c71e000)
        libXxf86vm.so.1 => /usr/local/lib/libXxf86vm.so.1 (0x81c922000)
        libogg.so.0 => /usr/local/lib/libogg.so.0 (0x81cb26000)
        libXinerama.so.1 => /usr/local/lib/libXinerama.so.1 (0x81cd2c000)
        libxkbcommon.so.0 => /usr/local/lib/libxkbcommon.so.0 (0x81cf2e000)
        libwayland-cursor.so.0 => /usr/local/lib/libwayland-cursor.so.0 (0x81d16b000)
        libwayland-egl.so.1 => /usr/local/lib/libwayland-egl.so.1 (0x81d372000)
        libwayland-client.so.0 => /usr/local/lib/libwayland-client.so.0 (0x81d573000)
        libepoxy.so.0 => /usr/local/lib/libepoxy.so.0 (0x81d782000)
        libp11-kit.so.0 => /usr/local/lib/libp11-kit.so.0 (0x81da91000)
        libtasn1.so.6 => /usr/local/lib/libtasn1.so.6 (0x81ddb2000)
        libnettle.so.6 => /usr/local/lib/libnettle.so.6 (0x81dfc7000)
        libhogweed.so.4 => /usr/local/lib/libhogweed.so.4 (0x81e1ff000)
        libidn2.so.0 => /usr/local/lib/libidn2.so.0 (0x81e435000)
        libunistring.so.2 => /usr/local/lib/libunistring.so.2 (0x81e653000)
        libgbm.so.1 => /usr/local/lib/libgbm.so.1 (0x81ea07000)
        libwayland-server.so.0 => /usr/local/lib/libwayland-server.so.0 (0x81ec15000)
        libepoll-shim.so.0 => /usr/local/lib/libepoll-shim.so.0 (0x81ee28000)

Lots of deps here, lets cut to the point with grep(1) as shown below.

% ldd /usr/local/share/chromium/chrome | grep found
        libx264.so.155 => not found (0)

Only one – libx264.so.155 – dependency is missing. Let’s fix it then.

% cd /usr/local/lib
% ls -l libx264.so*
lrwxr-xr-x  1 root  wheel       14 2019.03.19 02:11 libx264.so -> libx264.so.157
-rwxr-xr-x  1 root  wheel  2090944 2019.03.19 02:11 libx264.so.157

There is little newer version available libx264.so.157 so we will link to it with our ‘missing’ libx264.so.155 name.

# pwd
# ln -s libx264.so libx264.so.155
# ls -l libx264.so*
lrwxr-xr-x  1 root  wheel       14 2019.03.19 02:11 libx264.so -> libx264.so.157
lrwxr-xr-x  1 root  wheel       10 2019.03.21 15:26 libx264.so.155 -> libx264.so
-rwxr-xr-x  1 root  wheel  2090944 2019.03.19 02:11 libx264.so.157

Chromium should be happy now.

% ldd /usr/local/share/chromium/chrome | grep found

Zero not found results.

Let’s start Chromium then with chrome command.

% chrome

Starts as usual and everything works πŸ™‚

This whole process can be visualized with this simple screenshots below.


Using /etc/libmap.conf File

Instead making ad symlink – which will work globally – you can create the proper libmap.conf file with configuration only for /usr/local/share/chromium/chrome binary.

Here is the fix only for Chromium browser.

# cat /etc/libmap.conf

libx264.so.155 libx264.so

… and equivalent solution that works globally as symlink would be as follows.

# cat /etc/libmap.conf

libx264.so.155 libx264.so

Its also easier to migrate or mass populate such changes instead of copying a symlink.

Fixing Broken Dependency in pkg(8) Database

I already wrote about it in the Less Known pkg(8) Features article but its worth mentioning here for the completeness of options.

There was time when one missing dependency about vulnerable www/libxul19 package started to torture me for some time.

I was even desperate to compile everything with portmaster already.

I started with portmaster --check-depends command, but said no ‘n‘ when asked for fix as it will downgrade a lot of packages needlessly.

# portmaster --check-depends
Checking dependencies: evince
graphics/evince has a missing dependency: www/libxul19

>>> Missing package dependencies were detected.
>>> Found 1 issue(s) in total with your package database.

The following packages will be installed:

        Downgrading perl: 5.14.2_3 -> 5.14.2_2
        Downgrading glib: 2.34.3 -> 2.28.8_5
        Downgrading gio-fam-backend: 2.34.3 -> 2.28.8_1
        Downgrading libffi: 3.0.12 -> 3.0.11
        Downgrading gobject-introspection: 1.34.2 -> 0.10.8_3
        Downgrading atk: 2.6.0 -> 2.0.1
        Downgrading gdk-pixbuf2: 2.26.5 -> 2.23.5_3
        Downgrading pango: 1.30.1 -> 1.28.4_1
        Downgrading gtk-update-icon-cache: 2.24.17 -> 2.24.6_1
        Downgrading dbus: 1.6.8 -> 1.4.14_4
        Downgrading gtk: 2.24.17 -> 2.24.6_2
        Downgrading dbus-glib: 0.100.1 -> 0.94
        Installing libxul:

The installation will require 66 MB more space

38 MB to be downloaded

>>> Try to fix the missing dependencies [y/N]: n
>>> Summary of actions performed:

www/libxul19 dependency failed to be fixed

>>> There are still missing dependencies.
>>> You are advised to try fixing them manually.

>>> Also make sure to check 'pkg updating' for known issues.

Lets see what pkg(8) shows we have installed.

# pkg info | grep libxul
libxul-10.0.12                 Mozilla runtime package that can be used to bootstrap XUL+XPCOM apps

# pkg info -qoa | grep libxul

So the problem is that we have installed www/libxul instead of www/libxul19 and that is why portmaster (and not only) complains about it.

Before pkg(8) was introduced it was easy just to grep -r the entire /var/db/pkg directory with its ‘file database’ but now its quite more complicated as the package database is kept in SQLite database. Using pkg shell command You can connect to that database. Lets check what we can find there.

# pkg shell
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .databases
seq  name             file
---  ---------------  ----------------------------------------------------------
0    main             /var/db/pkg/local.sqlite
sqlite> .tables
categories       licenses         pkg_directories  scripts
deps             mtree            pkg_groups       shlibs
directories      options          pkg_licenses     users
files            packages         pkg_shlibs
groups           pkg_categories   pkg_users
sqlite> .header on
sqlite> .mode column
sqlite> pragma table_info(deps);
cid         name        type        notnull     dflt_value  pk
----------  ----------  ----------  ----------  ----------  ----------
0           origin      TEXT        1                       1
1           name        TEXT        1                       0
2           version     TEXT        1                       0
3           package_id  INTEGER     0                       1
sqlite> .quit

So now we know that ‘deps‘ table is probably what we are looking for ;).

As pkg shell is quite limited for SQLite ‘browsing’ I will use the sqlite3 command itself. By limited I mean that You can not type pkg shell "select * from deps;" query, You first need to start pkg shell and then You can type your query.

# sqlite3 -column /var/db/pkg/local.sqlite "select * from deps;" | grep libxul
www/libxul19   libxul  104

The second column is name so lets try to use it.

sqlite3 -header -column /var/db/pkg/local.sqlite "select * from deps where name='libxul';"
origin        name        version     package_id
------------  ----------  ----------  ----------
www/libxul19  libxul  104

So now we have the ‘problematic’ dependency entry nailed, lets modify it a little to the real installed packages state.

# sqlite3 /var/db/pkg/local.sqlite "update deps set origin='www/libxul' where name='libxul';"
# sqlite3 /var/db/pkg/local.sqlite "update deps set version='10.0.12' where name='libxul';"

You can of course use the ‘official’ way by using the pkg shell command.

# pkg shell
SQLite version 3.7.13 2012-06-11 02:05:22
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> update deps set origin='www/libxul' where name='libxul';
sqlite> update deps set version='10.0.12' where name='libxul';
sqlite> .header on
sqlite> .mode column
sqlite> select * from deps where name='libxul';
origin      name        version     package_id
----------  ----------  ----------  ----------
www/libxul  libxul      10.0.12     104
sqlite> .quit

Now portmaster is happy and does not complain about any missing dependencies.

# portmaster --check-depends
Checking dependencies: zenity
Checking dependencies: zip
Checking dependencies: zsh

Viola! Problem solved πŸ˜‰

… but pkg(8) has a tool for that already πŸ™‚

Its called pkg set and two most useful options from man pkg-set are.

  -n oldname:newname, --change-name oldname:newname
       Change the package name of a given dependency from oldname to newname.


  -o oldorigin:neworigin, --change-origin oldorigin:neworigin
       Change the port origin of a given dependency from oldorigin to neworigin.
       This corresponds to the port directory that the package originated from.
       Typically, this is only needed for upgrading a library or package that
       has MOVED or when the default version of a major port dependency changes.
       (DEPRECATED) Usually this will be explained in /usr/ports/UPDATING.
       Also see pkg-updating(8) and EXAMPLES.

In our case we would use pkg set -o www/libxul19:www/libxul command.

Not sure if it will solve that problem in the same way as I also updated the version in the database.

Use pkg_libchk from bsdadminscripts2 Package

There is also other way to fix/check for such problems – its the pkg_libchk from the bsdadminscripts2 package. Keep in mind that there are TWO conflicting (!) packages with bsdadminscripts in their name.

# pkg search bsdadmin
bsdadminscripts-6.1.1_8        Collection of administration scripts
bsdadminscripts2-0.2.1         BSD Administration Scripts 2


… and once you install bsdadminscripts2 you will not be able to install bsdadminscripts because they are conflicting. I already had bsdadminscripts2 installed and wanted to add bsdadminscripts to my system.

# pkg install bsdadminscripts
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking integrity... done (1 conflicting)
  - bsdadminscripts-6.1.1_8 conflicts with bsdadminscripts2-0.2.1 on /usr/local/sbin/distviper
Checking integrity... done (0 conflicting)
The following 2 package(s) will be affected (of 0 checked):

Installed packages to be REMOVED:

New packages to be INSTALLED:
        bsdadminscripts: 6.1.1_8

Number of packages to be removed: 1
Number of packages to be installed: 1

Proceed with this action? [y/N]: n

Here is the description of the /usr/ports/ports-mgmt/bsdadminscripts2 port/package.

# cat /usr/ports/ports-mgmt/bsdadminscripts2/pkg-descr
This is a collection of scripts around the use of ports and packages.

It allows you to: 
- check library dependencies without producing false positives (pkg_libchk)
- lets you manage the autoremove flag for leaf packages (pkg_trim)
- remove obsolete or damaged distfiles (distviper)
- manage build flags (buildflags.conf)
- auto-create pkg-plist files taking port options into account (makeplist)

WWW: https://github.com/lonkamikaze/bsda2

There are exactly 4 tools in this package.

% pkg info -l bsdadminscripts2 | grep bin

Invoked without any arguments it will check all packages installed in a system.

# pkg_libchk
Jobs done:   35 of 1057

… so in order to make the ckecks only for Chromium you will need to specify chromium package with pkg_libchk chromium command.

The pkg_libchk allows you to fetch missing dependencies based on which package provides what files or create a list of the packages that need to be rebuilt.

Use Provides Database

You can also use ‘provides’ database from pkg(8) command.

% pkg provides lib/libx264.so
Name    : libx264-0.157.2945
Desc    : H.264/MPEG-4 AVC Video Encoding (Library)
Repo    : FreeBSD
Filename: /usr/local/lib/libx264.so.155

To learn how to setup ‘provides’ database for pkg(8) command check the Less Known pkg(8) Features article please.

UPDATE 1 – Rework Entire Article

The Roman philosopher Seneca once said – “While we teach, we learn.” – it is very true – especially for this article. After I posted it on various places people reminded my that its not the best way to just create symlink and that its not the best way to do it. I stand corrected and added additional sections and methods of fixing a broken dependency on a FreeBSD (or Linux/Illumos) system.