CRUX Installation Guide (incomplete)

This article is incomplete

This CRUX installation guide is customized for my hardware and my needs. Anyone may use these instructions to setup a system of their own, but they are not guaranteed to work on all hardware nor they are the “official” way of doing things.

Disclaimer: software components, specially the ones that I block out are my personal choice, and anyone else referencing this article should substitute their own choices.

For a generic installations instructions see the official CRUX Handbook.

Preparing Partitions

Create the following partitions on primary disk using fdisk.

Partition Type Size Device Node
/ primary, ext4, +boot 20GB /dev/sda1
swap logical, swap 2GB /dev/sda5
/home logical, ext4 remainder /dev/sda6

Format each partition

# mkswap /dev/sda5
--- output not shown here ---
# mkfs.ext4 /dev/sda1
--- output not shown here ---
# mkfs.ext4 /dev/sda6
--- output not shown here ---

Prepare for base installation

Mount file system

Mount new partition to a temporary location (/mnt) and install base packages.

# swapon /dev/sda5
--- output not shown here ---
# mount /dev/sda1 /mnt
--- output not shown here ---
# setup
--- output not shown here ---

Packages to install

Select the packages to install with the following guidelines. (Installation program will automatically calculate dependencies.)

(All except)
btrfs-progs alsa-lib mesa3d
ed fakeroot xorg
exim gtk xorg-font-*
jfutils hicolor-icon-theme xorg-libxxf86misc
lilo openbox xorg-xbacklight
reiserfsprogs syslinux xorg-xf86-input-{keyboard,mouse,synaptics}
xfsprogs wireless-tools xorg-xf86-video-? (see drivers)
wpa_supplicant xorg-xrandr

Pre-boot configuration

Chroot into the new system

Use the provided setup-chroot script

# setup-chroot

or, manually

# mount --bind /dev /mnt/dev
# mount --bind /tmp /mnt/tmp
# mount -t proc proc /mnt/proc
# mount -t sysfs none /mnt/sys
# mount -t devpts devpts /mnt/dev/pts
# chroot /mnt /bin/bash


# cat >> /etc/fstab << EOF
> /dev/sda1 / ext4 defaults,noatime,nodiratime,discard,errors=remount-ro 0 1
> /dev/sda5 swap swap sw,noatime,nodiratime 0 0
> /dev/sda6 /home ext4 defaults,noatime,nodiratime,discard,errors=remount-ro 0 1


  1. FONT=lat9w-16
  2. KEYMAP=us
  3. TIMEZONE=Asia/Colombo
  4. HOSTNAME=sw-crux
  5. SYSLOG=sysklogd
  6. SERVICES=(crond)

Generating locales

# localedef -i en_US -f ISO-8859-1 en_US
# localedef -i en_US -f ISO-8859-1 en_US.ISO-8859-1
# localedef -i en_US -f UTF-8 en_US.UTF-8
# localedef -i si_LK -f UTF-8 si_LK.UTF-8

Install Kernel

Compile the latest stable kernel from source/git, or copy the pre-compiled binaries.

Install bootloader (syslinux)

At this point you should have the kernel installed.

# cat > /boot/syslinux/syslinux.cfg << EOF
> DEFAULT crux
> LABEL crux
>   LINUX ../vmlinuz
>   APPEND root=/dev/sda1 ro
# extlinux -i /boot/syslinux
/boot/syslinux is device /dev/sda1
# dd if=/usr/share/syslinux/mbr.bin of=/dev/sda bs=440 count=1
1+0 records in
1+0 records out
440 bytes (440 B) copied, 0.00345276 s, 127 kB/s

Set root password

# passwd
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Create user(s)

Make sure you have the /home mounted

# useradd -m -s /bin/bash -G audio,lp,video,wheel,scanner -U new_username
# passwd new_username
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully

Add the new_username to /etc/sudoers

# cat >> /etc/sudoers << EOF
> new_username ALL=(ALL) ALL

Lockout root from login into console or from SSH in.

# rm /etc/securetty
# sed 's#root:x:0:0:root:/root:/bin/bash#root:x:0:0:root:/root:/bin/false#' -i /etc/passwd

Exit chroot, unmount and reboot

Add - -noclear flag to the tty1 in /etc/inittab and remove additional ttys.

