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.

PartitionTypeSizeDevice Node
(assumed)
/primary, ext4, +boot20GB/dev/sda1
swaplogical, swap2GB/dev/sda5
/homelogical, ext4remainder/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.)

code
(All except)
opt
(Include)
xorg
(Include)
btrfs-progsalsa-libmesa3d
edfakerootxorg
eximgtkxorg-font-*
jfutilshicolor-icon-themexorg-libxxf86misc
liloopenboxxorg-xbacklight
reiserfsprogssyslinuxxorg-xf86-input-{keyboard,mouse,synaptics}
xfsprogswireless-toolsxorg-xf86-video-? (see drivers)
 wpa_supplicantxorg-xrandr
 xorg-xset
 xorg-xrdb
 libepoxy

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

/etc/fstab

# 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
> EOF

/etc/rc.conf

FONT=lat9w-16
KEYMAP=us
TIMEZONE=Asia/Colombo
HOSTNAME=sw-crux
SYSLOG=sysklogd
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
> PROMPT 0
> TIMEOUT 50
> 
> LABEL crux
>   MENU LABEL CRUX
>   LINUX ../vmlinuz
>   APPEND root=/dev/sda1 ro
> EOF
# 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
> EOF

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
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
> EOF

Enable contrib repository

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

/etc/prt-get.conf

# 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
> EOF

/etc/pkgmk.conf

Remove -pipe flags.

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

And make following changes

export MAKEFLAGS="-j$(getconf _NPROCESSORS_ONLN)"

PKGMK_SOURCE_DIR="/home/pkgmk/src"
PKGMK_PACKAGE_DIR="/home/pkgmk/pkg"
PKGMK_WORK_DIR="/home/pkgmk/work/$name"
PKGMK_IGNORE_FOOTPRINT="yes"
PKGMK_COMPRESSION_MODE="xz"

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 http://repo.sudaraka.org/crux-ports/rso.httpup -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)

SINX-450

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

Wifi: Realtek RTL8191SEvB

SINX-450

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
> host=crux.nu
> collection=ports/crux-2.8/xfce/
> destination=/usr/ports/xfce
> EOF

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...
XFCESupport ApplicationsThemesDependencies
xfce4thunar-volmanxfce-theme-greybird *gperf
xfce4-appfinderthunar-archive-pluginfaenza-icon-theme *
xfce4-mixerthunar-media-tags-pluginxorg-font-droid-ttf *
xfce4-power-managerorage
xfce4-artworkristretto
xfce4-battery-pluginxfburn
xfce4-netload-plugin
xfce4-notes-plugin
xfce4-screenshooter
xfce4-taskmanager
libxfcegui4
xfce4-notifyd *
xfce4-places-plugin

* installed from the local repository.

Other Software