Slackware 14.2, take two

02 February 2017
Last year I wrote about trying out Slackware on my laptop as a serious replacement as my main desktop Linux distribution. Since then I have indeed rebuilt my desktop computer using Slackware, opting to install the 64-bit version of Slackware with everything except the KDE packages, and below is a somewhat terse version of the setup & configuration procedure. It is also an erratum as it mainly details that were previously unclear and/or absent.

Partition alignment

A minor point, but an important one as I suspect incorrect partition alignment might have been partly responsible for the first solid-state drive I had failing. Slackware 24.2 comes with fdisk v2.27.1, so all you need to do is start fdisk using the -c -u parameters. See previous article for details and rationale of getting partition alignment correct.

GUI login setup

Even though this was my second time round, getting the GUI login working properly still turned out to be a lot trickier than it should have been. I opted for IceWM as my window manager the setup & rationale of which I wrote about previously, which in itself didn't have any issues. There are two choices as far as I am concerned for the display manager: SDDM, and XDM.

SDDM desktop manager setup

Although AlienBob does have a pre-built packages of SDDM and its dependencies libxkbcommon & Qt5, the only way I was able to get a working SDDM was to build them all myself via SlackBuilds as I had described previously. Yes the 3-4 hours that Qt5 takes to build is annoying, but from limited trial-and-error it is issues in Qt5 that were leading to a broken SDDM. Once all these packages built and installed, all that is left to do is some post-install configuration:

usermod -a -G video sddm mkdir /var/log/sddm chown sddm /var/log/sddm usermod -d /var/log/sddm sddm

Setting up SDDM to run icewn-session directly as suggested in my previous SDDM article has issues with media insertion & removal. Instead it needs to be launched through the dbus-launch wrapper, using the configuration file & script given in my IceWM article. Also, adding oneself to the audio, video, plugdev, & cdrom user groups will avoid problems later on.

XDM desktop manager setup

For people who have exclusive use of a system they tend to leave logged in, the somewhat-basic XDM that is Slackware's default on a non-KDE install may actually be “good enough” and has the advantage of being pretty lean. Upon login XDM calls /etc/X11/xinit/xinitrc which is symlinked to a shell script within the same directory, and the following will be suitable for setting IceWM as the global default window manager (for those who don't want to resort to ~/.xinitrc):

#!/bin/sh userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap sysresources=/etc/X11/xinit/.Xresources sysmodmap=/etc/X11/xinit/.Xmodmap # merge in defaults and keymaps if [ -f $sysresources ]; then /usr/bin/xrdb -merge $sysresources fi if [ -f $sysmodmap ]; then /usr/bin/xmodmap $sysmodmap fi if [ -f $userresources ]; then /usr/bin/xrdb -merge $userresources fi if [ -f $usermodmap ]; then /usr/bin/xmodmap $usermodmap fi exec dbus-launch --exit-with-session /usr/local/bin/icewm-session

Further details of XDM are on the XDM manpage.

XDM restart & shutdown buttons

One way the XDM is that bit too minimalist is the lack of restart & shutdown buttons, but I managed to find a page that describes how to customise the login screen. In short, as well as the username/password dialog, other X11 programs can be started and placed onto the XDM login screen. If you just want some basic restart/shutdown buttons in the bottom-left corner, do the following:

Copy /etc/X11/xdm/Xsetup_0 to /etc/X11/xdm/Xsetup_my and add the following to the end:

( xmessage -buttons Shutdown:20,Reboot:21 "" ; case $? in 20) exec /sbin/poweroff;; 21) exec /sbin/reboot;; esac )&

Copy /etc/X11/xdm/Xresources to /etc/X11/xdm/Xresources_my and add the following to the end:

Xmessage*geometry: 180x30+0-0 Xmessage*background: white Xmessage*foreground: black Xmessage*borderWidth: 0 Xmessage*message.scrollVertical: Never Xmessage*message.scrollHorizontal: Never Xmessage*Text*background: white Xmessage*Text*foreground: darkgrey Xmessage*Text.borderColor: white Xmessage*Text.borderWidth: 0

Create /etc/X11/xdm/GiveConsole_my with the following content:

killall xmessage chown $USER /dev/console

And finally make the following changes (highlighted in bold) to /etc/X11/xdm/xdm-config

DisplayManager*resources: /usr/lib64/X11/xdm/Xresources_my DisplayManager.willing: su nobody -s /bin/sh -c /usr/lib64/X11/xdm/Xwilling ! The following three resources set up display :0 as the console. DisplayManager._0.setup: /usr/lib64/X11/xdm/Xsetup_my DisplayManager._0.startup: /usr/lib64/X11/xdm/GiveConsole_my

