Kurbis

Tech blog

Boot with UUID device

March 06, 2024

In virtualization or when installing Slackware on a device for which you don't know the root device (i.e., /dev/sda, /dev/hda) beforehand, it is safer to use disk UUIDs to refer to disks and partitions.

Determining a disk's UUID requires the disk to be available as a block device (i.e., for a disk image it is first necessary to create a block device from it). For example, the following command outputs the UUID of the block device "/dev/sda1" or, in other words, the first partition of disk "/dev/sda"

$ blkid /dev/sda1

Afterwards, it is necessary to update the bootloader configuration. This depends of course on the bootloader you are using and there are tons of tutorials available out there, for example, Extlinux with UUID device and Lilo with UUID device.

Finally, and most important, the standard Slackware installation, which uses the version huge of the kernel and no initrd, is not capable of booting from a root device through its UUID. Instead, it is necessary to create an initrd and, while you are it, might as well switch to the generic kernel. With the generic kernel and the initrd, your system should be able to boot from a root device using the device's UUID. I don't know if the generic kernel is strictly necessary, I haven't tried with the huge kernel and the initrd, maybe it works too.

Tags: slackware

Enable sudo

February 09, 2014

This post explains how to configure sudo under Slackware.

First, make sure you have sudo installed, given that it is not part of the base installation.

$ slackpkg install sudo

Afterwards, it is necessary to edit the file "/etc/sudoers" and enable one of the sudo mechanisms. Below, I have listed all of the possible mechanisms. They are pretty much self-explanatory.

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

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL 

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

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw' 

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

From the sudo mechanisms above, uncomment whichever works best for you. In my opinion, the following sudo mechanism seems to provide a good compromise between usability and security, and after uncommenting it look as follows.

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

At this point, the next configuration steps depend on which sudo mechanism you have enabled in the previous step. If you have enable the sudo mechanism for the wheel group, then you need to add the users you want to give sudo power to the group wheel, if they are not already part of this group. If you enabled the sudo mechanism for the sudo group, then you have to add those users to the sudo group.

In any case, in order to add a user to a group, simply run the following command, where "" is the login name of the user you want to give sudo power.

$ gpasswd -a <user> wheel

It might be the case that the user you are giving sudo power is in fact yourself, or that the users you are giving sudo power are already logged in. Given that the group definitions are only updated when you login, all group updates will require those users to logout and login again.

For example, if user "john" was not part of the group "wheel", and you added "john" to this group, and he was already logged in, then "john" will have to logout and login again in order for the changes to the groups to take effect.

Sources: Adding users to sudoers file

Tags: slackware

In Slackware, there are different network management programs, including, the Slackware scripts, wicd, and NetworkManager. If using Slackware in a personal desktop or laptop, NetworkManager is a good choice, even if you are not using KDE as a desktop environment or window manager.

Given that NetworkManager is a service, the program runs as a daemon. As a result, you might want to run the client application as well, which is "nm-applet". This applet will create an application in your desktop environment tray, which you can use to control which networks to connect to and also manage network connections in general, including VPN.

Unfortunately, I haven't found a simple way from within the applet to create system-wide connections, that is connections that are available to all users, while asking NetworkManager to save the network key, such as, a WEP or WPA-PSK key. The only way I have found is to execute the "nm-connection-editor" with "root" permissions, as follows

$ sudo nm-connection-editor

By executing the connection editor with "root" permissions, the NetworkManager applet is able to write to the NetworkManager configuration directory, namely, "/etc/NetworkManager", and in particular to the system connections directory, namely, "/etc/NetworkManager/system-connections".

An alternative to executing the connection editor with "root" permissions, is to simply edit manually the files contained in this directory, and in particular the section containing security information. For example, for a standard wireless network, the section might look like the following.

[802-11-wireless-security]
key-mgmt=<Your key management system, such as, WEP, WPA, etc>
psk=<Your private key unencrypted>

Tags: slackware

cmus

November 20, 2013

