Tag Archives: x11

FreeBSD Zero to Desktop Speedrun Challenge

I decided to take part in the FreeBSD Zero to Desktop speedrun challenge – https://wiki.freebsd.org/Speedruns – described here. On my 13 years old ThinkPad W520 from 2011 I managed to do that in 4:23 total time. As previous leader used IceWM for the task – I have chosen Openbox as its also small.

The operations and commands that needed to be done took me 1:33 and installation of base.txz/kernel.txz datasets took 0:28. Downloading and installing needed pkg(8) packages took 2:22 of time.

I used most recent 14.0-RELEASE FreeBSD version and I used native FreeBSD hypervisor called Bhyve with vm-bhyve-devel toolkit. I created a VM with 2 CPUs and 2 GB RAM and with 10 GB NVMe disk.

This is the Bhyve template for vm-bhyve-devel I used for the guest VM.

W520 % cat /vm/.templates/freebsd-uefi.conf
loader="uefi"
graphics="yes"
cpu=1
memory=1G
network0_type="virtio-net"
network0_switch="public"
disk0_type="nvme"
disk0_name="disk0.img"

Commands I used during the speedrun are below. First install needed pkg(8) packages in the background to be able to prepare for later tasks. Because FreeBSD’s POSIX /bin/sh does not support !command syntax I switched to csh(1) to make things faster.

VM # nohup pkg install -y -g '*scfb*' xorg-minimal xinit xterm openbox &

To configure X11 with scfb driver the following /usr/local/etc/X11/xorg.conf config is needed for that (with BusID).

VM # cat /usr/local/etc/X11/xorg.conf
Section "Device"
  Identifier "Card0"
  Driver "scfb"
  BusID "0:4:0"
EndSection

To make it less typing I first generate a whole X11 config and then just trim it for the needed part.

VM # X -configure

VM # grep -B 19 -A 3 modes xorg.conf.new | sed s/modesetting/scfb/g > asd

VM # mv asd /usr/local/etc/X11/xorg.conf

I also needed to remove the X11 files at /tmp dir.

VM # rm -rf /tmp/.*unix

As these steps complete the only things need were to switch to regular asd user and start xinit(1) with openbox window manager.

VM # su - asd

VM % xinit openbox

The video that I posted on YouTube.

I also used small bash(1) written stop watch script called sw(1)https://github.com/coryfklein/sw/ – available here.

Not sure what I should add here moreΒ  – feel free to port you comment in that πŸ™‚

Sensible Firefox Setup

I really wanted to do that Firefox guide earlier but always other things came up as usual. But that also has some upsides.

firefox.logo.2009.400

Yes – I used the Firefox logo from 2009 (some reported it is from 2013) as I believe it looks a lot better then the current one … below You can check the Firefox logo declining progress.

firefox.logo.progress

Fortunately progress of the Firefox browser seems to be directed in a good direction.

Below You will find Table of Contents for this article.

  • Magic of the Past
  • Clean Start
  • Logins and Passwords
  • Extensions
  • Preferences
  • about:config
  • Interface
  • Export/Import Bookmarks
  • Summary

Lets start then.

Magic of the Past

I struggled a lot … to find new home after Opera 12.x was killed in 2013. Its Presto engine was fast and standards (ACID3) compliant. Opera 12.x had official FreeBSD support (and was in the Ports). It had builtin Opera Mail client – imagine having Thunderbird integrated into Firefox … It has Torrent client integrated – image having Transmission integrated into Firefox as well. It had extensions support. It supported really intelligent Mouse Gestures – like it already new where the Next in Thread on the Mailing Lists link is … Opera provided at that time synchronization with Opera Mini on the phone (and other Opera instances as well) … and while having all that it was ultra fast and low on resources. Kinda like a dream. Total opposite of today’s Slack client taking 2 GB RAM …

opera-2010-12

So much potential lost … and while having all these features it had very little market share … this reminds me of a quote by Waldemar Łysiak from its Statek (1994) book.

“If majority is always right – let’s eat shit… millions of flies can’t be wrong.”

Even in 2007 the Opera allowed some crazy browsing modes … and these were not the times of FullHD or higher resolutions. When You had 1280×1024 back then on a huge CTR screen it felt like king.

opera-2007-01

Dead. Killed. Abandoned.

After a lot of time I finally settled on Firefox – and while it will never be the same – this is the closest I was able to get.

Today I will try to share the sensible Firefox setup – to focus on the web and not on the browser.

Clean Start

Lets start with a clean start (and a backup if You already use Firefox). Copy your config on a side and remove everything.

% mv ~/.mozilla ~/.mozilla.BACKUP
% rm -rf ~/.cache/mozilla/firefox

This is how the clean Firefox 123.0 more or less should look like.

firefox-first-start-clean

Complete list of what is stored where – https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data – is available here.

Logins and Passwords

If you already used Firefox – or want to know how to backup your Logins and Passwords – do these.

My old Firefox profile was ah3fnzb3.default-release and the new name was generated as o3pdrjav.default-release as shown below.

We will be copying/protecting the key3.db/key4.db and logins.json files.

% cd ~/.mozilla.BACKUP.BROKEN/firefox/ah3fnzb3.default-release
 
% cp key*.db logins.json ~/.mozilla/firefox/o3pdrjav.default-release/

You may want to also copy handlers.json for download actions and persdict.dat for personal dictionary.

Complete information of what is stored where is available – https://support.mozilla.org/en-US/kb/profiles-where-firefox-stores-user-data – here.

Extensions

We will now focus Firefox Extensions. Today (at least for me) its impossible to just browse the Internet w/o at least uBlock Origin and Still Don’t Care About Cookies plugins … but there are more of them useful.

Currently I use below ones as a minimum and sometimes experiment with other ones.

Note about the additional preferences for some of the plugins.

The is a genius page of additional content for uBlock Originhttps://majkiit.github.io/polish-ads-filter/en/ – available here.

firefox-polish-ads-filters

Subscribe to as many lists as You want – all supported and working in uBlock Origin tool.

For the Expire History by Days I would suggest picking some limit – I use 33 days.

firefox-history-expire

Some notable mentions of other extensions that You may find useful.

Feel free to share You favorite extensions in the comments.

Preferences

Now … the preferences for Firefox I have chosen are displayed below … but its not all of course – there would be additional about:config section.

Sorry that they took that much place … initially I wanted to write everything down as text summary – but then You would have to find that in the Preferences page and … it would took even more time.

The General tab.

firefox-prefs-general

The Home tab.

firefox-prefs-home

The Search tab.

firefox-prefs-search

… and last but not least – the Privacy and Security tab.

firefox-prefs-privacy-security

about:config

As PITA as it is – there are also many of these … this time summarized in a text fashion below.

firefox-about-config-warning

The list is below.

ABOUT:CONFIG                                                   VALUE        COMMENT
browser.cache.memory.enable                                    false        -
browser.compactmode.show                                       true         (compact layout)
browser.display.show_image_placeholders                        false        -
browser.download.alwaysOpenPanel                               false        (do not show downloads box everytime)
browser.download.autohideButton                                false        -
browser.download.improvements_to_download_panel                false        (normal download behavior)
browser.download.saveLinkAsFilenameTimeout                     0            (faster)
browser.link.open_newwindow.restriction                        0            (open windows as tabs)
browser.link.open_newwindow                                    3            (open link in new tab)
browser.search.openintab                                       true         (search bar will open new tab for results)
browser.search.suggest.enabled                                 false        -
browser.sessionhistory.max_entries                             5            50
browser.sessionstore.interval                                  85000        15000
browser.tabs.animate                                           false        -
browser.tabs.insertRelatedAfterCurrent                         false        -
browser.tabs.tabMinWidth                                       10           76
browser.tabs.loadBookmarksInTabs	                       true         (open links in new tabs)
dom.block_download_insecure                                    false        (normal download without yelling)
dom.event.contextmenu.enabled                                  false        (allow right click)
dom.media.autoplay-policy-detection.enabled                    false        (autoplay)
dom.webnotifications.enabled                                   false        -
general.smoothScroll.lines                                     false        -
general.smoothScroll.mouseWheel                                false        -
general.smoothScroll.other                                     false        -
general.smoothScroll.pages                                     false        -
general.smoothScroll.pixels                                    false        -
general.smoothScroll.scrollbars                                false        -
geo.enabled                                                    false        -
gfx.xrender.enabled                                            true         (works in Thunderbird too)
image.jxl.enabled                                              true         (JPEG XL)
loop.enabled                                                   false        -
media.autoplay.allow-extension-background-pages                false        (autoplay)
media.autoplay.default                                         0            (autoplay)
media.autoplay.enabled                                         false        (autoplay)
media.block-autoplay-until-in-foreground                       false        (autoplay)
media.ffmpeg.vaapi.enabled                                     true         (VA-API)
media.peerconnection.enabled                                   false        -
media.webrtc.hw.h264.enabled                                   false        -
network.http.http3.enabled                                     false        -
network.negotiate-auth.allow-insecure-ntlm-v1                  true         (sharepoint)
network.prefetch-next                                          false        -
network.trr.mode                                               5            (disable TRR DNS)
pdfjs.defaultZoomValue                                         page-fit     -
privacy.firstparty.isolate                                     true         -
privacy.firstparty.isolate.block_post_message                  true         -
privacy.trackingprotection.enabled                             true         -
security.dialog_enable_delay                                   0            -
security.notification_enable_delay                             0            -
security.ssl3.rsa_fips_des_ede3_sha                            false        -
security.tls.version.fallback-limit                            0            -
security.tls.version.max                                       4            -
security.tls.version.min                                       0            (IBM/HMC)
security.tls.insecure_fallback_hosts                           10.20.30.40  (IBM/HMC)
widget.gtk.overlay-scrollbars.enabled                          false        (normal scrollbar)
toolkit.scrollbox.smoothScroll                                 false        -
ABOUT:CONFIG                                                   VALUE        COMMENT

… and some (optional for some) privacy related stuff.

ABOUT:CONFIG                                                   VALUE        COMMENT
browser.safebrowsing.downloads.enabled                         false        (privacy)
browser.safebrowsing.downloads.remote.url                      127.0.0.1    (privacy)
browser.safebrowsing.downloads.remote.url                      127.0.0.1    (privacy)
browser.safebrowsing.enabled                                   false        (privacy)
browser.safebrowsing.malware.enabled                           false        (privacy)
browser.safebrowsing.provider.google.advisoryURL               127.0.0.1    (privacy)
browser.safebrowsing.provider.google.gethashURL                127.0.0.1    (privacy)
browser.safebrowsing.provider.google.gethashURL                127.0.0.1    (privacy)
browser.safebrowsing.provider.google.reportMalwareMistakeURL   127.0.0.1    (privacy)
browser.safebrowsing.provider.google.reportPhishMistakeURL     127.0.0.1    (privacy)
browser.safebrowsing.provider.google.reportURL                 127.0.0.1    (privacy)
browser.safebrowsing.provider.google.reportURL                 127.0.0.1    (privacy)
browser.safebrowsing.provider.google.updateURL                 127.0.0.1    (privacy)
browser.safebrowsing.provider.google.updateURL                 127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.advisoryURL              127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.dataSharingURL           127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.gethashURL               127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.gethashURL               127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.reportMalwareMistakeURL  127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.reportPhishMistakeURL    127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.reportURL                127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.reportURL                127.0.0.1    (privacy)
browser.safebrowsing.provider.google4.updateURL                127.0.0.1   -(privacy)
browser.safebrowsing.provider.google4.updateURL                127.0.0.1    (privacy)
browser.safebrowsing.provider.mozilla.gethashURL               127.0.0.1    (privacy)
browser.safebrowsing.provider.mozilla.gethashURL               127.0.0.1    (privacy)
browser.safebrowsing.provider.mozilla.updateURL                127.0.0.1    (privacy)
browser.safebrowsing.provider.mozilla.updateURL                127.0.0.1    (privacy)
browser.safebrowsing.reportMalwareMistakeURL                   127.0.0.1    (privacy)
browser.safebrowsing.reportPhishMistakeURL                     127.0.0.1    (privacy)
browser.safebrowsing.reportPhishURL                            127.0.0.1    (privacy)
browser.safebrowsing.reportPhishURL                            127.0.0.1    (privacy)
browser.safebrowsing.reportURL                                 127.0.0.1    (privacy)
browser.safebrowsing.updateURL                                 127.0.0.1    (privacy)
captivedetect.canonicalContent                                 127.0.0.1    (privacy)
captivedetect.canonicalURL                                     127.0.0.1    (privacy)
toolkit.telemetry.enabled                                      false        (privacy)
captivedetect.maxRetryCount                                    0            (privacy)
captivedetect.maxWaitingTime                                   0            (privacy)
captivedetect.pollingTime                                      0            (privacy)
datareporting.healthreport.about.reportUrl                     127.0.0.1    (privacy)
datareporting.healthreport.infoURL                             127.0.0.1    (privacy)
datareporting.healthreport.service.enabled                     false        (privacy)
datareporting.healthreport.uploadEnabled                       false        (privacy)
extensions.pocket.enabled                                      false        (privacy)
ABOUT:CONFIG                                                   VALUE        COMMENT

Looks for example like that.

firefox-127.0.0.1

One of the things I learned that is possible to ‘glob’ the about:config options. This way you can enter – for example the bro*ses*deb value and Firefox will filter possible options for You.

firefox-about-config-glob

Interface

I am a fan of the Compact layout – it needs one more step (browser.compactmode.show = true) to be visible and was already done in the previous section.

firefox-compact-interface

The details are in one of the Mozilla – https://support.mozilla.org/en-US/kb/compact-mode-workaround-firefox – support pages.

To start click somewhere besides buttons and select Customize Toolbar… – like that.

firefox-customize

On the lower side You will now find needed option as shown below.

firefox-compact-interface-where

Also feel free to setup your preferred buttons and search box if needed.

This is how mine config looks like after all these tasks.

firefox-setup-complete

Export/Import Bookmarks

You may want to also backup/restore your bookmarks … assuming you have any.

Summary

I wanted to focus only on config part and no the Firefox features – this maybe some time in the future πŸ™‚

Regards,

EOF

FreeBSD Desktop – Part 29 – Configuration – Audio Improvements

I recently added some improvements to my audio configs and settings on FreeBSD desktop.


freebsd-audio

Each of these ideas is nothing special or groundbreaking – but they all improve usability of daily FreeBSD desktop experience.

The Table of Contents for this article contains.

  • Default Audio Output
  • PulseAudio Output Change
  • Openbox Generated Sound Menu
  • Automatic Audio Output Change
  • Direct Deadbeef Audio Controls
  • Reset mixer(1) Settings
  • Sound for USB Device Attach/Detach
  • Default Audio Output
  • Summary

One of the usual things on a FreeBSD desktop is that user needs to – after attaching USB headphones – manually switch to them with sysctl(8) as root and then restart all audio apps so they will be able to use new audio output.

// LIST SOUND DEVICES

desktop # cat /dev/sndstat
Installed devices:
pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec) default
No devices installed from userspace



// AFTER ATTACHING USB HEADPHONES NEW pcm1 DEVICE APPEARS

desktop # cat /dev/sndstat
Installed devices:
pcm0: <Conexant CX20590 (Analog 2.0+HP/2.0)> (play/rec)
pcm1: <USB audio> (play/rec) default
No devices installed from userspace



// SWITCH TO NEW pcm1 DEVICE WITH sysctl(8) COMMAND

desktop # sysctl hw.snd.default_unit=1

… and after you are done listening the audio on USB audio device – then You need to do the opposite – switch back the hw.snd.default_unit to 0 sound device and also restart the audio apps again.

PulseAudio Output Change

On of the things that is indirectly forced on FreeBSD desktop users is PulseAudio. Not that long from now Firefox default audio output was switched from native FreeBSD OSS to PulseAudio for example. More and more apps are switched to it … but there at least is ONE advantage in that situation. When using PulseAudio You can switch its output on the fly as many times as You want without the need to kill or restart the applications playing audio.

Here is how it looks from the command line perspective.

// LIST PulseAudio OUTPUTS

desktop % pactl list sinks | grep 'Name: '
        Name: oss_output.dsp0
        Name: oss_output.dsp1

desktop % pactl get-default-sink
oss_output.dsp0



// SET dsp1 (ITS pcm1 ON FREEBSD DEVICES) AS DEFAULT AUDIO OUTPUT

desktop % pactl set-default-sink oss_output.dsp1

desktop % pactl get-default-sink
oss_output.dsp1



// SWITCH BACK TO dsp0 AUDIO OUTPUT

desktop % pactl set-default-sink oss_output.dsp0

desktop % pactl get-default-sink
oss_output.dsp0

But You can also use GUI pavucontrol(1) command to change PulseAudio output.

Here is the Playback tab opened.

pavucontrol-list

… and here is how You can switch current output audio device on the fly.