Although Slackware uses /usr/lib64/X11/xdm/ this is a symlink to /etc/X11/xdm/. See the guide mentioned previously for details, as the above was based on content from this guide.

Miscellaneous configuration

These are other various bits of setup I did, many of which I either did not cover in my previous guides, or had details that were unclear or incorrect. Note that the order presented here is not necessary the order in which I did things.

Sudo

Coming from Ubuntu which has done away completely with logging in as root in favour of using sudo, needing to switch to root using su - and entering a root password seemed a little uncomfortable. Slackware comes with sudo but since Slackware does not consider creating a non-root user an installation task it needs to be setup separately. In /etc/sudoers around line 82 uncomment the directive to enable sudo for those in the wheel group, as shown below:

## Uncomment to allow members of group wheel to execute any command %wheel ALL=(ALL) ALL

..and then add the relevant non-root user(s) to the wheel group using:

usermod -a -G wheel remy

Locale

My laptop has a US keyboard so I kept it on the default US locale, which had the nasty side-effect of the ghastly US month-day-year date format, but that compromise I was able to avoid with my desktop system. I simply
set the system-wide locale to UK by editing /etc/profile.d/lang.sh as shown below:

# en_US is the Slackware default locale: export LANG=en_GB

Swappiness

Swappiness is how aggressive the Linux kernel is in paging from physical memory to the swap partition, and the value seems to be a target percentage of free memory. I opted for a value of 25, which means swapping starts when I'm down to a still-comfortable 2GB out of 8GB, and will likely only be reached when I'm firing up VMs.

Multilib

Followed the official documentation which amounted to running the following. Probably want to do this earlier rather than later, as it is one thing that has an outside change of screwing up.