If you want a music player that runs on the terminal, cmus is the way to go. Make sure you configure cmus to use software volume. You can configure software volume either through the configuration file or inside cmus. Inside cmus, press key 7 to go the configurations page and look for the configuration variable softvol. Make sure to set it to true to enable software volume.

Another way to achieve the same effect is to execute a command inside cmus. Execute the following command to enable software volume.

:set softvol=true

Tags: slackware

In Slackware, to get links that come in Thunderbird emails to open with Google Chrome instead of Firefox, just edit the mime types RDF schema.

.thunderbird/<profile_name>/mimeTypes.rdf

And, in the item containing the HTTP protocol handler, replace Firefox with Google Chrome.

<RDF:Description RDF:about="urn:scheme:externalApplication:http"
                 NC:prettyName="firefox"
                 NC:path="/usr/bin/firefox" /> 

For example,

<RDF:Description RDF:about="urn:scheme:externalApplication:http"
                 NC:prettyName="google-chrome"
                 NC:path="/opt/google/chrome/google-chrome" />

The above configuration opens HTTP links with Google Chrome. You might want also to open HTTPS links with Google Chrome. In order to do this, add a tag similar to the previous one but replacing "http" with "https". You can add this tag below the previous one.

<RDF:Description RDF:about="urn:scheme:externalApplication:https"
                 NC:prettyName="google-chrome"
                 NC:path="/opt/google/chrome/google-chrome" />

You would expect Thunderbird to work with the Freedesktop.org utils, such as, xdg-open. However, I have never managed to get this working.

This post is an adaptation from the post on Making Thunderbird Open Links in Chromium.

Tags: slackware

I've had a long standing problem with the keyboard being disabled at boot time. It is important to point out the exact time at which the keyboard is disabled or, better yet, not enabled by the kernel.

So, in the boot loader, the keyboard works fine! However, when loading the kernel and drivers for all sorts of devices, the keyboard sometimes would not get enabled. I know this is not a hardware fault for two reasons: first, I have dual boot and the problem never happened in Windows, ever, whereas in Linux it was happening more than 50% of the times I booted; finally, the keyboard always worked fine in the bootloader.

After having installed the new version of the official NVIDIA drivers (version 310.44), I noticed some error messages in the system log. The NVIDIA driver was complaining about the "vesa" driver, as explained in the post NVIDIA driver. It seems that by fixing the problem, as explained in that post, the keyboard problem has also gone away.

Tags: slackware

SSH agent

April 25, 2013

Working with Git and pushing onto online repositories such as Github? Entering the password each time you push is painful. Instead, use the SSH agent to remember the key, for the period of a session.

$ ssh-agent urxvt &

A new terminal window will appear. You can close the old terminal window, if you want. In the new terminal window, do the following

$ ssh-add
Enter passphrase for ...
Identity added: ...

Done! The new terminal will preserve your key until you close it.

Tags: slackware

XMMS configuration

April 23, 2013

To get the sound to work properly in XMMS, we need to modify the application's preferences. You can do this by pressing Ctrl-P or by right-clicking the main window and going to Options > Preferences.

Once in the preferences menu, change the output plugin to ALSA. Then, click the Configure button in the output plugin and enable the option Use software volume control.

Tags: slackware

LILO resolution

April 19, 2013

In LILO's configuration file /etc/lilo.conf, you can configure the resolution for the VESA framebuffer that is used when Linux boots up. Resolutions are given as a predefined numerical code, instead of specifying the resolution directly. In order to find the code for the resolution you want, you can look at the LILO's configuration file for some examples.

However, this file contains only low resolutions, not fit for most modern laptops. But, you can take another approach to find your numerical code. You can ask LILO to display the available numerical codes for your machine by including the following line in LILO's configuration file:

vga = ask

Save LILO's configuration file and don't forget to run LILO:

$ lilo

Now, reboot your machine. At boot, LILO will display a table associating numerical codes with their corresponding resolutions. Remember the numerical code you choose because we will need to add it to LILO's configuration file later. For example, in my case, I use 1280x800x32k which has the numerical code 361. Therefore, I must change the previous vga option to 0x361, like so

vga = 0x361

because numerical codes, as displayed at boot time, are in hexadecimal base.