pavucontrol-select

Openbox Generated Sound Menu

I used it since quite long time – but I updated it with news links – for example to PulseAudio graphical interface.

The part that goes into the Openbox menu configurations is shown below.

<menu id="sound" label="sound" execute="__openbox_freebsd_sound.sh" icon="/home/vermaden/.config/openbox/icons/speaker.png" />

It looks like that on my system.

openbox-sound-menu

If You use Openbox then you may download it from this – __openbox_freebsd_sound.sh – place.

Automatic Audio Output Change

It is possible – with the use of FreeBSD devd(8) daemon – to make FreeBSD automatically switch to new audio source after its attach. I wrote the audio-source-switch.sh script for that purpose.

Here is the needed devd(8) configuration to make it work.

desktop # pkg install -y x11/zenity

desktop % cat /usr/local/etc/devd/audio_source.conf
                                                                                                                                                         
# USB/HEADPHONES/attach
attach 100 {
  device-name "pcm[0-9]+";
  action "su -l vermaden -c 'env DISPLAY=:0 /home/vermaden/scripts/audio-source-switch.sh attach 1> /dev/null 2> /dev/null &' &";
};

# USB/HEADPHONES/detach
detach 100 {
  device-name "pcm[0-9]+";
  action "su -l vermaden -c 'env DISPLAY=:0 /home/vermaden/scripts/audio-source-switch.sh detach 1> /dev/null 2> /dev/null &' &";
};

Remember to restart the devd(8) daemon everytime You dump a new config in the /usr/local/etc/devd directory.

Keep in mind that x11/zenity is needed for it to display information properly.

Now – after this change – when You plug in new USB audio output – You will see this zenity(1) dialog window.

new-audio-nothing-playing-attach

But that is only if You DO NOT play any audio currently.

If – for example – You currently use Deadbeef audio player to play music – You will see this zenity(1) dialog instead.

new-audio-output-attach

It will ask You if You want to kill that Deadbeef PID – so if You start it again – You will be able to use new audio output – but You may NOT want to kill it – hence the question.

You may also recompile Deadbeef with PulseAudio output support. Here is how the Deadbeef options in Preferences looks like after recompilation with PulseAudio support.

deadbeed-pulseaudio-output

If You already have another USB audio output attached and decided to detach it – and nothing is playing the audio – my zenity(1) script will dialog this dialog.

new-audio-nothing-playing-detach

… and if something is using the FreeBSD audio/sound subsystem – then this one.

tint2-deadbeef-buttons

Direct Deadbeef Audio Controls

I really like the mouse I use daily – the Logitech M720 – as much as I really like to use the additional buttons to increase/decrease the volume – I would really wish it would have ANOTHER two additional buttons for the next and previous song on the Deadbeef player.

Because of that I decided to add a dedicated set of buttons on my Tint2 bar on top – that would allow me to change the current Deadbeef song to the next one … or previous one … or pause it.

new-audio-output-detach

The Tint2 config was updates with this content.

desktop % grep player ~/.tint2rc
  launcher_item_app      = /home/vermaden/.apps/player-prev.desktop
  launcher_item_app      = /home/vermaden/.apps/player-stop.desktop
  launcher_item_app      = /home/vermaden/.apps/player-pause.desktop
  launcher_item_app      = /home/vermaden/.apps/player-play.desktop
  launcher_item_app      = /home/vermaden/.apps/player-next.desktop

… and the Deadbeef buttons configs looks as follows.

desktop % cat ~/.apps/player-next.desktop
[Desktop Entry]
Type=Application
Name=Deadbeef
Exec=deadbeef --next
Icon=/home/vermaden/.icons/vermaden/player-next.png

desktop % cat ~/.apps/player-pause.desktop
[Desktop Entry]
Type=Application
Name=Deadbeef
Exec=deadbeef --toggle-pause
Icon=/home/vermaden/.icons/vermaden/player-pause.png

desktop % cat ~/.apps/player-play.desktop
[Desktop Entry]
Type=Application
Name=Deadbeef
Exec=deadbeef --play
Icon=/home/vermaden/.icons/vermaden/player-play.png

desktop % cat ~/.apps/player-prev.desktop
[Desktop Entry]
Type=Application
Name=Deadbeef
Exec=deadbeef --prev
Icon=/home/vermaden/.icons/vermaden/player-prev.png

desktop % cat ~/.apps/player-stop.desktop
[Desktop Entry]
Type=Application
Name=Deadbeef
Exec=deadbeef --stop
Icon=/home/vermaden/.icons/vermaden/player-stop.png

Reset mixer(1) Settings

One of the things that annoyed me was the mixer settings when I tried to join some call/teleconference. It seemed like a random pointless fuckup. Not anymore. With small and simple mix.sh script it all gets to normal and everything works out of the box.

Here is how the mix.sh script looks like.

desktop % cat ~/scripts/mix.sh
mixer vol.volume=0.6
mixer mic.volume=0.85
mixer rec.volume=0.85
mixer pcm.volume=1.0
mixer speaker.volume=0.0
mixer monitor.volume=0.0
mixer

… and how it works.

desktop % mix.sh 
pcm0:mixer:  on hdaa0  (play/rec) (default)
    vol       = 0.60:0.60     pbk
    pcm       = 1.00:1.00     pbk
    speaker   = 0.00:0.00     pbk
    mic       = 0.85:0.85     rec src
    rec       = 0.85:0.85     pbk
    monitor   = 0.00:0.00     rec

Sound for USB Device Attach/Detach

Most desktop oriented operating systems do play some type of sound for device attach/detach so the user would get a feedback that the system is aware of his actions – like – well – attaching or detaching a USB device πŸ™‚

By default FreeBSD does not do anything like that – but its not hard to add such an action to the FreeBSD devd(8) daemon.

With the following devd(8) config FreeBSD will now play a dedicated sound on each USB device attach or detach event.

In the beginning I did not knew which sound to pick from – but after some thoughts I decided to pick some Worms Armageddon sounds – from the 007 sound theme.

worms-logo

The devd(8) config looks like that one below.

desktop # pkg install -y audio/mpg123

desktop % cat /usr/local/etc/devd/USB.conf

# USB/attach
notify 10 {
  match "system" "USB";
  match "type"   "ATTACH";
  action "su -l vermaden -c 'env DISPLAY=:0 /usr/local/bin/mpg123 /usr/local/etc/devd/USB.attach.mp3' &";
};

# USB/detach
notify 10 {
  match "system" "USB";
  match "type"   "DETACH";
  action "su -l vermaden -c 'env DISPLAY=:0 /usr/local/bin/mpg123 /usr/local/etc/devd/USB.detach.mp3' &";
};

I also assume that You will have audio/mpg123 installed to play these sounds.

Because WordPress is very limited – it will not allow me to upload plain MP3 files – but we will overcome that limitation. For the record – it is not a technical limitation – its just a limitation of the FREE PLAN that I am using on the WordPress page.

bear-grylls

Here are the commands You need to execute to fetch these two MP3 files.

desktop ~ # fetch \
              -o /usr/local/etc/devd/usb.detach.mp3.zip
              https://vermaden.files.wordpress.com/2024/01/usb.detach.mp3_.docx
/usr/local/etc/devd/usb.detach.mp3.zip                9588  B   40 MBps    00s

desktop ~ # fetch \
              -o /usr/local/etc/devd/usb.attach.mp3.zip \
              https://vermaden.files.wordpress.com/2024/01/usb.attach.mp3_.docx
/usr/local/etc/devd/usb.attach.mp3.zip                  11 kB   41 MBps    00s

desktop ~ # cd /usr/local/etc/devd

desktop /usr/local/etc/devd # unzip usb.detach.mp3.zip
Archive:  usb.detach.mp3.zip
 extracting: USB.detach.mp3  

desktop /usr/local/etc/devd # unzip usb.attach.mp3.zip
Archive:  usb.attach.mp3.zip
 extracting: USB.attach.mp3  

Now as You have the needed MP3 files – restart the devd(8) daemon.

Now everytime You will attach or detach USB device You will hear appropriate Worms Armageddon sound.

Summary

I think that I can say that nothing prevents You from running FreeBSD desktop daily. If the FreeBSD is the desktop You want – and You are still running macOS or Windows instead – You are just lazy as fuck πŸ™‚

UPDATE 1 – Other FreeBSD Audio Improvements

As usual I got a lot additional good stuff from the comments from many places.

Below I would try to summarize them.

Firefox

For the Firefox browser its possible to check the media/audio devices with about:support#media URL.

UPDATE1-firefox-media

GTK-Mixer

To have a GUI for the various volume settings You can use GTK-Mixer and its available in the FreeBSD package as audio/gtk-mixer name.

desktop # pkg install audio/gtk-mixer

desktop % gtk-mixer

Here is how it looks like.

UPDATE1-gtk-mixer

FreeBSD Audio Stack Improvements

Seems that Christos Margiolis is already working on some Audio Stack Improvements on FreeBSD thanks to FreeBSD Foundation.

This is his message:

The past (and first) week working on the audio stack, sponsored by the FreeBSD Foundation, I:

- Set up my development environment; a VM image running -CURRENT in bhyve with PCI-passthru
  enabled to do all of the driver (kernel generallly) development in the VM.

- Wrote a small series of patches for vmrun.sh:
  https://reviews.freebsd.org/D43269
  https://reviews.freebsd.org/D43270

- Modified the snd_uaudio(4) driver to provide information about the sound card
  (manufacturer, model and attached driver), as opposed to the current generic "USB Audio"
  string, so /dev/sndstat and programs like mixer(8) can output more useful information
  about USB audio devices.
  https://reviews.freebsd.org/D43347

- Submitted a patch to update (and unify) the description format for all sound devices,
  since some of them haven't been touched for years.
  https://reviews.freebsd.org/D43349

- Implemented device_set_descf() , a printf-like version of device_set_desc().
  https://reviews.freebsd.org/D43370

- Was preparing a few more smaller patches.

- Started looking into possible solutions to
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194727
  also mentioned in the first paragraph of the BUGS section of the snd_uaudio(4) man page.

Christos

Check the the links from the message above – a lot of great FreeBSD Audio Stack changes are coming.

PulseAudio

Someone also notified my that instead of writing a script for PulseAudio to automatically switch to just connected device on could load the module-switch-on-port-available or module-switch-on-connect module.

Check the details in the pacmd list-modules command.

desktop % pacmd list-modules | grep -B 1 -A 7 module-switch 
    index: 4
        name: 
        argument: 
        used: -1
        load once: yes
        properties:
                module.author = "David Henningsson"
                module.description = "Switches ports and profiles when devices are plugged/unplugged"
                module.version = "16.1"

EOF

FreeBSD Desktop – Part 28 – Configuration – Corner Actions

I am not a big fan of macOS desktop experience. I use latest macOS daily on M1 laptop and its quite far from what I call ‘productive’ environment. Yes – all the ‘enterprise’ applications are the … but that does not make a productive desktop alone. To be honest – the version that I enjoyed the most was Mac OS X Snow Leopard … but that was about a decade ago … and I still preferred my FreeBSD desktop even way back then.

One of the nice features that macOS (or earlier Mac OS X) provided were the so called Corner Actions. They are not crucial to any workload as one can either quite fast launch the needed processes by hand or by dmenu(1) or by other means (such as keyboard shortcuts) – but yeah – its not bad to have another useful feature under your mouse … assuming that mouse make You more productive – its not counter-productive for some.

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.

Python Based Solution

Upon my FreeBSD desktop/laptop/workstation journey I once found a Python based solution called cb-hotcorners from now discontinued CrunchBang Linux. It was not very usable as it used ‘polling’ type of thing – You set the ‘delay’ between checks and the Python script ACTIVELY checked if anything is needed to be done – if not it skips to next ‘wait’ cycle – if yes – it starts your configured executable. It may not sound as bad as it seams but keeping your cursor parked for about a second or so in the corner hoping for the script to do the right job is far from productive … not to mention wasted battery time and CPU cycles on that active waiting loop … just no.

While the CrunchBang is long gone there are two spiritual successors – CrunchBang++ and BunsenLabs ones. Seems I need to check them some time for other possible Openbox friendly features.

xidle(1)

Recently someone poked me on X/Twitter about xidle(1) running the suspend/resume command twice instead of just once … but after some digging I figured out that the xidle(1) also has some other features … and one of them is the Corner Actions feature.

After ‘bad’ experiences of slow and inefficient Python solution I checked how it would do the job … and it was instant match! πŸ™‚

For the record – the pkg(8) packages that need to be installed are listed below.

% pkg install -y xidle caja leafpad xterm skippy-xd

These two scripts below the __openbox_restart_xidle.sh and __openbox_stop_xidle.sh do all the needed job here. First one is to start needed config. Second one is to ‘stop’ all running xidle(1) instances.

% cat ~/scripts/__openbox_restart_xidle.sh
#! /bin/sh

xidle -area 3 -delay 0 -nw -program '/usr/local/bin/caja --no-desktop' &
xidle -area 3 -delay 0 -ne -program '/usr/local/bin/skippy-xd'         &
xidle -area 3 -delay 0 -sw -program '/usr/local/bin/leafpad'           &
xidle -area 3 -delay 0 -se -program '/home/vermaden/scripts/xterm.sh'  &


% cat ~/scripts/__openbox_stop_xidle.sh
#! /bin/sh

killall -9 xidle &

Below you will find xidle(1) in action on a screencast.

Actions

I configured the following xidle(1) actions:

  TOP-LEFT   caja(1) file manager
  BOT-LEFT   leafpad(1) text editor
  TOP-RIGHT  skippy-xd(1) task switcher
  BOT-RIGHT  xterm(1) terminal

Below are the running xidle(1) processes for that purpose.

xidle-ps

I still did not yet got used to it and I sometimes forgot that its there – but I would definitely keep it – muscle memory would come πŸ™‚

Side Effect

As a side effect of getting involved with xidle(1) the person from X/Twitter created a FreeBSD BUG report – 275761 – x11/xidle: triggers twice – and it was also fixed.

Delayed Automatic Suspend

As the bug is now fixed You may also want to use xidle(1) for automatic suspend of the machine after some period of inactivity. Here is the command You would use to get that feature.

% xidle -timeout 900 -program '/usr/local/bin/doas /usr/sbin/zzz'

Summary

Feel free to comment and share other useful desktop features that make your daily work better.

UPDATE 1 – Using xdotool(1) Instead

Someone on Lobsters made me realize that the same Corner Actions can be made with xdotool(1) instead. As I already use xdotool(1) for several other tasks – that would limit the amount of needed tools to accomplish the tasks for needed features of my customized FreeBSD Desktop experience.

Here are the stop and startup scripts for xdotool(1) based solution.

% cat ~/scripts/__openbox_restart_xdotool.sh
#! /bin/sh

xdotool behave_screen_edge top-left     exec caja --browser --no-desktop &
xdotool behave_screen_edge top-right    exec skippy-xd                   &
xdotool behave_screen_edge bottom-left  exec leafpad                     &
xdotool behave_screen_edge bottom-right exec xterm.sh                    &



% cat ~/scripts/__openbox_stop_xdotool.sh
#! /bin/sh

killall -9 xdotool &

It generally works the same so why bother with xidle(1) … after short test seems that xidle(1) is a lot more efficient and takes a lot less CPU time to do the same.

I have made a simple test of starting the solution – then using all four corners action and then checked CPU time (and RAM) used.

To my surprise the xdotool(1) while doing the same took slightly more RAM … but about 8 times more CPU time then xidle(1) tool. Below you will find the results after usage of both solutions.

// xidle(1)
% ps aux | grep -e xidle -e xdotool -e RSS | cut -c 42-
  RSS TT  STAT STARTED         TIME COMMAND
 4344  3  S    13:13        0:00.01 xidle -area 3 -delay 0 -nw -program caja --browser --no-desktop
 4332  3  S    13:13        0:00.01 xidle -area 3 -delay 0 -ne -program skippy-xd
 4336  3  S    13:13        0:00.01 xidle -area 3 -delay 0 -sw -program leafpad
 4332  3  S    13:13        0:00.01 xidle -area 3 -delay 0 -se -program xterm.sh

// xdotool(1)
% ps aux | grep -e xidle -e xdotool -e RSS | cut -c 42-
  RSS TT  STAT STARTED         TIME COMMAND
 5244  3  S    13:14        0:00.08 xdotool behave_screen_edge top-left exec caja --browser --no-desktop
 5236  3  S    13:14        0:00.08 xdotool behave_screen_edge top-right exec skippy-xd
 5244  3  S    13:14        0:00.08 xdotool behave_screen_edge bottom-left exec leafpad
 5252  3  S    13:14        0:00.08 xdotool behave_screen_edge bottom-right exec xterm.sh

Does that make a huge difference? No. If you already have xdotool(1) installed then you may use it for that purpose – I just wanted to check out of curiosity.

EOF