lftp -c "open http://bear.alienbase.nl/mirrors/people/alien/multilib/ ; mirror -c -e 14.2" cd 14.2 upgradepkg --reinstall --install-new 14.2/*.t?z upgradepkg --install-new 14.2/slackware64-compat32/*-compat32/*.t?z

It is advisable to reboot the system after doing this.

Hibernation support

Hibernation is not really a feature intended for desktop systems, but potentially useful for those who leave systems logged in because they don't want to close & re-open loads of programs. To enable hibernation, add the following to lilo.conf and re-run LiLo:

append="resume=/dev/sda2"

Where /dev/sda2 is your swap partition. See my previous guide regarding how IceWM can active hibernation.

Windows fonts

If you have access to a Windows system, copying across fonts from it will likely give better results than getting one of the free font packs. In my case I had several custom fonts.

<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <dir>/usr/share/fonts/windows</dir> </fontconfig>

This can either go into /etc/fonts/local.conf or in a standalone file under /etc/fonts/conf.d/. You'll probably need to run fc-cache afterwards.

Time synchronisation

To find out whether your system clobk is running fast or slow, and if so by how much, you can use the ntpdate with the -d or -q flags:

/usr/sbin/ntpdate -d uk.pool.ntp.org ... server 193.1.31.66, port 123 stratum 1, precision -19, leap 00, trust 000 refid [PPS], delay 0.03462, dispersion 0.00014 transmitted 4, in filter 4 reference time: dc3267bc.105270b8 Tue, Jan 24 2017 23:54:36.063 originate timestamp: dc3267ca.b1147745 Tue, Jan 24 2017 23:54:50.691 transmit timestamp: dc3269bb.2c26a9d6 Wed, Jan 25 2017 0:03:07.172 filter delay: 0.03462 0.03517 0.03676 0.03560 0.00000 0.00000 0.00000 0.00000 filter offset: -496.485 -496.485 -496.485 -496.485 0.000000 0.000000 0.000000 0.000000 delay 0.03462, dispersion 0.00014 offset -496.485890

This can be run as non-root. To set the clock run the command as root with just an NTIP server address. Keep in mind that a big time correction like this, particularly if it crosses midnight, might cause a few things to trip up.

Firewall

I typically don't run background services and am normally behind NAT routers so a firewall is typically not of much use to me, but there are times when one might want to lock down that bit tighter than usual. The following disallows incoming TCP connection attempts and disables forwarding, which is useful when connecting to public Wifi hot-spots. Although Slackware doesn't include a stock rc.firewall it will execute it is one is put in place.
/etc/rc.d/rc.firewall
#!/bin/sh # # /etc/rc.d/rc.firewall # case "$1" in 'start') iptables -t filter -P INPUT ACCEPT iptables -t filter -A INPUT -i lo -j ACCEPT iptables -t filter -A INPUT -p tcp --syn -j REJECT iptables -t filter -P OUTPUT ACCEPT iptables -t filter -P FORWARD DROP ;; 'stop') iptables -t filter -P INPUT ACCEPT iptables -t filter -P OUTPUT ACCEPT iptables -t filter -P FORWARD ACCEPT iptables -t filter -F INPUT iptables -t filter -F OUTPUT iptables -t filter -F FORWARD ;; *) echo "Usage: $0 {start|stop}" ;; esac

Keeping up to date

Although there are some things I like about slapt-get, I have come to the conclusion that slackpkg (with the slackpkg+ extension) is a much better tool for keeping Slackware up to date. Main plus points is that it tells you which repository a given package update is from, and it can be setup to automatically blacklist any package for which a SlackBuild has been installed. The slackpkg configuration files with (most) comments stripped are shown below (see previous article for details on slapt-get).
/etc/slackpkg/mirrors
http://ftp.mirrorservice.org/sites/ftp.slackware.com/pub/slackware/slackware64-14.2/
/etc/slackpkg/slackpkgplus.conf
SLACKPKGPLUS=on VERBOSE=1 ALLOW32BIT=off USEBL=1 WGETOPTS="--timeout=20 --tries=2" SEARCH_CLOG_INPARENT=on CACHEUPDATE=off GREYLIST=on SENSITIVE_SEARCH=on WW_FILE_SEARCH=on SHOWORDER=package DETAILED_INFO=basic STRICTGPG=on PKGS_PRIORITY=( sbo multilib restricted:vlc alienbob ) TAG_PRIORITY=off REPOPLUS=( slackpkgplus ) MIRRORPLUS['sbo']=file://usr/local/src/SBo MIRRORPLUS['multilib']=http://slackware.uk/people/alien/multilib/14.2/ MIRRORPLUS['alienbob']=http://slackware.uk/people/alien/sbrepos/14.2/x86_64/ MIRRORPLUS['restricted']=http://slackware.uk/people/alien/restricted_slackbuilds/ MIRRORPLUS['slackpkgplus']=http://slakfinder.org/slackpkg+/
/etc/slackpkg/blacklist
# This one will blacklist all SBo packages: [0-9]+_SBo
Using slackgpg upgrade-all will bring up an ncurses interface that allows package updates to be individually selected.

Software

There are two main places to get software that is not part of the main Slackware distribution: AlienBob's repositories and SlackBuilds. Both have their respective package managers, as the AlienBob repositories can be added to via slackpkg/slapt-get, and SlackBuilds can be automated using sbopkg. Which software source is more up to date varies between packages, but on the whole my preference has been to use SlackBuilds, and only resort to AlienBob for packages that are a pain to compile.

Alienbob-sourced software

Chromium
The upstream open-source version of Google Chrome. Sorting out required Google API keys is a headache.
LibreOffice
Office-like suite, a fork of OpenOffice. Building this is time-consuming rather than difficult.
VLC (from AlienBob's restricted repository)
Video player. This version includes support for playing encrypted DVDs. Lots of dependencies and sub-dependencies, some of which are cyclic.
Wine
Runs Windows software. Bit unusual in that it needs a multilib system and has to be built 32-bit.

SlackBuild-sourced software

DJview4
DjVu (book format) viewer.
Inkscape
Vector graphics package. Not quite as good as TpX for technical drawings, but TpX is Windows-only.
Lyx
Latex frontend. Used it for my Ph.D dissertation, and occasionally use it when I want to write something up in a format other than HTML.
PuTTY
SSH client. Use the Windows version a lot, and it has a few features that OpenSSH's client doesn't.
SCiTE
Text editor. Use it for non-programming editing.
Terminator
Alternative to Xterm that has features such as tiling and tabs. Requires psutil.
Virtualbox
Virtual machine software. In the past had an undeclared dependency on acpica.
virtualbox-kernel
Virtualbox requires this. A new one comes out with every Slackware kernel release, so it is easy to keep updaed.
Viewnior
Best non-Gnome equivilent of the EyeOfGnome image viewer I could find. Requires gnome-common.

Virtualbox notes

Virtualbox is partly why I threw out most of my old PCs in 2012. Before then the monumental pain of dual-booting after the advent of always-on internet connections and versions of Windows that could actually go a whole 24 hours without crashing was why I kept a small LAN going just for myself. These days I just fire up a VM instead and a load of logistics has disappeared. Unfortunately VirtualBox on Slackware is not quite seamless.

The main problem is that VirtualBox's kernel modules are not auto-loaded, and error messages that try to be helpful give instructions that are wrong for Slackware. Easiest thing I've found is to use a script such as the following that looks for VirtualBox kernel modules and individually loads them all:

for mod in `find /lib/modules/\`uname -r\`/ -iname vbox\*`; do modprobe `basename $mod | awk -F. '{print $1}'` done