Tags: slackware

Touchpad

April 17, 2013

We are going to follow an approach similar to that in Keyboard layout.

Copy the file /usr/share/X11/xorg.conf.d/50-synaptics.conf to /etc/X11/xorg.conf.d/

In the copied file, modify the following line

Option "TapButton3" "3"

to

Option "TapButton3" "0"

Tags: slackware

GTK theme

April 15, 2013

Does thunderbird look weird and depressing? Install gtk-chtheme from slackbuilds.org, run gtk-chtheme, and pick a nice theme, for example, oxygen-gtk.

Tags: slackware

In Slackware, I have always had to manually fix the clear screen function associated with Ctrl-L for Rxvt unicode (urxvt). In version 9.16 of urxvt (and previous), fixing this problem required only editing /etc/termcap and adding the string rxvt-unicode to the term capabilities.

However, with the new version of urxvt, the string that has to be added to the term capabilities is different. To find out the correct string, start urxvt and type

$ export

See what the value of the TERM variable is. In my urxvt, the value is rxvt-unicode-256color. Now, edit the file /etc/termcap, find the line with

vs|xterm|xterm-color|...

and add the new value to the list. For example, in my case, I change the previous line to the following

vs|xterm|rxvt-unicode-256color|xterm-color|...

Tags: slackware

Keyboard layout

April 14, 2013

In Slackware, one way to get the keyboard layout of your choice is by dropping a configuration file in "xorg.conf.d", which is the "new" directory for X.Org configuration files, as opposed to the old method of editing the "xorg.conf" directly.

Copy the file /usr/share/X11/xorg.conf.d/90-keyboard-layout.conf to /etc/X11/xorg.conf.d/.

Now, edit the file you have just copied and change the value of the XkbLayout option to the layout you want. For example, for Portuguese layout you have the following line:

Option "XkbLayout" "pt"

Other files from /usr/share/X11/xorg.conf.d/ can be copied to xorg.conf.d and modified to customize other devices.

Tags: slackware

If you are not using RAID, then you can disable RAID autodetection at boot time. Simply pass these parameters into the kernel at boot time:

raid=noautodetect

With LILO, this can be achieved by adding the "append" option in the Linux partition sections, for example:

# Linux bootable partition config begins
image = /boot/vmlinuz-huge-smp-3.2.13-smp
  root = /dev/sda3
  label = Slackware
  append = "raid=noautodetect"
  read-only
# Linux bootable partition config ends 

If you want to set the "append" option for all partition sections, then set this option globally, at the beginning of the file.

Tags: slackware

NVIDIA driver

June 13, 2012

NVIDIA driver needs nomodeset kernel parameter in order to work. Simply add this value to the append option in LILO's configuration file (/etc/lilo.conf)

append = "nomodeset"

and run LILO

$ lilo

If your dmesg contains the following message from the NVIDIA driver:

NVRM: Your system is not currently configured to drive a VGA console
NVRM: on the primary VGA device. The NVIDIA Linux graphics driver
NVRM: requires the use of a text-mode VGA console. Use of other console
NVRM: drivers including, but not limited to, vesafb, may result in
NVRM: corruption and stability problems, and is not supported.

then change LILO's configuration file by setting the vga option to normal.

vga = normal

and run LILO

$ lilo

If that is not enough, edit LILO's configuration file once again and add the following option to the kernel parameters:

video=vesa:off

and run LILO again.

Tags: slackware

proftpd with root login

June 12, 2012

It should never be required to have root login from FTP. Anyway, if you really need it, here is how to do it using proftpd in Slackware.

First, it is necessary to start proftpd. To do this, uncomment the corresponding ftp line in /etc/inetd.conf. Then, it is necessary to tell proftpd to allow root login. This is done in two steps. First, edit /etc/proftpd.conf and add, in the middle of the file, but outside any sections, the following line:

RootLogin on

Secondly, edit /etc/ftpusers and comment the user root. Finally, restart inetd and everything should be working correctly.

In order to test this, you can use ftp:

$ ftp localhost
> root
> <pass>