Fix linux-browser-installer(8) on FreeBSD

If you want to play DRM locked media on FreeBSD or use web browser that is available on Linux but not on FreeBSD – like Opera or Brave for example – you had quite convenient way to do it – using linux-browser-installer script.

I use it since … I do not remember when – and it always worked like a charm … until recently.

Problem

After I wanted to try and test the upcoming FreeBSD 14.0 version – I started fresh with new installation in a separate ZFS Boot Environment – and then after copying my configs wanted to also enable and add Google Chrome to be able to watch DRM locked media … but this time the linux-browser-installer failed.


desktop % git clone https://github.com/mrclksr/linux-browser-installer.git
Cloning into 'linux-browser-installer'...
remote: Enumerating objects: 210, done.
remote: Counting objects: 100% (100/100), done.
remote: Compressing objects: 100% (31/31), done.
remote: Total 210 (delta 80), reused 76 (delta 69), pack-reused 110
Receiving objects: 100% (210/210), 31.55 KiB | 1.58 MiB/s, done.
Resolving deltas: 100% (125/125), done.

desktop % cd linux-browser-installer

desktop % su

desktop # ./linux-browser-installer chroot create
linux_enable: NO -> NO
ubuntu_enable:  -> YES
compat.linux.emul_path: /compat/ubuntu -> /compat/ubuntu
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.

No packages are required to be fetched.
Integrity check was successful.
tar: Removing leading '/' from member names
I: Retrieving InRelease 
I: Retrieving Packages 
I: Validating Packages 
I: Resolving dependencies of required packages...
I: Resolving dependencies of base packages...
I: Checking component main on http://archive.ubuntu.com/ubuntu...
I: Retrieving adduser 3.118ubuntu2
I: Validating adduser 3.118ubuntu2
I: Retrieving apt 2.0.2
I: Validating apt 2.0.2
(...)
I: Configuring libc-bin...
I: Configuring systemd...
I: Configuring ca-certificates...
I: Base system installed successfully.
mkdir: /compat/ubuntu/etc/localtime: File exists
cp: /compat/ubuntu/etc/localtime is not a directory
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = "en_US.UTF-8",
        LC_COLLATE = "C",
        LANG = "C.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

Current default time zone: 'Europe/Warsaw'
Local time is now:      Wed Oct 11 10:33:24 CEST 2023.
Universal Time is now:  Wed Oct 11 08:33:24 UTC 2023.


compat.linux.emul_path: /compat/ubuntu -> /compat/ubuntu
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Get:1 http://archive.ubuntu.com/ubuntu focal InRelease [265 kB]
Get:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:3 http://archive.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  At least one invalid signature was encountered.
Err:2 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  At least one invalid signature was encountered.
Err:3 http://archive.ubuntu.com/ubuntu focal-security InRelease
  At least one invalid signature was encountered.
Reading package lists... Done
W: GPG error: http://archive.ubuntu.com/ubuntu focal InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-updates InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
W: GPG error: http://archive.ubuntu.com/ubuntu focal-security InRelease: At least one invalid signature was encountered.
E: The repository 'http://archive.ubuntu.com/ubuntu focal-security InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Reading package lists... Done
Building dependency tree... Done
The following packages will be REMOVED:
  rsyslog
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 1695 kB disk space will be freed.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = "en_US.UTF-8",
        LC_COLLATE = "C",
        LANG = "C.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("C.UTF-8").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 11356 files and directories currently installed.)
Removing rsyslog (8.2001.0-1ubuntu1) ...
invoke-rc.d: could not determine current runlevel
 * Stopping enhanced syslogd rsyslogd                                                                                                                                                                                                                              [ OK ] 
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package gnupg is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'gnupg' has no installation candidate
linux-browser-installer: Error: 'apt install -y gnupg' failed

I even keep old FreeBSD 13.1 ZFS Boot Environment where I could still watch DRM locked content … but after some time I was able to nail what the issue with linux-browser-installer is … something (again) changed in the Linux universe and suddenly all packages sources that were trusted yesterday are not trusted anymore … and that is the reason why the installer fails.

Solution

After some digging I found several ways to fix the issue. One of them is to add --allow-insecure-repositories and/or --allow-unauthenticated flags to the apt(8) command. The other one is to add [trusted=yes] to all apt(8) packages sources. I will use the latter as it takes less places to modify and seems simpler.

Example difference before and after modification:

BEFORE:
deb http://www.deb-multimedia.org jessie main

AFTER:
deb [trusted=yes] http://www.deb-multimedia.org jessie main

This is how linux-browser-installer looks after adding [trusted=yes] to all apt(8) packages sources.