# exit
# umount /mnt/{dev{/pts,},tmp,proc,sys,home,}
# reboot

First-boot configuration

Connect to internet via WIFI

Enable WIFI connection using WPA2. When using a wired connection this steps in this section may be skipped partly or completely.

Check the drivers section to see if you need any firmware installed.

# wpa_passphrase ESSID uber_secret_key|sed '/#psk=/d' > /etc/wifi.conf
# wpa_supplicant -B -D wext -i wlan0 -c /etc/wifi.conf
# dhcpcd wlan0

Edit /etc/rc.local to start the internet connection on boot

Configure build environment

Create a new user for building packages and create relevant sub-directories in it's home directory. Also link the /usr/ports to our new location.

# useradd -m -s /bin/false -U pkgmk
# mkdir -pv /home/pkgmk/{src,pkg,work,ports}
mkdir: created directory '/home/pkgmk/src'
mkdir: created directory '/home/pkgmk/pkg'
mkdir: created directory '/home/pkgmk/work'
mkdir: created directory '/home/pkgmk/ports'
# rmdir /usr/ports
# ln -s /home/pkgmk/ports /usr/ports
# chown -R pkgmk.users /home/pkgmk

Mount a ram disk to /home/pkgmk/work to make the compilation faster.

# id pkgmk
uid=101(pkgmk) gid=100(users) groups=100(users)
# cat >> /etc/fstab << EOF
> pkgmk /home/pkgmk/work tmpfs size=1G,uid=101,defaults,noatime,nodiratime 0 0

Enable contrib repository

# mv -v /etc/ports/contrib.rsync{.inactive,}
'/etc/ports/contrib.rsync.inactive' -> '/etc/ports/contrib.rsync'


# sed 's/# \(makecommand\)/\1 sudo -H -u pkgmk fakeroot/' -i /etc/prt-get.conf
# cat >> /etc/prt-get.conf << EOF
> prtdir /usr/ports/contrib
> runscripts yes


Remove -pipe flags.

# sed 's/ -pipe//g' -i /etc/pkgmk.conf

And make following changes

  1. export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"
  3. PKGMK_SOURCE_DIR="/home/pkgmk/src"
  4. PKGMK_PACKAGE_DIR="/home/pkgmk/pkg"
  5. PKGMK_WORK_DIR="/home/pkgmk/work/$name"

Update system

# ports -u
# prt-get sysup

Local ports tree

Add the rso.httpup file for the repository to /etc/ports directory, and update the ports tree

# sudo wget -O /etc/ports/rso.httpup
--- output not shown here ---
# sudo ports -u rso
--- output not shown here ---

Add the new ports directory to the /etc/prt-get.conf. Place it above other port directories can override them

Install the required packages.

Driver installation and configuration

Sound: ALSA Support

ALSA support must be enabled in the Kernel. Following installs a set of utilities for configuration and integration need that applies to all hardware.

# prt-get depinst alsa-utils
--- output not shown here ---

Do the necessary adjustments using alsamixer and test and save settings.

$ alsamixer
$ speaker-test -c 2
--- output not shown here ---

Optionally, make the necessary changes to the configuration files to load ALSA daemon on boot.

Video: GMA500 (Intel)


# prt-get depinst xorg-xf86-video-fbdev
--- output not shown here ---

Wifi: Realtek RTL8191SEvB


Install the binary firmware (rtlwifi/rtl8192sefw.bin) from kernel repository.

Desktop environment (XFCE)

To enable XFCE ports, create the .rsync file manually.

# cat > /etc/ports/xfce.rsync << EOF
> collection=ports/crux-2.8/xfce/
> destination=/usr/ports/xfce

Then modify the /etc/prt-get.conf to include the new xfce ports directory and update ports tree.

Install the following packages:

# prt-get -if depinst ...list from below...

XFCE Support Applications Themes Dependencies
xfce4 thunar-volman xfce-theme-greybird * gperf
xfce4-appfinder thunar-archive-plugin faenza-icon-theme *
xfce4-mixer thunar-media-tags-plugin xorg-font-droid-ttf *
xfce4-power-manager orage
xfce4-artwork ristretto
xfce4-battery-plugin xfburn
xfce4-notifyd *

* installed from the local repository.

Other Software

  • ca-certificates
  • geany
  • git
  • guake