If everything goes smoothly, then root login is working. At any point in time, you can check /var/log/proftpd.log too see if there are any error messages.

Tags: slackware

In Slackware, to successfully mount USB sticks automatically, for example, through dolphin, you must be in group plugdev.

It might also be necessary to reload messagebus:

$ /etc/rc.d/rc.messagebus reload

Tags: slackware

Nice terminal

May 12, 2012

We are going to install Rxvt unicode (urxvt) from Slackbuilds.org, fix some things, and make it look nice!

If you want, you can edit the Slackbuild file (rxvt-unicode.Slackbuild) and disable the compilation of the embedded Perl interpreter. However, the Perl interpreter provides some interesting extensions, for example, tabs. Admittedly, the Perl interpreter has a bug (will get to that below), but it is not a serious bug and it does not prevent you from using urxvt. Therefore, I use the tabs extension even though the bug is there.

The bug happens in the following way: some keystrokes, such as, accents in characters (e.g., รก) are not captured by urxvt if you have the tabs extensions enabled and the mouse is outside the window region. If this happens, just move the mouse inside the window region, and the keystrokes start working again. Quite funny, isn't it? This is the funniest bug I have come across.

As far as I understand, the bug occurs in the file "command.c" of the urxvt source. This file implements, among other things, a procedure for translating keystrokes before sending them to the extensions (i.e., the Perl interpreter). However, if the mouse is outside the window region, this translation does not occur and the keystrokes are sent raw to the extensions.

So, install urxvt from Slackbuilds.org with or without the Perl interpreter. You might also need to install libAfterImage if it is not already installed. This library is also available at Slackbuilds.org.

Let's fix some keybindings, such as, "CTRL-L" for clearing the screen. See Rxvt unicode Ctrl-L clear screen fix on how to do this.

Now it is time to make the terminal look nice. Install the font "ttf-bitstream-vera" from Slackbuilds.org. Add the following lines to the .Xdefaults file:

URxvt*background:Black
URxvt*boldFont:-*-bitstream vera sans mono-bold-r-normal-*-*-80-*-*-*-*-iso8859-1
URxvt*font:-*-bitstream vera sans mono-medium-r-normal-*-*-80-*-*-*-*-iso8859-1
URxvt*foreground:White
URxvt*iso14755:false
URxvt*loginShell:true
URxvt*saveLines:32767
URxvt*scrollBar:false
URxvt*scrollBar_right:true
URxvt*shading:40
URxvt*transparent:true
URxvt*transpscrollbar:true

The foreground and shading might need tuning according to the background image you have.

The iso14755 option disables the insert mode for characters defined in this standard (I believe). This is a pain if you're an emacs user because it binds CTRL and SHIFT keys, which are essential to emacs, to the insert mode, and you end up inserting accidentally strange characters in your documents all the time. I have never found an advantage to this mode, so I disable it.

Other nice fonts are the "google-droid-fonts" or "dina" from Slackbuilds.org. You can install these instead and, for example, include the following lines in the previous configuration:

URxvt*boldFont:xft:Droid Sans Mono-11
URxvt*font:xft:Droid Sans Mono-11

Finally, the key binding M-F11 (Alt F11) makes the terminal fullscreen, although this is not specific to urxvt, but most likely a key binding of your window manager.

Tags: slackware

.Xdefaults

April 27, 2012

The file called .Xdefaults in your home directory is loaded into the X server using the xrdb program when you start your X session. In this file, each X application has a number of options which can be set, such as reverse video, window size, window location, and many others. You can set these options so that they are set every time you start up an application. Avoid blank spaces at the beginning and end of lines in the .Xdefaults file.

The exclamation mark (!) or /*... */ is used to add a comment.

Because this file is loaded once when the X session starts, it is necessary to manually reload it when its contents are modified. This can be done using xrdb, for example,

$ xrdb ~/.Xdefaults

You can change the instance of many X programs by starting them with the -name option. For example, if you start an xterm window by typing xterm -name XT1, then you can specify resources for it in your .Xdefaults file with XT1, for example,

XT1*Background: yellow

Tags: slackware