desktop % grep -o '\"deb .*\"' linux-browser-installer | tr -d \"
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ 
deb [arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main
deb [arch=amd64] https://repo.vivaldi.com/archive/deb/ 
deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main
deb https://deb.opera.com/opera-stable/ stable non-free
deb http://archive.ubuntu.com/ubuntu/ ${ubuntu_version} 
deb http://archive.ubuntu.com/ubuntu/ ${ubuntu_version}-updates 
deb http://archive.ubuntu.com/ubuntu/ ${ubuntu_version}-security 

desktop % grep -o '\"deb .*\"' linux-browser-installer.VERMADEN | tr -d \"
deb [trusted=yes arch=amd64] http://dl.google.com/linux/chrome/deb/ 
deb [trusted=yes arch=amd64] https://brave-browser-apt-release.s3.brave.com/ stable main
deb [trusted=yes arch=amd64] https://repo.vivaldi.com/archive/deb/ 
deb [trusted=yes arch=amd64] https://packages.microsoft.com/repos/edge stable main
deb [trusted=yes] https://deb.opera.com/opera-stable/ stable non-free
deb [trusted=yes] http://archive.ubuntu.com/ubuntu/ ${ubuntu_version} 
deb [trusted=yes] http://archive.ubuntu.com/ubuntu/ ${ubuntu_version}-updates 
deb [trusted=yes] http://archive.ubuntu.com/ubuntu/ ${ubuntu_version}-security 

Instructions

The current working procedure looks like that one below.

desktop % git clone https://github.com/mrclksr/linux-browser-installer.git

desktop % cd linux-browser-installer

desktop % fetch https://raw.githubusercontent.com/vermaden/scripts/master/linux-browser-installer.PATCH

desktop % patch < linux-browser-installer.PATCH 

desktop % su

desktop # ./linux-browser-installer chroot delete

desktop # ./linux-browser-installer chroot create

desktop # ./linux-browser-installer install chrome

This is how the properly applied patch(1) looks like.

desktop % patch < linux-browser-installer.PATCH 
Hmm...  Looks like a unified diff to me...
The text leading up to this was:
--------------------------
|--- linux-browser-installer.BCK        2023-10-11 08:59:18.296949000 +0200
|+++ linux-browser-installer    2023-10-11 09:51:53.672677000 +0200
--------------------------
Patching file linux-browser-installer using Plan A...
Hunk #1 succeeded at 127.
Hunk #2 succeeded at 166.
Hunk #3 succeeded at 191.
Hunk #4 succeeded at 230.
Hunk #5 succeeded at 262.
Hunk #6 succeeded at 336.
done

The DRM locked content seems to play fine in the Linux version of Google Chrome.

google-chrome-DRM

Hope that helps.

UPDATE 1 – Broken 13.2-RELEASE

It seams that the FreeBSD 13.2-RELEASE is the most problematic as either DRM content does not work at all now or there are sound issues.

From the good news – the upcoming FreeBSD 14.0-RELEASE does not have these issues.

UPDATE 2 – Certificate Verification Failed

I just wanted to update the chroot and faced this issue shown below.

laptop % doas ./linux-browser-installer chroot upgrade
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Hit:1 http://archive.ubuntu.com/ubuntu focal InRelease
Ign:2 https://dl.google.com/linux/chrome/deb stable InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu focal-security InRelease
Err:5 https://dl.google.com/linux/chrome/deb stable Release
  Certificate verification failed: The certificate is NOT trusted. The certificate issuer is unknown.  Could not handshake: Error in the certificate verification. [IP: 142.251.36.46 443]
Reading package lists... Done                  
W: https://dl.google.com/linux/chrome/deb/dists/stable/InRelease: No system certificates available. Try installing ca-certificates.
W: https://dl.google.com/linux/chrome/deb/dists/stable/Release: No system certificates available. Try installing ca-certificates.
E: The repository 'https://dl.google.com/linux/chrome/deb stable Release' no longer has a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
laptop % 

The solutions seems to be forcefully removing current ca-certificates package and then adding the newest one.

Here are the steps that solved the problem for me.

Go here – http://security.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ – and copy link for the most up to date ca-certificates package. Just hit the Last Modified on the top to make searching faster.

Then issue these commands with the link you copied earlier.

laptop % doas chroot /compat/ubuntu /bin/bash
chroot # wget --no-check-certificate http://security.ubuntu.com/ubuntu/pool/main/c/ca-certificates/ca-certificates_20230311ubuntu0.23.04.1_all.deb
chroot # dpkg -r --force-depends ca-certificates
chroot # dpkg -i ca-certificates_20230311ubuntu0.23.04.1_all.deb 
chroot # apt update

Now you can run chroot upgrade as usual.

laptop % doas ./linux-browser-installer chroot upgrade

Issue is submitted here: https://github.com/mrclksr/linux-browser-installer/issues/49

EOF

Quick DBUS Fix

Recently I again started to have some DBUS issues. Like GIMP opening a new instance everytime instead of just opening next file as a tab. After some investigation it seems that because DBUS got broken – example output from terminal for Caja file manager from Mate.

W520 % caja 

(caja:82154): dconf-WARNING **: 12:56:27.600: failed to commit changes to dconf:
Cannot spawn a message bus without a machine-id:
Unable to load /var/local/lib/dbus/machine-id or /etc/machine-id:
Failed to open file β€œ/var/local/lib/dbus/machine-id”: No such file or directory

(caja:82154): dconf-WARNING **: 12:56:27.600: failed to commit changes to dconf:
Cannot spawn a message bus without a machine-id:
Unable to load /var/local/lib/dbus/machine-id or /etc/machine-id:
Failed to open file β€œ/var/local/lib/dbus/machine-id”: No such file or directory

(caja:82154): dconf-WARNING **: 12:56:27.741: failed to commit changes to dconf:
Cannot spawn a message bus without a machine-id:
Unable to load /var/local/lib/dbus/machine-id or /etc/machine-id:
Failed to open file β€œ/var/local/lib/dbus/machine-id”: No such file or directory

(caja:82154): dconf-WARNING **: 12:56:27.741: failed to commit changes to dconf:
Cannot spawn a message bus without a machine-id:
Unable to load /var/local/lib/dbus/machine-id or /etc/machine-id:
Failed to open file β€œ/var/local/lib/dbus/machine-id”: No such file or directory

So I went to check if DBUS is actually running … or that machine-id is present.

w520 % service dbus status
dbus is running as pid 65388.

w520 % ls -l /var/lib/dbus/machine-id
-rw-r--r-- 1 root wheel 33 2023-08-09 11:43 /var/lib/dbus/machine-id

w520 % cat /var/lib/dbus/machine-id
283c584cbd447903eef501ca64d35fb9


Yep. Everything is in there. So I went back to caja(1) output … spot the difference below.

/var/lib/dbus/machine-id
/var/local/lib/dbus/machine-id

[FACEPALM]

For some reason authors of DBUS decided that /var/lib/dbus/machine-id is not good anymore and that from now on – they will use new /var/local/lib/dbus/machine-id place. “This is such a crock of shit.” as Lt. Col. Frank Slade would say.

Lets fix it with some oldschool ln(1) symlink.

w520 % doas mkdir -p /var/local/lib/dbus
w520 % doas ln -s /var/lib/dbus/machine-id /var/local/lib/dbus/machine-id

Lets check it works.

w520 % caja
w520 % 

No errors … and also finally all new images open in the same GIMP instance again.

dbus-fix

How not to love these Linuxisms on the daily FreeBSD desktop …

freebsd-porters-hanbook

EOF

AMD Based FreeBSD Desktop

While I started to use and learn FreeBSD on an oldschool Gigabyte-GA-7DPXDW motherboard (more about that here My FreeBSD Story page) that could handle two AMD AthlonXP CPUs in SMP configuration I got used to work on the laptops in the last 10+ years or so. I did not had a desktop PC for more then a decade … and that changed recently. My buddy showed me how much fun can be to ride Dirt Rally 2.0 game on a wheel controller. I really enjoyed that so I though that I will make my own cheap gaming rig and also got some old Logitech wheel and Dirt Rally 2.0 on some Steam sale. I do not like Windows systems so I picked one that is really stripped to the core – and also preconfigured for gaming – the Windows 10 Atlas edition – https://atlasos.net/ – available here.

While the gaming rig works really nice … I rarely have time to ride that rally stages – so while hardware was already there – I thought that I will make it a FreeBSD lab box while I do not play the games (which would be 99% of the time).

logo-freebsd

Also – having various Intel based ThinkPads in past years I also wanted to check how FreeBSD copes with AMD only based hardware – on all aspects such as motherboard/CPU/GPU subsystems.

Hardware

Many years ago – somewhere about 2010 – I got SilverStone SG05 Mini ITX case for my ZFS mirror setup – yes – the one that had only 512 MB RAM and run without a problem from one power outage to another πŸ™‚

While I changed my backup solutions multiple times:

That Silverstone SG05 Mini ITX case remained unused … till recently πŸ™‚

The case is quite small for a gaming PC with less then 11 L of volume and 22.2 x 17.6 x 27.6 cm in dimensions.

case-outside-1

The attached USB dongles are used for wireless mouse and keyboard.

case-outside-2

The hardware used here is as follows:

CASE: Silverstone SG05
 PSU: Sharkoon Silent Storm SFX 500 Gold 500W
MOBO: ASUS PRIME A320I-K Mini ITX
 CPU: AMD Ryzen 3 1200 4C/4T 3.1GHz
 GPU: Sapphire AMD Radeon RX 5500 XT 8GB GDDR6
 RAM: 16 GB DDR4
DISK: SSD NVMe M.2 Intel 660p 512GB
SCRN: HP E221c FullHD Monitor

Its nice that Sharkoon Silent Storm SFX 500 Gold PSU does have detachable cables – but even with that feature the inside of the Silverstone SG05 looks quite busy.

case-inside
The another SSD that is stripped from its case is Crucial MX300 525GB SATA drive – this is the drive that hosts the Windows 10 Atlas installation. I got it for about $15 so lack of case was not a problem :p The FreeBSD is installed on the SSD NVMe M.2 Intel 660p 512GB drive.

Daily the system works vertically on a ‘side’ to take less space.

case-shelf

Dual Boot

I use the most convenient known boot loader ever invented – the [F8] key on system startup – to enter the BIOS Boot Menu πŸ™‚

FreeBSD Setup

Below I will share the setup that will allow accelerated graphics desktop along with Direct Rendering at Xorg/X11 level.

The FreeBSD version I used was 13.2-RELEASE.

CPU

To read/show CPU temperatures we will need amdtemp.ko kernel module. We will load it and enable its automatic load after each reboot.

# kldload amdtemp

# sysrc kld_list+=amdtemp

# sysctl -a | grep temperature
dev.cpu.3.temperature: 32.1C
dev.cpu.2.temperature: 32.1C
dev.cpu.1.temperature: 32.1C
dev.cpu.0.temperature: 32.1C

One thing to note here – the amdtemp.ko is used only to read/show the CPU cores temperatures. It has nothing to do with frequency scaling for which the powerd(8) is used. If you do not intent to display these temps on some infobar or use them in scripts – then you may omit this step. I was just curious what the temperatures at idle and at load were. The powerd(8) is able to choose from three frequencies on that AMD Ryzen 3 1200 CPU.

# sysctl dev.cpu.0
dev.cpu.0.temperature: 32.0C
dev.cpu.0.cx_method: C1/hlt C2/io
dev.cpu.0.cx_usage_counters: 0 0
dev.cpu.0.cx_usage: 0.00% 0.00% last 1000000us
dev.cpu.0.cx_lowest: C8
dev.cpu.0.cx_supported: C1/1/1 C2/2/400
dev.cpu.0.freq_levels: 3100/3681 2800/2940 1550/1331
dev.cpu.0.freq: 1550
dev.cpu.0.%parent: acpi0
dev.cpu.0.%pnpinfo: _HID=none _UID=0 _CID=none
dev.cpu.0.%location: handle=\_PR_.C000
dev.cpu.0.%driver: cpu
dev.cpu.0.%desc: ACPI CPU

One may got one step further and use mine sensors.sh script. Example below is with disabled powerd(8) daemon and CPU frequency set to 1.5GHz manually.

# sensors.sh

            BATTERY/AC/TIME/FAN/SPEED 
 ------------------------------------ 
               dev.cpu.0.cx_supported: C1/1/1 C2/2/400
                   dev.cpu.0.cx_usage: 0.00% 0.00% last 1000000us
                       dev.cpu.0.freq: 1550 
                hw.acpi.cpu.cx_lowest: C8 
                powerd(8)/powerdxx(8): disabled

                  SYSTEM/TEMPERATURES 
 ------------------------------------ 
                dev.cpu.0.temperature: 44.1C
                dev.cpu.1.temperature: 44.1C
                dev.cpu.2.temperature: 44.1C
                dev.cpu.3.temperature: 44.1C

                   DISKS/TEMPERATURES 
 ------------------------------------ 
       smart.ada0.temperature_celsius: 46.0C
              smart.nvme0.temperature: 43.0C

GPU

Now we will need to install the graphics/drm-kmod packages. We will just use the latest repository to have most fresh packages.

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

# pkg install -y drm-kmod

While the above sed(1) command works properly – the proper and official way to do that is shown below.

# mkdir -p /usr/local/etc/pkg/repos

# sed -e 's|quarterly|latest|g' /etc/pkg/FreeBSD.conf > /usr/local/etc/pkg/repos/FreeBSD.conf

The final effect is the same.

We will now check what is our GPU – as seen by the FreeBSD operating system.

# pciconf -lv vgapci0
vgapci0@pci0:10:0:0:    class=0x030000 rev=0xc5 hdr=0x00 vendor=0x1002 device=0x7340 subvendor=0x1da2 subdevice=0xe423
    vendor     = 'Advanced Micro Devices, Inc. [AMD/ATI]'
    device     = 'Navi 14 [Radeon RX 5500/5500M / Pro 5500M]'
    class      = display
    subclass   = VGA

Accurately its AMD Radeon RX 5500 with NAVI 14 codename.

We can check if we need the radeonkms.ko module or amdgpu.ko module in following way.

# pkg search navi14
gpu-firmware-amd-kmod-navi14-20230210_1 Firmware modules for navi14 AMD GPUs

# pkg info -l gpu-firmware-amd-kmod-navi14-20230210_1
gpu-firmware-amd-kmod-navi14-20230210_1:
        /boot/modules/amdgpu_navi14_asd_bin.ko
        /boot/modules/amdgpu_navi14_ce_bin.ko
        /boot/modules/amdgpu_navi14_ce_wks_bin.ko
        /boot/modules/amdgpu_navi14_gpu_info_bin.ko
        /boot/modules/amdgpu_navi14_me_bin.ko
        /boot/modules/amdgpu_navi14_me_wks_bin.ko
        /boot/modules/amdgpu_navi14_mec2_bin.ko
        /boot/modules/amdgpu_navi14_mec2_wks_bin.ko
        /boot/modules/amdgpu_navi14_mec_bin.ko
        /boot/modules/amdgpu_navi14_mec_wks_bin.ko
        /boot/modules/amdgpu_navi14_pfp_bin.ko
        /boot/modules/amdgpu_navi14_pfp_wks_bin.ko
        /boot/modules/amdgpu_navi14_rlc_bin.ko
        /boot/modules/amdgpu_navi14_sdma1_bin.ko
        /boot/modules/amdgpu_navi14_sdma_bin.ko
        /boot/modules/amdgpu_navi14_smc_bin.ko
        /boot/modules/amdgpu_navi14_sos_bin.ko
        /boot/modules/amdgpu_navi14_ta_bin.ko
        /boot/modules/amdgpu_navi14_vcn_bin.ko
        /usr/local/share/licenses/gpu-firmware-amd-kmod-navi14-20230210_1/AMD
        /usr/local/share/licenses/gpu-firmware-amd-kmod-navi14-20230210_1/LICENSE
        /usr/local/share/licenses/gpu-firmware-amd-kmod-navi14-20230210_1/catalog.mk

As we can see the NAVI 14 is supported by amdgpu.ko kernel module – so we will enable its loading after each reboot and we will also load it now.

# kldload amdgpu

# sysrc kld_list+=amdgpu

# kldstat 
Id Refs Address                Size Name
 1  105 0xffffffff80200000  1f3e2d0 kernel
 2    1 0xffffffff8213f000   59dfa8 zfs.ko
 3    1 0xffffffff826dd000     a4a0 cryptodev.ko
 4    1 0xffffffff82e10000     3378 acpi_wmi.ko
 5    1 0xffffffff82e14000     3218 intpm.ko
 6    1 0xffffffff82e18000     2180 smbus.ko
 7    1 0xffffffff82e1b000     3340 uhid.ko
 8    1 0xffffffff82e1f000     4350 ums.ko
 9    1 0xffffffff82e24000     3380 usbhid.ko
10    1 0xffffffff82e28000     31f8 hidbus.ko
11    1 0xffffffff82e2c000     3320 wmt.ko
12    1 0xffffffff82e30000     3160 amdtemp.ko
13    1 0xffffffff82e34000     2138 amdsmn.ko
14    1 0xffffffff83000000   418220 amdgpu.ko
15    2 0xffffffff82e37000    739e0 drm.ko
16    3 0xffffffff82eab000     5220 linuxkpi_gplv2.ko
17    4 0xffffffff82eb1000     62d8 dmabuf.ko
18    1 0xffffffff82eb8000     c758 ttm.ko
19    1 0xffffffff82ec5000    2f048 amdgpu_navi14_sos_bin.ko
20    1 0xffffffff82ef5000    2c2d8 amdgpu_navi14_asd_bin.ko
21    1 0xffffffff82f22000     a3d8 amdgpu_navi14_ta_bin.ko
22    1 0xffffffff82f2d000    42a68 amdgpu_navi14_smc_bin.ko
23    1 0xffffffff82f70000    425d8 amdgpu_navi14_pfp_bin.ko
24    1 0xffffffff82fb3000    425d8 amdgpu_navi14_me_bin.ko
25    1 0xffffffff83419000    42558 amdgpu_navi14_ce_bin.ko
26    1 0xffffffff8345c000     c840 amdgpu_navi14_rlc_bin.ko
27    1 0xffffffff83469000    43a08 amdgpu_navi14_mec_bin.ko
28    1 0xffffffff834ad000    43a08 amdgpu_navi14_mec2_bin.ko
29    1 0xffffffff834f1000     a4d8 amdgpu_navi14_sdma_bin.ko
30    1 0xffffffff834fc000     a4d8 amdgpu_navi14_sdma1_bin.ko
31    1 0xffffffff83507000    64398 amdgpu_navi14_vcn_bin.ko

This is what will appear on your screen after the kldload(8) command.

amdgpu

To properly use GPU hardware we will need to add our user to the video group.

# pw groupmod video -m vermaden

We will now add some basic X11 tools along with Xorg to test our setup.

# pkg install -y xorg openbox xterm xinit mesa-demos scrot radeontop

While my desktop/laptop setup is well described in the FreeBSD Desktop page – I will only configure basic X11 setup to make sure everything works.

% echo openbox > ~/.xinitrc

% xinit

The X11 loaded Openbox properly and we can indeed verify that hardware GPU acceleration works properly.

openbox-mesa-demos

While the above image is quite small the important part is you want to see the direct rendering: Yes message from the glxinfo | grep direct command.

% glxinfo | grep direct
direct rendering: Yes

You can also check the full resolution screenshot HERE.

AUDIO

By default the audio goes out to the Mini Jack output on the motherboard.

My DisplayPort attached monitor has builtin speakers so I will switch the audio to them instead.

# cat /dev/sndstat   
Installed devices:
pcm0:  (play)
pcm1:  (play)
pcm2:  (play)
pcm3:  (play)
pcm4:  (play)
pcm5:  (play/rec) default
pcm6:  (play/rec)
No devices installed from userspace.

# sysctl hw.snd.default_unit=1

# cat /dev/sndstat
Installed devices:
pcm0:  (play)
pcm1:  (play) default
pcm2:  (play)
pcm3:  (play)
pcm4:  (play)
pcm5:  (play/rec)
pcm6:  (play/rec)
No devices installed from userspace.

To make that permanent I have added below lines to /etc/sysctl.conf file.

# cat /etc/sysctl.conf 

# AUDIO @ DisplayPort
  hw.snd.default_unit=1

While the /dev/sndstat states the output as HDMI the AMD Radeon 5500 XT has two DisplayPort outputs and two HDMI outputs.

The fifth HDMI output will be from the motherboard.

OTHER

This is how the FreeBSD main /etc/rc.conf file looks like.

# cat /etc/rc.conf
# NETWORK
  hostname=games.lab.org
  ifconfig_re0="inet 10.0.0.4/24 up"
  defaultrouter="10.0.0.1"
  gateway_enable=YES

# DAEMONS
  sshd_enable=YES
  powerd_enable=YES
  zfs_enable=YES
  ntpdate_enable=YES
  syslogd_flags="-ss"

# MODULES
  kld_list="amdgpu amdtemp"

# OTHER
  clear_tmp_enable=YES
  keymap=pl.kbd
  dumpdev=AUTO
  rc_startmsgs=NO
  rc_info=NO

# POWER
  performance_cx_lowest="Cmax"
  economy_cx_lowest="Cmax"

No other additional configuration is need.

I also uploaded the hardware probe to the bsd-hardware.info page and its available HERE.

Summary

I will use the box to test some things that I always wanted to – like Bhyve for example – or its sysutils/vm-bhyve manager. Expect some posts on this topic in the future πŸ™‚

Regards.

EOF

FreeBSD 13.2 on ThinkPad T14 (GEN1)

I used to run FreeBSD on older laptops – some more then a decade old – like my favorite ThinkPad W520 daily driver or ThinkPad X220 mobile companion. Today I will share with you my experiences of running latest production ready FreeBSD 13.2-RELEASE system on a quite modern ThinkPad T14 (GEN1) from 2021/2022 (depending on the source of the information) – which is quite new I would say.

… do not interpret this article wrong – The W520 and X220 (sometimes T420s) are still my daily/mobile/… drivers and my points explained in the Epitaph to Laptops article remain the same. I just had an opportunity to use ThinkPad T14 for several days so I thought it would be a good idea to check and document FreeBSD behavior on it.

In many parts this article will be a copy cat of the earlier FreeBSD 13.1 on ThinkPad W520 article – as the topic and configs are mostly the same – you have been warned πŸ™‚

ThinkPad T14 (GEN1)

As the ThinkPad T490 was released Lenovo needed to rethink their naming convention as the next one could have been ThinkPad T4100 (like 100 is after 90) or something different as T500 was already taken by older model … their new naming scheme is not bad – definitely better then their idea of newer keyboard layout after ditching the 7-row keyboard from 2011 and earlier models.

The model I was able to test on had quad core Intel i5-10210U model CPU which is somewhere between 25-35% faster (according to benchmarks) then the Intel i7-2860QM CPU from my ThinkPad W520. Not bad – especially knowing that the time span between their releases is 9 years … but to be honest – in real usage I do not feel that 25-35% more speed.

T14 % lscpu
Architecture:            amd64
Byte Order:              Little Endian
Total CPU(s):            8
Thread(s) per core:      2
Core(s) per socket:      4
Socket(s):               1
Vendor:                  GenuineIntel
CPU family:              6
Model:                   142
Model name:              Intel(R) Core(TM) i5-10210U CPU @ 1.60GHz
Stepping:                12
L1d cache:               32K
L1i cache:               32K
L2 cache:                256K
L3 cache:                6M
Flags:                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36
                         cflsh ds acpi mmx fxsr sse sse2 ss htt tm pbe sse3 pclmulqdq dtes64
                         monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1
                         sse4_2 x2apic movbe popcnt tsc_deadline aes xsave osxsave avx f16c rdrnd
                         fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid fpcsds mpx rdseed
                         adx smap clflushopt intel_pt syscall nx pdpe1gb rdtscp lm lahf_lm lzcnt

Below you can see how ThinkPad T14 (GEN1) looks like.

thinkpad-t14

To be honest I would even prefer to use ThinkPad SK-8855 USB keyboard as showed here below.

T14s-keyboard-upgraded

Specifications

Below You will find specs of this machine.

CPU: Intel Core i5-10210U (4C/8T) 14nm
RAM: 16 GB (2 * 8GB DDR4)
HDD0: 256GB WD Black SN750 M.2 [nvd(4)]
GFX0: Intel UHD Graphics (integrated) [graphics/drm-kmod]
SCR: 14.1 1920x1080 Touch Screen
USB: 2 x USB-A 3.0 + 1 x USB-C 3.0 [ehci(4) + xhci(4)]
AUDIO: Realtek ALC257 [snd_hda(4)]
PORTS: 1 x HDMI
SD: microSD Card Reader [sdhci(4)]
LAN: 10/100/1000 Intel I219-V Gigabit [em(4)]
WIFI: Intel Comet Lake PCH-LP CNVi WiFi 802.11ax [iwlwifi(4)]
CAM: Webcam 720p [multimedia/webcamd]

I have uploaded the https://bsd-hardware.info/ probe of that ThinkPad T14 to their database and its available – https://bsd-hardware.info/?probe=8aede62ca8 – here.

After messing with this laptop for a while I can tell you that in most areas its on par with mine ThinkPad W520 laptop. The battery time is similar (about 5 hours). The suspend/resume works when you use X11 with graphics/drm-kmod package. Even the touch screen works like a charm – the same as my other ThinkPad X220t (tablet) … and even no additional configuration was needed – I just used the configuration that I use daily on my ThinkPad W520 laptop. But … the WiFi does not work πŸ™‚ While iwlwifi(4) properly attaches to this card the wpa_supplicant(8) is just not able to connect to the Access Point. There are at least several ways on how to Cope with WiFi Fuckup on FreeBSD – feel free to check them out. I used my favorite fallback solution – Realtek RTL8188CUS USB dongle and that one worked really well with rtwn(4) driver.

FreeBSD System Configuration

From many things that I really like about FreeBSD (more here – Quare FreeBSD? – in separate article) is that it can be entirely configured using just 3 files. This configuration already features all power management settings that I described in the The Power to Serve – FreeBSD Power Management article.

I installed FreeBSD in a pretty standard way with GELI encryption enabled and with ZFS as the filesystem. When in doubt the installation procedure is described in the FreeBSD Desktop – Part 2.1 – Install FreeBSD 12 article.

Main FreeBSD configuration files.

  • /etc/rc.conf – to system services
  • /etc/sysctl.conf – for runtime parameters
  • /boot/loader.conf – for parameters configurable at boot

I will also include these as their are also crucial for the configuration:

  • /etc/devfs.rules – devices configuration/li>
  • /etc/fstab – filesystems configuration
  • /etc/ttys – terminal initialization configuration
  • /etc/wpa_supplicant.conf – WiFi configuration
  • /usr/local/etc/automount.confautomount(8) configuration
  • /usr/local/etc/doas.confdoas(1) configuration
  • Groups membership.

First the main /etc/rc.conf configuration file.

% cat /etc/rc.conf
# SILENCE # ------------------------------------------------------------------
  rc_startmsgs=NO

# NETWORK # ------------------------------------------------------------------
  hostname=t14.local
  background_dhclient=YES
  extra_netfs_types=NFS
  wlans_rtwn0=wlan0
  create_args_wlan0="country PL regdomain FCC4"
  ifconfig_wlan0="WPA SYNCDHCP"
  defaultroute_delay=3
  defaultroute_carrier_delay=3
  gateway_enable=YES
  harvest_mask=351
  rtsol_flags="-i"
  rtsold_flags="-a -i"

# MODULES/COMMON/BASE # ------------------------------------------------------
  kld_list="${kld_list} /boot/modules/i915kms.ko"
  kld_list="${kld_list} fusefs coretemp sem cpuctl ichsmb cuse"
  kld_list="${kld_list} libiconv cd9660_iconv msdosfs_iconv udf_iconv"

# MODULES/VIRTUALBOX # -------------------------------------------------------
  vboxnet_enable=YES
  kld_list="${kld_list} vboxdrv vboxnetadp vboxnetflt"

# POWER
  performance_cx_lowest=C1
  economy_cx_lowest=Cmax
  powerd_enable=YES
  powerd_flags="-n adaptive -a hiadaptive -b adaptive -m 800 -M 2000"

# DAEMONS | yes # ------------------------------------------------------------
  zfs_enable=YES
  xdm_enable=YES
  xdm_tty=ttyv4
  nfs_client_enable=YES
  ubuntu_enable=YES
  moused_enable=YES
  syslogd_flags='-s -s'
  sshd_enable=YES
  local_unbound_enable=YES
  webcamd_enable=YES
  rctl_enable=YES

# DAEMONS | no # -------------------------------------------------------------
  linux_enable=NO
  sendmail_enable=NONE
  sendmail_submit_enable=NO
  sendmail_outbound_enable=NO
  sendmail_msp_queue_enable=NO

# FS # -----------------------------------------------------------------------
  fsck_y_enable=YES
  clear_tmp_enable=YES
  clear_tmp_X=YES
  growfs_enable=YES

# OTHER # --------------------------------------------------------------------
  keyrate=fast
  keymap=pl.kbd
  virecover_enable=NO
  update_motd=NO
  devfs_system_ruleset=desktop
  hostid_enable=NO
  savecore_enable=NO

Now the runtime parameters /etc/sysctl.conf file.

% cat /etc/sysctl.conf
# SECURITY
  security.bsd.see_jail_proc=0
  security.bsd.unprivileged_proc_debug=0

# SECURITY/RANDOM PID
  kern.randompid=1

# ANNOYING THINGS
  vfs.usermount=1
  kern.coredump=0
  hw.syscons.bell=0
  kern.vt.enable_bell=0

# ZFS DELETE FUCKUP TRIM (DEFAULT: 64)
  vfs.zfs.vdev.trim_max_active=1

# ZFS ARC TUNING
  vfs.zfs.arc.min=134217728
  vfs.zfs.arc.max=536870912

# ZFS ARC FREE ENFORCE @ 1024 \* 1024 \* 3
  vfs.zfs.arc_free_target=3145728

# JAILS/ALLOW UPGRADES IN JAILS
  security.jail.chflags_allowed=1

# JAILS/ALLOW RAW SOCKETS
  security.jail.allow_raw_sockets=1

# DESKTOP/INTERACTIVITY
  kern.sched.preempt_thresh=224

# DESKTOP QUANTUM FOR TIMESHARE THREADS IN stathz TICKS (12) NomadBSD
  kern.sched.slice=3

# DESKTOP/IRIDIUM/CHROMIUM
  kern.ipc.shm_allow_removed=1

# SAMPLE RATE CONVERTER QUALITY (0=low .. 4=high) (1) NomadBSD
  hw.snd.feeder_rate_quality=3

# PERFORMANCE/ALL SHARED MEMORY SEGMENTS WILL BE MAPPED TO UNPAGEABLE RAM
  kern.ipc.shm_use_phys=1

# VIRTUALBOX aio(4) SETTINGS
  vfs.aio.max_buf_aio=8192
  vfs.aio.max_aio_queue_per_proc=65536
  vfs.aio.max_aio_per_proc=8192
  vfs.aio.max_aio_queue=65536

# POWER CONSUMPTION / SILENT FANS Intel 6th GEN+ / ONE LINE FOR EACH TH
# DETAILS IN THE hwpstate_intel(4) MAN PAGE
  dev.hwpstate_intel.0.epp=100
  dev.hwpstate_intel.1.epp=100
  dev.hwpstate_intel.2.epp=100
  dev.hwpstate_intel.3.epp=100
  dev.hwpstate_intel.4.epp=100
  dev.hwpstate_intel.5.epp=100
  dev.hwpstate_intel.6.epp=100
  dev.hwpstate_intel.7.epp=100

# NETWORK/DO NOT SEND RST ON SEGMENTS TO CLOSED PORTS
  net.inet.tcp.blackhole=2

# NETWORK/DO NOT SEND PORT UNREACHABLES FOR REFUSED CONNECTS
  net.inet.udp.blackhole=1

# NETWORK/LIMIT ON SYN/ACK RETRANSMISSIONS (3)
  net.inet.tcp.syncache.rexmtlimit=0

# NETWORK/USE TCP SYN COOKIES IF THE SYNCACHE OVERFLOWS (1)
  net.inet.tcp.syncookies=0

# NETWORK/ASSIGN RANDOM ip_id VALUES (0)
  net.inet.ip.random_id=1

# NETWORK/ENABLE SENDING IP REDIRECTS (1)
  net.inet.ip.redirect=0

# NETWORK/IGNORE ICMP REDIRECTS (0)
  net.inet.icmp.drop_redirect=1

# NETWORK/DROP TCP PACKETS WITH SYN+FIN SET (0)
  net.inet.tcp.drop_synfin=1

# NETWORK/RECYCLE CLOSED FIN_WAIT_2 CONNECTIONS FASTER (0)
  net.inet.tcp.fast_finwait2_recycle=1

# NETWORK/CERTAIN ICMP UNREACHABLE MESSAGES MAY ABORT CONNECTIONS IN SYN_SENT (1)
  net.inet.tcp.icmp_may_rst=0

The biggest difference for ThinkPad T14 against the ThinkPad W520 is this part below.

# POWER CONSUMPTION / SILENT FANS Intel 6th GEN+ / ONE LINE FOR EACH TH
# DETAILS IN THE hwpstate_intel(4) MAN PAGE
  dev.hwpstate_intel.0.epp=100
  dev.hwpstate_intel.1.epp=100
  dev.hwpstate_intel.2.epp=100
  dev.hwpstate_intel.3.epp=100
  dev.hwpstate_intel.4.epp=100
  dev.hwpstate_intel.5.epp=100
  dev.hwpstate_intel.6.epp=100
  dev.hwpstate_intel.7.epp=100

It was not needed/non existent on the ThinkPad W520 hardware.

Now the boot parameters /boot/loader.conf file.

% cat /boot/loader.conf
# CONSOLE COMMON
  autoboot_delay=2       # OPT. '-1' => NO WAIT | OPT. 'NO' => INFINITE WAIT
  hw.usb.no_boot_wait=1  # DO NOT WAIT FOR USB DEVICES FOR ROOT (/) FILESYSTEM
  boot_mute=YES          # LIKE '-m' IN LOADER - MUTE CONSOLE WITH FreeBSD LOGO
  loader_logo=none       # DESIRED LOGO OPTIONS: fbsdbw beastiebw beastie none
  loader_menu_frame="none"
  screen.font="6x12"

# CONSOLE RESOLUTION
  kern.vt.fb.default.mode="1920x1080"
  efi_max_resolution="1920x1080"

# WINE FIX
  machdep.max_ldt_segment=2048

# MODULES - BOOT
  aesni_load=YES
  geom_eli_load=YES
  cryptodev_load=YES
  zfs_load=YES

# drm-kmod PACKAGE - USE SEMAPHORES FOR INTER-RING SYNC
  compat.linuxkpi.semaphores=1

# drm-kmod PACKAGE - ENABLE POWER-SAVING RENDER C-STATE 6
  compat.linuxkpi.enable_rc6=7

# drm-kmod PACKAGE - ENABLE POWER-SAVING DISPLAY C-STATES
  compat.linuxkpi.enable_dc=2

# drm-kmod PACKAGE - ENABLE FRAME BUFFER COMPRESSION FOR POWER SAVINGS
  compat.linuxkpi.enable_fbc=1

# ENABLE SYNAPTICS
  hw.psm.synaptics_support=1

# DISABLE /dev/diskid/* ENTRIES FOR DISKS
  kern.geom.label.disk_ident.enable=0

# DISABLE /dev/gptid/* ENTRIES FOR DISKS
  kern.geom.label.gptid.enable=0

# TERMINAL vt(4) COLORS
  kern.vt.color.0.rgb="#000000"
  kern.vt.color.1.rgb="#dc322f"
  kern.vt.color.2.rgb="#859900"
  kern.vt.color.3.rgb="#b58900"
  kern.vt.color.4.rgb="#268bd2"
  kern.vt.color.5.rgb="#ec0048"
  kern.vt.color.6.rgb="#2aa198"
  kern.vt.color.7.rgb="#94a3a5"
  kern.vt.color.8.rgb="#586e75"
  kern.vt.color.9.rgb="#cb4b16"
  kern.vt.color.10.rgb="#859900"
  kern.vt.color.11.rgb="#b58900"
  kern.vt.color.12.rgb="#268bd2"
  kern.vt.color.13.rgb="#d33682"
  kern.vt.color.14.rgb="#2aa198"
  kern.vt.color.15.rgb="#6c71c4"

# RACCT/RCTL RESOURCE LIMITS
  kern.racct.enable=1

# DISABLE ZFS PREFETCH
  vfs.zfs.prefetch_disable=1

# POWER MGMT / POWER OFF DEVICES WITHOUT ATTACHED DRIVER
  hw.pci.do_power_nodriver=3

# POWER MANAGEMENT FOR EVERY USED AHCI CHANNEL (ahcich 0-7)
  hint.ahcich.0.pm_level=5
  hint.ahcich.1.pm_level=5
  hint.ahcich.2.pm_level=5
  hint.ahcich.3.pm_level=5
  hint.ahcich.4.pm_level=5
  hint.ahcich.5.pm_level=5
  hint.ahcich.6.pm_level=5
  hint.ahcich.7.pm_level=5

# GELI THREADS
  kern.geom.eli.threads=4

Now the mentioned /etc/devfs.rules file.

% cat /etc/devfs.rules
[desktop=10]
add path 'acd*'      mode 0660 group operator
add path 'cd*'       mode 0660 group operator
add path 'da*'       mode 0660 group operator
add path 'pass*'     mode 0660 group operator
add path 'xpt*'      mode 0660 group operator
add path 'fd*'       mode 0660 group operator
add path 'md*'       mode 0660 group operator
add path 'uscanner*' mode 0660 group operator
add path 'lpt*'      mode 0660 group cups
add path 'ulpt*'     mode 0660 group cups
add path 'unlpt*'    mode 0660 group cups
add path 'ugen*'     mode 0660 group operator
add path 'usb/*'     mode 0660 group operator
add path 'video*'    mode 0660 group operator
add path 'cuse*'     mode 0660 group operator

Filesystems and SWAP configuration.

% cat /etc/fstab
# SWAP
  /dev/gpt/swap0  none  swap  sw  0 0

# FreeBSD PSEUDO - NEEDED BY wine(1)
  procfs  /proc  procfs  rw  0 0

# Ubuntu Linux PSEUDO
  linprocfs  /compat/ubuntu/proc     linprocfs  rw,late                    0 0
  linsysfs   /compat/ubuntu/sys      linsysfs   rw,late                    0 0
  devfs      /compat/ubuntu/dev      devfs      rw,late                    0 0
  fdescfs    /compat/ubuntu/dev/fd   fdescfs    rw,late,linrdlnk           0 0
  tmpfs      /compat/ubuntu/dev/shm  tmpfs      rw,late,size=1g,mode=1777  0 0
  /home      /compat/ubuntu/home     nullfs     rw,late                    0 0
  /tmp       /compat/ubuntu/tmp      nullfs     rw,late                    0 0

Terminals configuration under /etc/ttys file. Important part is the ttyv4 entry to match the xdm_tty=ttyv4 value from /etc/rc.conf file.

% grep '^[^#]' /etc/ttys | cat
console none                            unknown off insecure
ttyv0   "/usr/libexec/getty Pc"         xterm   onifexists secure
ttyv1   "/usr/libexec/getty Pc"         xterm   onifexists secure
ttyv2   "/usr/libexec/getty Pc"         xterm   onifexists secure
ttyv3   "/usr/libexec/getty Pc"         xterm   onifexists secure
ttyv4   "/usr/libexec/getty Pc"         xterm   off secure
ttyv5   "/usr/libexec/getty Pc"         xterm   off secure
ttyv6   "/usr/libexec/getty Pc"         xterm   off secure
ttyv7   "/usr/libexec/getty Pc"         xterm   off secure
ttyv4   "/usr/local/bin/xdm -nodaemon"  xterm   off secure
ttyu0   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
ttyu1   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
ttyu2   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
ttyu3   "/usr/libexec/getty 3wire"      vt100   onifconsole secure
dcons   "/usr/libexec/getty std.9600"   vt100   off secure
xc0     "/usr/libexec/getty Pc"         xterm   onifconsole secure
rcons   "/usr/libexec/getty std.9600"   vt100   onifconsole secure

I kept wireless config in /etc/rc.conf file this time – it does conflicts with my own network.sh solution to connect to various both wire and wireless networks – FreeBSD Network Management with network.sh Script – described in details here.

# cat /etc/wpa_supplicant.conf
# GENERAL
eapol_version=2
ap_scan=1
fast_reauth=1

# OPEN NETWORKS
network={
  key_mgmt=NONE
  priority=0
}

# NETWORK WITH HIDDEN SSID
network={
  scan_ssid=1
  ssid="hidden-network"
  psk="12341234"
  priority=0
}

# NAMED OPEN NETWORK
network={
  ssid="Free_Internet"
  key_mgmt=NONE
  priority=0
}

# NORMAL WPA/WPA2 SECURED NETWORK
network={
  ssid="SECURED"
  psk="12345678"
}

The automount(8) config.

% cat /usr/local/etc/automount.conf
  USERUMOUNT=YES
  USER=vermaden
  FM='caja --no-desktop'
  NICENAMES=YES

The doas(1) configuration.

# cat /usr/local/etc/doas.conf
# CORE
  permit nopass keepenv root     as root
  permit nopass keepenv vermaden as root

# THE network.sh SCRIPT
  # pw groupmod network -m YOURUSERNAME
  # cat /usr/local/etc/doas.conf
  permit nopass :network as root cmd /etc/rc.d/netif args onerestart
  permit nopass :network as root cmd /usr/sbin/service args squid onerestart
  permit nopass :network as root cmd dhclient
  permit nopass :network as root cmd ifconfig
  permit nopass :network as root cmd killall args -9 dhclient
  permit nopass :network as root cmd killall args -9 ppp
  permit nopass :network as root cmd killall args -9 wpa_supplicant
  permit nopass :network as root cmd ppp
  permit nopass :network as root cmd route
  permit nopass :network as root cmd tee args -a /etc/resolv.conf
  permit nopass :network as root cmd tee args /etc/resolv.conf
  permit nopass :network as root cmd umount
  permit nopass :network as root cmd wpa_supplicant

Groups I am member of.

% id vermaden | tr ' ' '\n' | tr ',' '\n'
uid=1000(vermaden)
gid=1000(vermaden)
groups=1000(vermaden)
0(wheel)
5(operator)
44(video)
69(network)
145(webcamd)
920(vboxusers)

I also do not rely on ‘stock’ fan speeds and set my own speeds according to CPU temperature with acpi-thinkpad-fan.sh script.

X11

While X11 did not need any custom configuration and it worked out of the box – I have done two things to make it work slightly differently.

First one is to allow CTRL+ALT+BACKSPACE fast way to restart X11.

t14 % cat /usr/local/etc/X11/xorg.conf.d/flags.conf
Section "ServerFlags"
  Option "DontZap" "off"
EndSection

The other one is to enable Tap to Click and Natural Scrolling on a Synaptics touchpad.

t14 % cat /usr/local/etc/X11/xorg.conf.d/touchpad.conf
Section "InputClass"
  Identifier "touchpad"
  MatchIsTouchpad "on"
  Driver "libinput"
  Option "Tapping" "on"
  Option "NaturalScrolling" "on"
EndSection

Comparison to ThinkPad W520

I compared the two laptops. While ThinkPad W520 is heavy and bulky the ThinkPad T14 (GEN1) is light and slim. They both have similar 5 hours battery time on FreeBSD.

You can see the screen brightness comparison between these two below.

LARGE-compare-screen-brightness

The ThinkPad T14 (GEN1) has several flavors of the FullHD screen – check reviews and specs for details. For the record – ThinkPad W520 is on the left.

Below you will find size comparisons.

The view from the top.

LARGE-compare-top

View from the side.

LARGE-compare-side

… and from the side one over another.

LARGE-compare-over

Desktop Environment

Openbox

As for the ‘desktop environment’ that I use – its my custom setup with Openbox along with tools like Tint2 and Dzen2 – for the most basic setup. The screenshot is from FreeBSD 11.1 but it looks exactly the same today.

freebsd-desktop-2019-04

I described this setup in details in the entire FreeBSD Desktop series.

XFCE

I have also tried XFCE – I liked it especially with the Global Menu appmenu plugin. You go this way with this XFCE Cupertino Way handy guide.

xfce-ghostbsd

GNOME

I also tried GNOME for a test – it did not suit me well so I went back to my Openbox setup – but You may find it more comfortable to use. Here is the FreeBSD GNOME 3 Fast Track article that will help you with that.

gnome-8-fixed

Temperatures

I used mine sensors.sh script for that – results below.

t14 # sensors.sh

            BATTERY/AC/TIME/FAN/SPEED
 ------------------------------------
             dev.acpi_ibm.0.fan_level: 1
             dev.acpi_ibm.0.fan_speed: 65535
                   dev.acpi_ibm.0.fan: 0
               dev.cpu.0.cx_supported: C1/1/1 C2/2/151 C3/3/1034
                   dev.cpu.0.cx_usage: 9.02% 35.95% 55.02% last 35us
                       dev.cpu.0.freq: 802
                       hw.acpi.acline: 0
                 hw.acpi.battery.life: 99
                 hw.acpi.battery.time: 275
                hw.acpi.cpu.cx_lowest: C8
                            powerd(8): running

                  SYSTEM/TEMPERATURES
 ------------------------------------
                dev.cpu.0.temperature: 38.0C (max: 100.0C)
                dev.cpu.1.temperature: 39.0C (max: 100.0C)
                dev.cpu.2.temperature: 39.0C (max: 100.0C)
                dev.cpu.3.temperature: 39.0C (max: 100.0C)
                dev.cpu.4.temperature: 40.0C (max: 100.0C)
                dev.cpu.5.temperature: 41.0C (max: 100.0C)
                dev.cpu.6.temperature: 38.0C (max: 100.0C)
                dev.cpu.7.temperature: 38.0C (max: 100.0C)
           dev.pchtherm.0.temperature: 46.0C
      hw.acpi.thermal.tz0.temperature: 46.1C (max: 128.1C)

                   DISKS/TEMPERATURES
 ------------------------------------
             smart.nvme0.temperature:: 44.0C

Accessories

There are some accessories that are very handy with the ThinkPad T14 laptop – I will describe them below.

Power Supply

You can use the default ThinkPad T14 power supply and you can also use any USB-C power delivery charger – that is nice addition.

Mouse Companion

After checking many mouse models – as described in the UNIX Mouse Shootout article – I finally settled with Logitech Triathlon M720 mouse. I have plugged the Lenovo USB Receiver into the back ‘powered’ USB port. While I use that mouse over the USB receiver you can also connect it using Bluetooth – also to other computers. This mouse has a special dedicated button to switch between 3 different computers. Unfortunately the copy-paste between them does not work πŸ™‚

mouse-M720

Battery

Some battery details below.

t14 % acpiconf -i 0
Design capacity:        50450 mWh
Last full capacity:     45760 mWh
Technology:             secondary (rechargeable)
Battery Swappable Capability:   Non-swappable
Design voltage:         11520 mV
Capacity (warn):        2288 mWh
Capacity (low):         200 mWh
Cycle Count:            204
Mesurement Accuracy:    95 %
Max Average Interval:   1000 ms
Min Average Interval:   500 ms
Low/warn granularity:   -1 mWh
Warn/full granularity:  -1 mWh
Model number:           5B10W13906
Serial number:           1071
Type:                   LiP
OEM info:               SMP
State:                  discharging
Remaining capacity:     99%
Remaining time:         4:31
Present rate:           10094 mW
Present voltage:        12681 mV

Experience

Today I ‘recognize’ three laptop keyboard layouts.

  • Best in class 7-row keyboards with INS/DEL and HOME/END and PGUP/PGDN keys block on the right top side.
  • Least PITA ThinkPad T14 like keyboards where PGUP/PGDN keys are in the ARROWS area and HOME/END/INS/DEL block is provided on the top right part.
  • Everything else that I treat like shit.

My fingers do not remember this HOME/END/INS/DEL block that much well – but at its still several ways of magnitude better then any Macbook keyboard layout.

Summary

I will still use mine ThinkPad W520 daily – I still do not need to move to other/less old laptop.

As you can see FreeBSD works quite well with modern laptops – hope someone can find that article useful.

UPDATE 1 – WiFi Works with FreeBSD 14.0-BETA1

As the FreeBSD 14.0-RELEASE is approaching completion I checked again the ThinkPad T14 WiFi with newer FreeBSD version. I am happy to report that now – with 14.0-BETA1 version of FreeBSD – the WiFi works. The iwlwifi(4) driver now successfully works. There is only one downside – its very slow – usable for browsing the Internet and stuff – but slow.

My ThinkPad W520 has Intel Centrino Ultimate-N 6300 WiFi card supported by the iwn(4) driver. This card was introduced in 2011 – 12 years ago. With that old Intel 6300 card I am able to reach 12 MB/s speed both for upload and download speeds on FreeBSD – using 802.11g mode as 802.11n is not (yet) supported on FreeBSD.

The Intel Comet Lake CNVi WiFi card from 2019 on ThinkPad T14 with current state of iwlwifi(4) driver allows about 500 KB/s for upload and 2.5 MB/s for download.

Still better then attaching the additional USB WiFi adapter or device passthru to Bhyve hypervisor for wifibox workaround πŸ™‚

EOF

Native Urban Terror on FreeBSD

Welcome to 2023 and let me start a first article of this new year with a … guest post by @NeoMoevius from Twitter. That is right. I did not invented it. I did not created it. I only partially wrote it – treat me as a ghost writer here. ll the thanks and welcomes goes directly to @NeoMoevius – I am just a messenger here πŸ™‚

This post will be about playing (and first building – of course) the Urban Terror game on FreeBSD system. It is about how to build and install Urban Terror 4.3 on FreeBSD without Linux emulation or using WINE. Natively. This will be on the latest and supported FreeBSD 13.1-RELEASE system.

There are not many steps to make it happen. First – just download the official Urban Terror ZIP file.

% mkdir _UT
% cd _UT
% fetch http://cdn.urbanterror.info/urt/43/releases/zips/UrbanTerror434_full.zip
UrbanTerror434_full.zip                         3% of 1403 MB 1836 kBps 11m38s
% unzip UrbanTerror434_full.zip
% cd UrbanTerror43
% pwd
/home/vermaden/_UT/UrbanTerror43

Lets leave that alone for now πŸ™‚

We will also need to install some dependencies.

# pkg install -y \
    devel/sdl20 \
    devel/pkgconf \
    devel/gmake \
    ftp/curl \
    graphics/sdl2_image \
    graphics/sdl2_ttf \
    audio/sdl2_mixer \
    audio/openal-soft

We will now need to download and compile source code of ioquake 3 for Urban Terror.

% mkdir _IOQ3
% cd _IOQ3
% git clone https://github.com/mickael9/ioq3.git
Cloning into 'ioq3'...
remote: Enumerating objects: 28169, done.
Receiving objects:  19% (5353/28169), 6.77 MiB | 2.24 MiB/s
% cd ioq3
% gmake
% echo ${?}
0
% cd build/release-freebsd-x86_64
% ls -l
total 2773K
drwxr-xr-x 2 vermaden vermaden       2 2023-01-20 20:11 autoupdater/
drwxr-xr-x 4 vermaden vermaden     228 2023-01-20 20:12 client/
drwxr-xr-x 2 vermaden vermaden     154 2023-01-20 20:11 ded/
drwxr-xr-x 2 vermaden vermaden     166 2023-01-20 20:12 renderergl1/
drwxr-xr-x 3 vermaden vermaden      77 2023-01-20 20:12 renderergl2/
-rwxr-xr-x 1 vermaden vermaden  862712 2023-01-20 20:12 renderer_opengl1_x86_64.so
-rwxr-xr-x 1 vermaden vermaden 1143552 2023-01-20 20:12 renderer_opengl2_x86_64.so
-rwxr-xr-x 1 vermaden vermaden 2133400 2023-01-20 20:12 urbanterror-m9.x86_64
-rwxr-xr-x 1 vermaden vermaden  970368 2023-01-20 20:11 urbanterror-server-m9.x86_64

The files that are interesting for us are listed below:

  • renderer_opengl1_x86_64.so
  • renderer_opengl2_x86_64.so
  • urbanterror-m9.x86_64
  • urbanterror-server-m9.x86_64

… and now you will need to copy these four files into the Urban Terror folder when you have uncompressed the game.

% cp \
    renderer_opengl1_x86_64.so   \
    renderer_opengl2_x86_64.so   \
    urbanterror-m9.x86_64        \
    urbanterror-server-m9.x86_64 \
    /home/vermaden/_UT/UrbanTerror43

% cd /home/vermaden/_UT/UrbanTerror43

% pwd
/home/vermaden/_UT/UrbanTerror43

% ls -l
total 8495K
drwxr-xr-x 2 vermaden vermaden      30 2023-01-20 20:19 q3ut4/
drwxr-xr-x 3 vermaden vermaden       3 2023-01-20 20:19 Quake3-UrT.app/
-rw-r--r-- 1 vermaden vermaden 1082800 2018-06-21 22:08 Quake3-UrT-Ded.exe
-rwxr-xr-x 1 vermaden vermaden  816002 2018-06-21 22:08 Quake3-UrT-Ded.i386
-rwxr-xr-x 1 vermaden vermaden  961958 2018-06-21 22:08 Quake3-UrT-Ded.x86_64
-rw-r--r-- 1 vermaden vermaden 2634689 2018-06-21 22:08 Quake3-UrT.exe
-rwxr-xr-x 1 vermaden vermaden 1702624 2018-06-21 22:08 Quake3-UrT.i386
-rwxr-xr-x 1 vermaden vermaden 1940280 2018-06-21 22:08 Quake3-UrT.x86_64
-rwxr-xr-x 1 vermaden vermaden  862712 2023-01-20 20:20 renderer_opengl1_x86_64.so
-rwxr-xr-x 1 vermaden vermaden 1143552 2023-01-20 20:20 renderer_opengl2_x86_64.so
-rwxr-xr-x 1 vermaden vermaden 2133400 2023-01-20 20:20 urbanterror-m9.x86_64
-rwxr-xr-x 1 vermaden vermaden  970368 2023-01-20 20:20 urbanterror-server-m9.x86_64

We will now try to start that Urban Terror game.

% pwd
/home/vermaden/_UT/UrbanTerror43

% ./urbanterror-m9.x86_64
ioq3-UrT m9-builds/31 freebsd-x86_64 Jan 20 2023
SSE instruction set enabled
----- FS_Startup -----
We are looking in the current search path:
/home/vermaden/.q3a/q3ut4
./q3ut4
./q3ut4/zUrT43_qvm.pk3 (4 files)
./q3ut4/zUrT43_021.pk3 (85 files)
./q3ut4/zUrT43_020.pk3 (295 files)
./q3ut4/zUrT43_019.pk3 (342 files)
./q3ut4/zUrT43_018.pk3 (801 files)
(...)

Seems to start and work properly.

Here are several shots of what I tried to play it for some single online event.

urban-terror-01

urban-terror-02

urban-terror-03

urban-terror-04

All the screens above are in the windowed more but you can switch between window and full screen with [ALT]+[ENTER] shortcut at anytime. It was just easier for me to catch several shots for this article πŸ™‚

Seems I am definitely not the best at this game :p

urban-terror-05

The Urban Terror game run smooth on my Intel HD Graphics 3000 card.

Fortunately I did not need to switch BIOS settings to start my decade old Nvidia Quadro 2000M monster :p

Not sure what I can add here – definitely a kind thank You for @NeoMoevius for his offer of making this content available for You πŸ™‚

Regards.

Desktop Environments Resource Usage Comparison

Some of them use more RAM. Some less. Today in a rather simplified benchmark I will check some popular desktop environments for their RAM usage. I recently came to see some more or less old comparisons of various desktop environments RAM usage.

They were focused on difference between XFCE and KDE/Plasma environments. I am used to idea that XFCE is smaller and lighter of the two – so it should be also lighter on resources – but these two movies state that they RAM usage is similar and sometimes even KDE/Plasma is lighter. These results seemed strange to me so I wanted to test them under latest FreeBSD 13.1-RELEASE UNIX system.

Example XFCE on FreeBSD desktop screenshot from the XFCE Cupertino Way article.

xfce-ghostbsd

Upon some popular demand I also added GNOME (the 42 version) to the comparison.

Today we will test these desktop environments:

  • XFCE (4.16)
  • MATE (1.26)
  • KDE/Plasma (5.24)
  • Openbox (3.6)
  • GNOME (42)

We all know that Openbox is just a window manager but I wanted to include it here just from comparison.

Test Environment and Process

To save time I used VirtualBox virtual machine for the purpose of these simplified benchmarks. For that purpose he created VM had:

  • 1 x CPU
  • 8 GB RAM
  • 128 MB GPU Memory
  • 30 GB Disk

After installing the vanilla FreeBSD 13.1-RELEASE I switched to the latest pkg(8) repository. Then I added needed packages:

# pkg install xorg xfce kde5 mate openbox dzen2 tint2 xbindkeys xterm geany gnome

All of the desktop environments and their dependencies were installed on that test machine. The main FreeBSD config at /etc/rc.conf file had following contents.

% cat /etc/rc.conf
hostname="freebsd"
ifconfig_em0="DHCP"
sshd_enable="YES"
moused_enable="YES"
powerd_enable="YES"
dumpdev="AUTO"
zfs_enable="YES"
dbus_enable="YES"

The only thing I added after installation was the dbus service startup. I did not changed any settings in these environments. The were compared at their default settings.

The test was rather simple and naive but these were the tasks that I done on each of them.

  • Run gstat(8) command in terminal application.
  • Display /etc/ in file manager with scroll to end of display of dir.
  • Open /etc/ssh/moduli file in text editor with scroll to end of file.

These were different for various environments:

XFCE

  • xfce4-terminal
  • thunar
  • mousepad

MATE

  • mate-terminal
  • caja
  • pluma

KDE/Plasma

  • konsole
  • dolphin
  • kate

Openbox

  • xterm
  • caja
  • geany

GNOME

  • gnome-terminal
  • nautilus
  • gedit

I powered off that FreeBSD machine before each test – so each test looked like:

  • boot cold FreeBSD system
  • login into system (in text console)
  • type xinit(1) command
  • do the 3 defined tasks

Each desktop environment had different ~/.xinitrc file. Below you will find their contents.

% cat ~/.xinitrc.xfce
. /usr/local/etc/xdg/xfce4/xinitrc

% cat ~/.xinitrc.mate
exec ck-launch-session mate-session

% cat ~/.xinitrc.kde
exec ck-launch-session startplasma-x11

% cat ~/.xinitrc.openbox
dzen2 &
tint2 &
xbindkeys &
exec openbox

% cat ~/.xinitrc.gnome
exec gnome-session

Each of them were started like that:

% xinit ~/.xinitrc.xfce

% xinit ~/.xinitrc.mate

% xinit ~/.xinitrc.kde

% xinit ~/.xinitrc.openbox

% xinit ~/.xinitrc.gnome

RAM Usage Results

To be honest I was surprised by the results.

Clean Text Console FreeBSD

The text console of FreeBSD 13.1-RELEASE system used about 97 MB of RAM. That result is the sum of the RES column from the top(1) command.

Below you will find the top(1) output for FreeBSD text console only system.

% top -b -o res 1000
last pid:   871;  load averages:  1.92,  0.90,  0.36; battery: 99%  up 0+00:01:09    00:34:01
28 processes:  2 running, 26 sleeping
CPU:  2.0% user,  0.0% nice,  3.7% system,  0.2% interrupt, 94.0% idle
Mem: 18M Active, 21M Inact, 138M Wired, 40K Buf, 7746M Free
ARC: 43M Total, 18M MFU, 23M MRU, 335K Header, 1556K Other
     20M Compressed, 61M Uncompressed, 3.09:1 Ratio
Swap: 2048M Total, 2048M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  852 vermaden      1  20    0    21M  9492K RUN      0:00   0.00% sshd
  849 root          1  33    0    21M  9300K select   0:00   0.00% sshd
  799 root          1  22    0    21M  8208K select   0:00   0.00% sshd
  817 root          1  20    0    18M  7140K select   0:00   0.00% sendmail
  820 smmsp         1  52    0    18M  6704K pause    0:00   0.00% sendmail
  749 messagebus    1  52    0    14M  3648K select   0:00   0.00% dbus-daemon
  853 vermaden      1  20    0    13M  3256K wait     0:00   0.00% sh
  871 vermaden      1  20    0    14M  3220K RUN      0:00   0.00% top
  846 vermaden      1  52    0    13M  3208K ttyin    0:00   0.00% sh
  838 root          1  25    0    13M  3100K wait     0:00   0.00% login
  463 _dhcp         1  52    0    13M  2828K select   0:00   0.00% dhclient
  668 root          1  20    0    13M  2748K select   0:00   0.00% syslogd
  830 root          1  52    0    13M  2736K wait     0:00   0.00% sh
  402 root          1  52    0    13M  2708K select   0:00   0.00% dhclient
  399 root          1  52    0    13M  2632K select   0:00   0.00% dhclient
  802 root          1  20    0    13M  2516K nanslp   0:00   0.00% cron
  831 root          1  52    0    13M  2440K piperd   0:00   0.00% logger
  754 root          1  52    0    13M  2380K select   0:00   0.00% moused
  837 root          1  52    0    13M  2316K select   0:00   0.00% logger
  842 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  845 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  843 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  844 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  841 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  839 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  840 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  833 root          1  52    0    12M  2080K nanslp   0:00   0.00% sleep
  464 root          1  20    0    11M  1540K select   0:00   0.00% devd

XFCE

Next one is XFCE and it used about 1548 MB of RAM.

Below you will find the top(1) output for XFCE.

% top -b -o res 1000
last pid:  1076;  load averages:  0.58,  0.84,  0.51; battery: 99%  up 0+00:07:06    00:31:07
71 processes:  2 running, 69 sleeping
CPU:  7.6% user,  0.1% nice,  6.5% system,  1.1% interrupt, 84.8% idle
Mem: 292M Active, 337M Inact, 389M Wired, 56K Buf, 6897M Free
ARC: 240M Total, 98M MFU, 133M MRU, 1762K Header, 7212K Other
     194M Compressed, 461M Uncompressed, 2.37:1 Ratio
Swap: 2048M Total, 2048M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  945 vermaden      3  20    0   344M   251M select   0:11   0.00% Xorg
 1010 vermaden      4  20    0   311M   121M select   0:01   0.00% kgpg
 1004 vermaden      5  20    0   196M   100M select   0:04   0.00% xfwm4
 1008 vermaden      4  20    0   130M    92M select   0:01   0.00% xfdesktop
  948 vermaden      4  20    0   172M    76M select   0:04   0.00% xfce4-session
 1012 vermaden      6  40   19   160M    63M select   0:00   0.00% tumblerd
 1064 vermaden      5  21    0    89M    59M select   0:05   0.00% mousepad
 1013 vermaden      3  20    0   130M    52M select   0:00   0.00% kalendarac
 1007 vermaden      4  24    0    75M    51M select   0:04   0.00% thunar
 1006 vermaden      4  20    0    75M    48M select   0:04   0.00% xfce4-panel
 1056 vermaden      4  20    0    69M    42M select   0:01   0.00% xfce4-terminal
 1020 vermaden      4  20    0    65M    41M select   0:00   0.00% wrapper-2.0
 1021 vermaden      4  20    0    65M    41M select   0:00   0.00% wrapper-2.0
 1022 vermaden      4  20    0    52M    32M select   0:00   0.00% wrapper-2.0
 1005 vermaden      4  20    0    49M    30M select   0:02   0.00% xfsettingsd
 1019 vermaden      4  20    0    46M    30M select   0:00   0.00% wrapper-2.0
 1027 vermaden      3  40   19   256G    29M select   0:00   0.00% baloo_file
 1009 vermaden      4  20    0    46M    28M select   0:00   0.00% xfce4-power-manager
  975 polkitd       7  20    0  2125M    27M select   0:01   0.00% polkitd
 1029 vermaden      4  20    0    45M    27M select   0:00   0.00% xfce4-notifyd
  977 vermaden      5  20    0    49M    26M select   0:01   0.00% mate-screensaver
  983 root          7  20    0    64M    16M select   0:01   0.00% bsdisks
  981 vermaden      5  20    0    27M    11M select   0:00   0.00% gvfs-udisks2-volume
 1067 vermaden      5  20    0    24M    10M select   0:00   0.00% gvfsd-network
 1038 vermaden      4  20    0    27M    10M select   0:00   0.00% gvfsd-trash
 1070 vermaden      4  20    0    24M    10M select   0:00   0.00% gvfsd-dnssd
 1063 vermaden      4  20    0    24M    10M select   0:00   0.00% gvfsd-computer
  865 vermaden      1  20    0    21M  9492K RUN      0:00   0.00% sshd
 1042 vermaden      2  22    0    86M  9440K select   0:00   0.00% pulseaudio
  862 root          1  28    0    21M  9264K select   0:00   0.00% sshd
  979 vermaden      4  32    0    24M  8836K select   0:00   0.00% gvfsd
  973 vermaden      4  20    0    21M  8712K select   0:00   0.00% at-spi2-registryd
  966 vermaden      5  20    0    21M  8296K select   0:00   0.00% at-spi-bus-launcher
  972 root         16  20    0    24M  8256K select   0:00   0.00% console-kit-daemon
  815 root          1  22    0    21M  8208K select   0:00   0.00% sshd
  991 vermaden      5  20    0    21M  7948K select   0:00   0.00% gvfs-gphoto2-volume
 1044 root          4  22    0    20M  7916K select   0:00   0.00% accounts-daemon
 1040 vermaden      4  20    0    19M  7460K select   0:00   0.00% gvfsd-metadata
 1017 root          4  20    0    19M  7452K select   0:00   0.00% upowerd
  988 vermaden      5  20    0    19M  7208K select   0:00   0.00% gvfs-mtp-volume-mon
  833 root          1  20    0    18M  7140K select   0:00   0.00% sendmail
 1066 vermaden      4  20    0    19M  7004K select   0:00   0.00% dconf-service
  969 vermaden      4  20    0    19M  6936K select   0:00   0.00% xfconfd
  998 vermaden      1  21    0    18M  6900K select   0:00   0.00% ssh-agent
  836 smmsp         1  52    0    18M  6576K pause    0:00   0.00% sendmail
  960 vermaden      1  20    0    14M  4580K select   0:01   0.00% dbus-daemon
 1003 vermaden      1  20    0    16M  4116K select   0:00   0.00% gpg-agent
  765 messagebus    1  20    0    14M  4100K select   0:00   0.00% dbus-daemon
  955 vermaden      1  23    0    15M  3912K select   0:00   0.00% dbus-launch
  967 vermaden      1  20    0    14M  3812K select   0:01   0.00% dbus-daemon
 1058 vermaden      1  20    0    14M  3772K nanslp   0:00   0.00% gstat
 1076 vermaden      1  20    0    14M  3464K RUN      0:00   0.00% top
 1057 vermaden      1  28    0    13M  3276K wait     0:00   0.00% sh
  866 vermaden      1  20    0    13M  3256K wait     0:00   0.00% sh
  941 vermaden      1  20    0    13M  3212K wait     0:00   0.00% sh
  854 root          1  20    0    13M  3136K wait     0:00   0.00% login
  944 vermaden      1  20    0    14M  3096K wait     0:00   0.00% xinit
  479 _dhcp         1  52    0    13M  2828K select   0:00   0.00% dhclient
  684 root          1  20    0    13M  2748K select   0:00   0.00% syslogd
  418 root          1   4    0    13M  2708K select   0:00   0.00% dhclient
  415 root          1  49    0    13M  2632K select   0:00   0.00% dhclient
  818 root          1  20    0    13M  2516K nanslp   0:00   0.00% cron
  770 root          1  20    0    13M  2404K select   0:00   0.00% moused
  855 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  858 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  861 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  859 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  860 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  856 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  857 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  480 root          1  20    0    11M  1540K select   0:00   0.00% devd

MATE

Next one is MATE and it used about 1361 MB of RAM.

This is first strange thing for me. Keep in mind that MATE is a fork of GNOME 2 which was expected to be heavy compared to light XFCE … at least more then a decade ago. Seems that now MATE developers are doing better job then XFCE devs πŸ™‚

Below you will find the top(1) output for MATE.

% top -b -o res 1000
last pid:   966;  load averages:  1.75,  1.02,  0.43; battery: 99%  up 0+00:01:53    00:40:42
66 processes:  2 running, 64 sleeping
CPU: 25.7% user,  0.0% nice,  8.9% system,  0.4% interrupt, 65.0% idle
Mem: 279M Active, 269M Inact, 381M Wired, 56K Buf, 6986M Free
ARC: 230M Total, 88M MFU, 131M MRU, 1753K Header, 8250K Other
     183M Compressed, 435M Uncompressed, 2.37:1 Ratio
Swap: 2048M Total, 2048M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  857 vermaden      3  23    0   344M   246M select   0:08   7.96% Xorg
  922 vermaden      4  20    0   311M   122M select   0:01   0.00% kgpg
  869 vermaden      5  20    0   172M    77M select   0:01   0.00% mate-session
  913 vermaden      6  20    0    92M    68M select   0:03   0.00% caja
  961 vermaden      5  29    0    91M    59M select   0:07  15.97% pluma
  951 vermaden      5  20    0    86M    55M select   0:01   0.00% mate-terminal
  919 vermaden      3  20    0   130M    52M select   0:00   0.00% kalendarac
  911 vermaden      5  20    0    74M    49M select   0:01   0.00% mate-panel
  941 vermaden      5  20    0    70M    45M select   0:00   0.00% notification-area-a
  902 vermaden      5  20    0    70M    44M select   0:01   0.00% marco
  917 vermaden      4  20    0    66M    43M select   0:00   0.00% mate-volume-control
  899 vermaden      6  20    0    60M    38M select   0:02   0.00% mate-settings-daemo
  939 vermaden      5  20    0    60M    38M select   0:00   0.00% clock-applet
  927 vermaden      5  20    0    57M    37M select   0:00   0.00% wnck-applet
  921 vermaden      5  20    0    55M    35M select   0:00   0.00% mate-power-manager
  915 vermaden      5  20    0    50M    32M select   0:00   0.00% mate-screensaver
  864 polkitd       7  20    0  2125M    27M select   0:00   0.00% polkitd
  914 vermaden      4  20    0    44M    26M select   0:00   0.00% polkit-mate-authent
  883 root          7  52    0    64M    16M select   0:00   0.00% bsdisks
  881 vermaden      5  20    0    27M    12M select   0:00   0.00% gvfs-udisks2-volume
  962 vermaden      5  20    0    24M    11M select   0:00   0.00% gvfsd-network
  965 vermaden      4  20    0    24M    10M select   0:00   0.00% gvfsd-dnssd
  954 vermaden      4  20    0    24M    10M select   0:00   0.00% gvfsd-computer
  929 vermaden      4  20    0    26M    10M select   0:00   0.00% gvfsd-trash
  852 vermaden      1  20    0    21M  9480K RUN      0:00   0.00% sshd
  931 vermaden      2  21    0    86M  9396K select   0:00   0.00% pulseaudio
  849 root          1  30    0    21M  9300K select   0:00   0.00% sshd
  879 vermaden      4  28    0    24M  9180K select   0:00   0.00% gvfsd
  901 vermaden      4  20    0    21M  8860K select   0:00   0.00% at-spi2-registryd
  895 vermaden      5  20    0    21M  8272K select   0:00   0.00% gvfs-gphoto2-volume
  862 root         16  20    0    24M  8244K select   0:00   0.00% console-kit-daemon
  799 root          1  23    0    21M  8208K select   0:00   0.00% sshd
  875 vermaden      5  20    0    21M  8128K select   0:00   0.00% at-spi-bus-launcher
  956 vermaden      4  20    0    19M  7704K select   0:00   0.00% gvfsd-metadata
  893 vermaden      5  20    0    19M  7544K select   0:00   0.00% gvfs-mtp-volume-mon
  924 root          4  20    0    19M  7524K select   0:00   0.00% upowerd
  817 root          1  20    0    18M  7140K select   0:00   0.00% sendmail
  897 vermaden      4  20    0    19M  6936K select   0:00   0.00% dconf-service
  820 smmsp         1  52    0    18M  6700K pause    0:00   0.00% sendmail
  912 vermaden      1  20    0    17M  4892K piperd   0:00   0.00% libgtop_server2
  873 vermaden      1  20    0    14M  4164K select   0:00   0.00% dbus-daemon
  860 vermaden      1  22    0    17M  4124K wait     0:00   0.00% ck-launch-session
  876 vermaden      1  20    0    14M  4004K select   0:01   0.00% dbus-daemon
  749 messagebus    1  20    0    14M  3984K select   0:00   0.00% dbus-daemon
  872 vermaden      1  20    0    15M  3912K select   0:00   0.00% dbus-launch
  953 vermaden      1  20    0    14M  3708K nanslp   0:00   0.00% gstat
  966 vermaden      1  20    0    14M  3392K RUN      0:00   0.00% top
  853 vermaden      1  20    0    13M  3248K wait     0:00   0.00% sh
  846 vermaden      1  21    0    13M  3212K wait     0:00   0.00% sh
  952 vermaden      1  38    0    13M  3208K wait     0:00   0.00% sh
  838 root          1  25    0    13M  3100K wait     0:00   0.00% login
  856 vermaden      1  20    0    14M  3096K wait     0:00   0.00% xinit
  463 _dhcp         1  52    0    13M  2828K select   0:00   0.00% dhclient
  668 root          1  20    0    13M  2748K select   0:00   0.00% syslogd
  402 root          1  52    0    13M  2708K select   0:00   0.00% dhclient
  399 root          1  52    0    13M  2632K select   0:00   0.00% dhclient
  802 root          1  20    0    13M  2516K nanslp   0:00   0.00% cron
  754 root          1  20    0    13M  2404K select   0:00   0.00% moused
  839 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  845 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  841 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  843 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  842 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  844 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  840 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  464 root          1  20    0    11M  1540K select   0:00   0.00% devd

KDE/Plasma

Next one is KDE/Plasma and without surprise (at least for me) it uses more RAM then other desktop environments – about 2843 MB of RAM – that is more then twice as much as MATE and almost twice as much as XFCE.

Below you will find the top(1) output for KDE/Plasma.

% top -b -o res 1000
last pid:  1075;  load averages:  2.10,  1.56,  0.79; battery: 99%  up 0+00:05:22    00:38:14
67 processes:  2 running, 65 sleeping
CPU: 30.8% user,  0.1% nice,  8.8% system,  0.2% interrupt, 60.0% idle
Mem: 530M Active, 316M Inact, 441M Wired, 56K Buf, 6633M Free
ARC: 272M Total, 119M MFU, 139M MRU, 2012K Header, 12M Other
     211M Compressed, 514M Uncompressed, 2.44:1 Ratio
Swap: 2048M Total, 2048M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  935 vermaden     12  21    0   588M   298M select   0:22   0.00% plasmashell
  874 vermaden      3  23    0   344M   241M select   0:15   9.96% Xorg
 1065 vermaden      7  30    0   365M   190M select   0:12  15.97% kate
  918 vermaden      5  31    0   376M   179M select   0:22  15.97% kwin_x11
 1035 vermaden      8  20    0   320M   156M select   0:03   0.00% dolphin
 1029 vermaden      3  20    0   312M   150M select   0:02   0.00% konsole
  959 vermaden      4  20    0   314M   143M select   0:01   0.00% kgpg
 1063 vermaden      5  52    0   304M   140M select   0:02   0.00% kioslave5
 1073 vermaden      4  20    0   303M   139M select   0:01   0.00% kioslave5
  916 vermaden     11  20    0   179M    84M select   0:02   0.00% kded5
  958 vermaden      3  20    0   147M    67M select   0:01   0.00% kalendarac
  944 vermaden      4  20    0   174M    63M select   0:01   0.00% DiscoverNotifier
  941 vermaden      6  20    0   130M    58M select   0:01   0.00% polkit-kde-authenti
  920 vermaden      4  20    0   131M    58M select   0:01   0.00% ksmserver
  940 vermaden      7  20    0   118M    56M select   0:01   0.00% org_kde_powerdevil
  942 vermaden      3  20    0   128M    56M select   0:01   0.00% kaccess
  922 vermaden      3  20    0   127M    55M select   0:01   0.00% kglobalaccel5
  968 vermaden      7  20    0   104M    47M select   0:01   0.00% kactivitymanagerd
  905 vermaden      3  20    0   127M    45M select   0:00   0.00% klauncher
  901 vermaden      3  26    0   113M    43M select   0:00   0.00% plasma_session
  904 vermaden      1  20    0   112M    41M select   0:00   0.00% kdeinit5
  885 vermaden      3  38    0   113M    41M select   0:00   0.00% startplasma-x11
 1041 vermaden      2  42    0    88M    37M select   0:00   0.00% kioslave5
 1069 vermaden      1  23    0   256G    37M select   0:00   0.00% kioslave5
 1039 vermaden      1  36    0   256G    37M select   0:00   0.00% kioslave5
 1027 vermaden      1  36    0   256G    36M select   0:00   0.00% kioslave5
  997 vermaden      3  28    0    86M    35M select   0:00   0.00% kioslave5
  943 vermaden      3  40   19   256G    32M select   0:00   0.00% baloo_file
  945 vermaden      4  20    0    87M    32M select   0:00   0.00% gmenudbusmenuproxy
  939 vermaden      3  20    0    83M    30M select   0:00   0.00% xembedsniproxy
  976 vermaden      3  20    0    76M    28M select   0:00   0.00% kscreen_backend_lau
  881 polkitd       7  20    0  2125M    27M select   0:00   0.00% polkitd
  926 root          7  20    0    67M    19M select   0:00   0.00% bsdisks
  966 vermaden      2  20    0    86M  9520K select   0:00   0.00% pulseaudio
  852 vermaden      1  20    0    21M  9512K RUN      0:00   0.00% sshd
  849 root          1  33    0    21M  9300K select   0:00   0.00% sshd
  879 root         16  20    0    24M  8320K select   0:00   0.00% console-kit-daemon
  799 root          1  22    0    21M  8208K select   0:00   0.00% sshd
  937 root          4  20    0    19M  7404K select   0:00   0.00% upowerd
  817 root          1  20    0    18M  7140K select   0:00   0.00% sendmail
  982 vermaden      4  20    0    19M  6732K select   0:00   0.00% dconf-service
  820 smmsp         1  52    0    18M  6704K pause    0:00   0.00% sendmail
  749 messagebus    1  20    0    14M  4452K select   0:00   0.00% dbus-daemon
  896 vermaden      1  28    0    15M  4252K select   0:00   0.00% dbus-launch
  897 vermaden      1  20    0    14M  4164K select   0:01   0.00% dbus-daemon
  877 vermaden      1  21    0    17M  4124K wait     0:00   0.00% ck-launch-session
 1034 vermaden      1  20    0    14M  3836K nanslp   0:00   0.00% gstat
 1075 vermaden      1  20    0    14M  3392K RUN      0:00   0.00% top
  853 vermaden      1  20    0    13M  3256K wait     0:00   0.00% sh
 1032 vermaden      1  26    0    13M  3232K wait     0:00   0.00% sh
  846 vermaden      1  20    0    13M  3212K wait     0:00   0.00% sh
  838 root          1  25    0    13M  3100K wait     0:00   0.00% login
  873 vermaden      1  20    0    14M  3096K wait     0:00   0.00% xinit
  463 _dhcp         1  52    0    13M  2828K select   0:00   0.00% dhclient
  668 root          1  20    0    13M  2748K select   0:00   0.00% syslogd
  402 root          1  52    0    13M  2708K select   0:00   0.00% dhclient
  399 root          1  52    0    13M  2632K select   0:00   0.00% dhclient
  802 root          1  20    0    13M  2516K nanslp   0:00   0.00% cron
  754 root          1  20    0    13M  2404K select   0:01   0.00% moused
  842 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  845 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  843 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  844 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  841 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  839 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  840 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  464 root          1  20    0    11M  1540K select   0:00   0.00% devd

Openbox

Not really a desktop environment but just for the sake of comparison I wanted to check it. With the default ‘ugly’ settings it consumed about 614 MB or RAM.

Below you will find the top(1) output for Openbox.

% top -b -o res 1000
last pid:   991;  load averages:  0.66,  0.77,  0.43; battery: 99%  up 0+00:04:35    00:52:31
43 processes:  1 running, 41 sleeping, 1 stopped
CPU:  8.8% user,  0.0% nice,  3.8% system,  0.5% interrupt, 86.9% idle
Mem: 126M Active, 196M Inact, 391M Wired, 40K Buf, 7210M Free
ARC: 210M Total, 78M MFU, 120M MRU, 1783K Header, 10M Other
     164M Compressed, 374M Uncompressed, 2.28:1 Ratio
Swap: 2048M Total, 2048M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  894 vermaden      3  20    0   307M   217M select   0:02   0.00% Xorg
  942 vermaden      6  20    0   208M   112M select   0:02   0.00% caja
  981 vermaden      3  20    0   100M    60M select   0:02   0.00% geany
  897 vermaden      1  20    0    54M    25M select   0:00   0.00% openbox
  898 vermaden      1  20    0    53M    25M select   0:01   0.00% tint2
  939 vermaden      1  20    0    25M    13M select   0:00   0.00% xterm
  916 vermaden      1  20    0    25M    13M select   0:00   0.00% xterm
  986 vermaden      1  20    0    21M  9500K select   0:00   0.00% sshd
  983 root          1  28    0    21M  9360K select   0:00   0.00% sshd
  953 vermaden      4  20    0    21M  9228K select   0:00   0.00% at-spi2-registryd
  949 vermaden      5  49    0    21M  8736K select   0:00   0.00% at-spi-bus-launcher
  934 vermaden      1  20    0    20M  8608K STOP     0:00   0.00% dzen2
  799 root          1  20    0    21M  8208K select   0:00   0.00% sshd
  817 root          1  20    0    18M  7140K select   0:00   0.00% sendmail
  955 vermaden      4  30    0    19M  6916K select   0:00   0.00% dconf-service
  820 smmsp         1  52    0    18M  6636K pause    0:00   0.00% sendmail
  946 vermaden      1  30    0    15M  4380K select   0:00   0.00% dbus-launch
  947 vermaden      1  43    0    14M  3908K select   0:00   0.00% dbus-daemon
  937 vermaden      1  20    0    14M  3760K nanslp   0:00   0.00% gstat
  950 vermaden      1  20    0    14M  3732K select   0:00   0.00% dbus-daemon
  749 messagebus    1  52    0    14M  3648K select   0:00   0.00% dbus-daemon
  991 vermaden      1  22    0    14M  3428K RUN      0:00   0.00% top
  987 vermaden      1  21    0    13M  3316K wait     0:00   0.00% sh
  918 vermaden      1  20    0    13M  3292K wait     0:00   0.00% sh
  941 vermaden      1  22    0    13M  3280K wait     0:00   0.00% sh
  982 vermaden      1  52    0    13M  3272K ttyin    0:00   0.00% sh
  846 vermaden      1  20    0    13M  3212K wait     0:00   0.00% sh
  838 root          1  26    0    13M  3100K wait     0:00   0.00% login
  893 vermaden      1  20    0    14M  3096K wait     0:00   0.00% xinit
  463 _dhcp         1  52    0    13M  2828K select   0:00   0.00% dhclient
  668 root          1  20    0    13M  2748K select   0:00   0.00% syslogd
  402 root          1   4    0    13M  2708K select   0:00   0.00% dhclient
  399 root          1  52    0    13M  2632K select   0:00   0.00% dhclient
  802 root          1  20    0    13M  2516K nanslp   0:00   0.00% cron
  754 root          1  20    0    13M  2404K select   0:00   0.00% moused
  843 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  842 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  845 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  844 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  840 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  839 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  841 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  464 root          1  20    0    11M  1540K select   0:00   0.00% devd


GNOME

GNOME with the same test procedure used 2622 MB of RAM.

Below you will find the top(1) output for GNOME.

% top -b -o res 1000
last pid:  1114;  load averages:  2.62,  1.76,  0.81; battery: 99%  up 0+00:03:38    12:44:58
91 processes:  2 running, 89 sleeping
CPU: 45.9% user,  0.0% nice,  9.1% system,  0.3% interrupt, 44.7% idle
Mem: 531M Active, 560M Inact, 2152K Laundry, 522M Wired, 56K Buf, 6295M Free
ARC: 319M Total, 151M MFU, 156M MRU, 2354K Header, 9740K Other
     266M Compressed, 640M Uncompressed, 2.41:1 Ratio
Swap: 2048M Total, 2048M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  904 vermaden      9  23    0  2656M   379M select   0:29   9.96% gnome-shell
  855 vermaden      3  22    0   333M   238M select   0:10   6.98% Xorg
 1040 vermaden     12  20    0   349M   192M select   0:10   0.00% epiphany-search-pro
  962 vermaden      4  20    0   312M   136M select   0:01   0.00% kgpg
 1026 vermaden      8  20    0   215M   125M select   0:01   0.00% gnome-calendar
 1107 vermaden      5  20    0   187M   108M select   0:01   0.00% gnome-control-cente
  958 vermaden      7  20    0   211M    81M select   0:01   0.00% evolution-alarm-not
 1058 vermaden     15  20    0   194M    78M select   0:01   0.00% WebKitNetworkProces
 1071 vermaden      6  20    0   144M    77M select   0:03   0.00% nautilus
 1112 vermaden      5  52    0    85M    59M select   0:13  19.97% gedit
 1065 vermaden      5  20    0   114M    56M select   0:01   0.00% gnome-terminal-serv
  961 vermaden      3  20    0   132M    53M select   0:00   0.00% kalendarac
  917 vermaden      5  20    0   146M    51M select   0:00   0.00% goa-daemon
 1034 vermaden      5  20    0    70M    50M select   0:00   0.00% seahorse
  921 vermaden      7  20    0   109M    48M select   0:00   0.00% evolution-addressbo
  919 vermaden     10  20    0    81M    44M select   0:00   0.00% evolution-calendar-
  912 vermaden      5  20    0    78M    42M select   0:00   0.00% evolution-source-re
  950 vermaden      6  20    0  2134M    39M select   0:00   0.00% gjs-console
  931 vermaden      6  20    0  2134M    39M select   0:00   0.00% gjs-console
  935 vermaden      5  20    0   119M    32M select   0:00   0.00% gsd-media-keys
  939 vermaden      5  20    0    51M    30M select   0:00   0.00% gsd-xsettings
  937 vermaden      5  20    0    49M    30M select   0:00   0.00% gsd-power
  957 vermaden      3  40   19   256G    28M select   0:00   0.00% baloo_file
  907 vermaden      7  20    0    83M    28M select   0:00   0.00% gnome-shell-calenda
  947 vermaden      5  20    0    46M    28M select   0:00   0.00% gsd-keyboard
  994 vermaden      4  20    0    46M    28M select   0:00   0.00% ibus-extension-gtk3
  993 vermaden      4  20    0    46M    27M select   0:00   0.00% ibus-ui-gtk3
  893 polkitd       7  20    0  2125M    27M select   0:00   0.00% polkitd
  965 vermaden      5  20    0    48M    27M select   0:00   0.00% zeitgeist-datahub
  952 vermaden      4  24    0    49M    26M select   0:00   0.00% gsd-printer
  859 vermaden      5  20    0    49M    20M select   0:00   0.00% gnome-session-binar
  874 root          7  20    0    67M    16M select   0:00   0.00% bsdisks
  956 vermaden      4  20    0    27M    14M select   0:00   0.00% ibus-daemon
  942 vermaden      5  20    0    27M    13M select   0:00   0.00% gsd-datetime
  945 vermaden      5  20    0    26M    13M select   0:00   0.00% gsd-sound
  943 vermaden      6  20    0    25M    12M select   0:00   0.00% gsd-smartcard
  940 vermaden      4  20    0    27M    11M select   0:00   0.00% gsd-print-notificat
 1092 vermaden      4  20    0    24M    11M select   0:00   0.00% gvfsd-dnssd
 1082 vermaden      5  20    0    24M    11M select   0:00   0.00% gvfsd-network
  872 vermaden      5  20    0    27M    11M select   0:00   0.00% gvfs-udisks2-volume
 1041 vermaden      4  20    0    24M    11M select   0:00   0.00% gvfsd-trash
 1062 vermaden      4  20    0    24M    11M select   0:00   0.00% gvfsd-burn
  976 vermaden      4  20    0    25M    10M select   0:00   0.00% zeitgeist-daemon
  902 vermaden      5  20    0    23M    10M select   0:00   0.00% gnome-keyring-daemo
  894 vermaden      1  20    0    21M  9488K RUN      0:00   0.00% sshd
  944 vermaden      5  20    0    21M  9356K select   0:00   0.00% gsd-housekeeping
  887 root          1  24    0    21M  9332K select   0:00   0.00% sshd
  933 vermaden      4  20    0    21M  9252K select   0:00   0.00% at-spi2-registryd
  925 vermaden      2  21    0    86M  9216K select   0:00   0.00% pulseaudio
  870 vermaden      4  20    0    24M  8860K select   0:00   0.00% gvfsd
  934 vermaden      5  20    0    20M  8616K select   0:00   0.00% gsd-usb-protection
  891 root         16  20    0    24M  8488K select   0:00   0.00% console-kit-daemon
  811 root          1  20    0    21M  8208K select   0:00   0.00% sshd
  867 vermaden      5  20    0    21M  8128K select   0:00   0.00% at-spi-bus-launcher
  927 root          4  20    0    20M  8040K select   0:00   0.00% accounts-daemon
  941 vermaden      5  20    0    20M  7976K select   0:00   0.00% gsd-sharing
  886 vermaden      5  20    0    21M  7936K select   0:00   0.00% gvfs-gphoto2-volume
  936 vermaden      5  20    0    20M  7936K select   0:00   0.00% gsd-a11y-settings
  923 vermaden      4  20    0    19M  7716K select   0:00   0.00% gvfsd-metadata
  910 root          4  20    0    19M  7620K select   0:00   0.00% upowerd
  881 vermaden      5  20    0    19M  7220K select   0:00   0.00% gvfs-mtp-volume-mon
  938 vermaden      4  20    0    19M  7180K select   0:00   0.00% gsd-screensaver-pro
  825 root          1  20    0    18M  7140K select   0:00   0.00% sendmail
  914 vermaden      4  20    0    19M  7128K select   0:00   0.00% dconf-service
  828 smmsp         1  52    0    18M  6704K pause    0:00   0.00% sendmail
  864 vermaden      1  20    0    14M  5268K select   0:01   0.00% dbus-daemon
  753 messagebus    1  20    0    14M  4280K select   0:00   0.00% dbus-daemon
  863 vermaden      1  21    0    15M  3912K select   0:00   0.00% dbus-launch
  868 vermaden      1  20    0    14M  3812K select   0:00   0.00% dbus-daemon
 1067 vermaden      1  20    0    14M  3704K nanslp   0:00   0.00% gstat
 1114 vermaden      1  20    0    14M  3420K RUN      0:00   0.00% top
  895 vermaden      1  20    0    13M  3252K wait     0:00   0.00% sh
  851 vermaden      1  22    0    13M  3212K wait     0:00   0.00% sh
 1066 vermaden      1  26    0    13M  3208K wait     0:00   0.00% sh
  843 root          1  23    0    13M  3100K wait     0:00   0.00% login
  854 vermaden      1  20    0    14M  3096K wait     0:00   0.00% xinit
  858 vermaden      1  21    0    13M  3016K wait     0:00   0.00% sh
  467 _dhcp         1  52    0    13M  2828K select   0:00   0.00% dhclient
  672 root          1  20    0    13M  2748K select   0:00   0.00% syslogd
  406 root          1   4    0    13M  2708K select   0:00   0.00% dhclient
  403 root          1  44    0    13M  2632K select   0:00   0.00% dhclient
  814 root          1  26    0    13M  2516K nanslp   0:00   0.00% cron
  757 root          1  20    0    13M  2404K select   0:00   0.00% moused
  850 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  847 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  848 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  844 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  849 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  845 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  846 root          1  52    0    13M  2248K ttyin    0:00   0.00% getty
  468 root          1  20    0    11M  1540K select   0:00   0.00% devd

Summary of the RAM usage results are below.

  MB  ENVIRONMENT
----  --------------------
  97  FreeBSD Text Console
 614  Openbox
1361  MATE
1548  XFCE
2622  GNOME
2843  KDE/Plasma

Seems that now MATE developers are doing better job then XFCE devs πŸ™‚

CPU Time Usage Results

As I already had the top(1) outputs I also compared the CPU time used for that limited test. I will not post the top(1) results again as they are posted above. The Seconds column below is the sum of the TIME field from the top(1) command output.
Here are the results of used CPU time.

SECONDS  ENVIRONMENT
-------  --------------------
      0  FreeBSD Text Console
      7  Openbox
     26  MATE
     42  XFCE
     72  GNOME
     92  KDE/Plasma

Seems that MATE is twice as light on resources then XFCE. World has changed a lot since GNOME 2 was considered heavy fully fledged desktop environment while XFCE was light and fast … but even that ‘hungry’ XFCE takes only half of the time that KDE/Plasma uses for the same tasks.

Subjective Experience

The Openbox ‘environment’ started fastest and was most responsive to operate.

Both MATE and XFCE started little slower but after they loaded the desktop and taskbars they were snappy and fast to use.

On the other hand the KDE/Plasma took longest to load and each application I started – I needed to wait ‘a little’ with ‘bouncing mouse cursor’ for them to load. Also scrolling the /etc/ssh/moduli file to its end in Kate took REALLY long … even with Logitech M720 mouse which scroll wheel was spinning freely (without clicks). I want to mention that I am not disappointed by KDE/Plasma. Its just slower when used in a limiter 1 CPU and 8 GB RAM environment. Probably the load times and usability is a lot better on a 4 CORE system with 16 GB of RAM on fast NVMe SSD disk while we used rather slow virtual machine.

After adding GNOME to comparison it felt even slower then KDE/Plasma. Probably because GNOME requires hardware 3D acceleration for smooth operation. With its software rendering it felt really sluggish … while consuming less RAM and CPU time then KDE/Plasma.

Summary

Not sure how useful that is but I just was curious and wanted to check it out – and as I did I share what I found.

UPDATE 1 – Added freecolor(1) and htop(1) RAM Measurements

After suggestions from other places I added freecolor(1) and htop(1) measurements when it comes to RAM usage. Here are the results.

  SYS/WM/DE | top(1)  | htop(1) | conky(1) | freecolor(1)
------------+---------+---------+----------+-------------
    FreeBSD |   97 MB |  112 MB |    - -   |  157 MB 
    Openbox |  614 MB |  237 MB |  460 MB  |  382 MB 
       MATE | 1361 MB |  508 MB |  778 MB  |  788 MB 
       XFCE | 1548 MB |  533 MB |  794 MB  |  829 MB 
helloSystem | 1613 MB |  585 MB |  804 MB  |  830 MB 
      GNOME | 2622 MB |  625 MB |  990 MB  | 1000 MB 
 KDE/Plasma | 2843 MB |  730 MB | 1659 MB  | 1167 MB

I also added helloSystem out of curiosity.

Hope that helps.

EOF