A fast and lightweight Linux desktop with CRUX Linux 2.7 (i686)


http://crux.nu

Main advantages for CRUX :
– fast (simple yet efficient boot scripts) and “keep it simple” principle (targeted at experienced users)
– contains only essential software (reduced disk space usage)
– good package manager with support for dependencies (prt-get) and BSD-like ports system (few but quality packages)

Some cons :
– kernel must be compiled during installation process
– being a source-based distro, compilations will take a long time on slower machines
– no support for native languages (but this is done on purpose)

Installation

Please refer to the official handbook, everything is well explained :

http://crux.nu/Main/Handbook2-7

Just some pointers below :

For this tutorial, we will be using a simple setup :

One hard disk, with two partitions (no lvm) :
one Linux, ext4 formatted, for the whole / (/dev/sda1)
one swap partition (/dev/sda2)

(Make sure you create a swap partition at least the size of your system RAM if you want to use the suspend-to-disk feature)

All packages on the CD are to be selected for installation.

Some optimisations for /etc/fstab :

tmpfs for /tmp, /var/tmp
noatime on /

#
# /etc/fstab: static file system information
#

/dev/sda1    /             ext4      defaults,noatime       0      1
/dev/sda2    swap          swap      defaults               0      0
devpts       /dev/pts      devpts    defaults               0      0
none         /sys          sysfs     defaults               0      0
none         /proc         proc      defaults               0      0
none         /tmp          tmpfs     defaults,noatime,nodev,mode=1777               0      0
none         /var/tmp      tmpfs     defaults,noatime,nodev,mode=1777               0      0
shm          /dev/shm      tmpfs     defaults               0      0
usb          /proc/bus/usb usbfs     defaults               0      0

# End of file

Compiling your kernel (the trickiest part)

Make sure :
– to include ext2/3/4 filesystem support directly in the kernel (ie. not as modules) otherwise your Linux root filesystem can’t be mounted! (the famous “unable to sync” error message)
– to include drivers for your hardware (as modules)
– include DRI support for your graphic card (modules) for better performance

To gain compilation time/kernel size, you may remove :
– support for security (SELinux etc)
– kernel debugging options

see details here

For the bootloader, we will use Grub (lilo would work fine too)

First boot after installation

Login as root.

IMPORTANT!

We enable the “contrib” repository for ports.
# nano /etc/prt-get.conf

Uncomment the “contrib” line and save. Then
# mv /etc/ports/contrib.rsync.inactive /etc/ports/contrib.rsync

and update the ports tree

# ports -u

to see the difference in between installed packages and available new versions

# ports -d

(Optional step, but definitely wiser) Now you could update all the installed packages with :

# prt-get sysup

But it will take some time (remember this is a source-based system).

Configuring X.Org

# startx

If everything works out of the box, good!
If not : https://duckduckgo.com/?q=x.org+troubleshooting

Configuring the sound card

# prt-get update alsa-lib

# prt-get depinst alsa-utils
# alsaconf
# alsamixer

# alsactl store
# nano /etc/rc.conf
add alsa in the daemon (SERVICES) area (see appendix)

Installing support for ACPI and powersaving

(I like to use suspend/hibernate on my desktop systems, even if they are not laptops : I’m a fast boot addict🙂
# prt-get install acpid pm-utils

# nano /etc/rc.conf
add acpid in the daemon (SERVICES) area (see appendix)

In order to be able to resume from hibernate (suspend to disk) we need to edit our grub configuration (adapt if you use lilo) :
# nano /boot/grub/menu.lst
append the following to your kernel boot line :
resume=/dev/sdxx
(in my case swap partition is /dev/sda2)

the full line looks like that:
kernel (hd0,0)/boot/vmlinuz root=/dev/sda1 ro quiet resume=/dev/sda2

allow users (who belong to the wheel group) to hibernate (needs root privileges), without entering password
# visudo
add the two lines:

%wheel   ALL = NOPASSWD: /usr/sbin/pm-hibernate
%wheel   ALL = NOPASSWD: /usr/sbin/pm-suspend

testing hibernate
# pm-hibernate

Creating a standard user “fred” (and grant him sudo rights)

# useradd -G wheel,users,video,audio,cdrom,floppy -s /bin/bash -m fred
# passwd fred
# visudo
Uncomment the line # %wheel ALL=(ALL) ALL

(optional) I like some optimizations in my systcl.conf
# nano /etc/sysctl.conf

kernel.sysrq = 1
vm.swappiness=1
vm.laptop_mode=5

Installing the desktop software

Openbox + his graphical configuration program + a panel
# prt-get depinst openbox obconf pypanel

If you get a dependency error (glib is too old, for example), then :

# prt-get update glib

and retry.

If a package complains that it is already installed :

# prt-get update <package name>

or

# prt-get install -f <package name>

to force re-installation

Filemanager

(I prefer PCManFM but it does not compile – at the time of this writing –  on my setup due to updated dependency packages…)

— TODO —-

pcmanfm
# prt-get depinst pcmanfm
erreur de compil : libfm

so installing a newer pcmanfm and libfm from git (see http://pcmanfm.sourceforge.net ) :
# prt-get install git
# cd
# git clone git://pcmanfm.git.sourceforge.net/gitroot/pcmanfm/libfm
# …

— TODO —

So in the meantime we can use ROX as filemanager
# prt-get depinst rox

Some GTK themes and theme changer
# prt-get depinst gtk-engines gtk-chtheme

Login manager for X

slim
# prt-get install slim
# nano /etc/rc.conf
Add slim to the SERVICES (daemons) area

Now, create our .xinitrc

# su fred
# nano /home/fred/.xinitrc

setxkbmap fr
xterm &
pypanel &
exec openbox-session

(I know, the setxkbmap is not the optimal way to have the correct keymap in you X.Org setup, but it works!)

Reboot the system, login as fred, you should be presented with a standard openbox desktop with an xterm window and a standard panel.

Let’s install some more stuff (your mileage may vary)

Leafpad, a small text editor
$ sudo prt-get install leafpad

A pdf viewer
$ sudo prt-get depinst -f epdfview

Feh, image viewer and background setter (nitrogen is good also but requires more dependencies)
$ sudo prt-get depinst feh
$ mkdir -p ~/wallpaper
Go get some beautiful wallpapers from http://www.interfacelift.com/wallpaper and save them into your wallpaper directory, then
$ feh --bg-scale ~/wallpaper/wallpaper.jpg
(will generate the ~/.fehbg file)

The well known media player, Mplayer
$ sudo prt-get depinst mplayer

Firefox 4.0 (warning: very long compilation!) — Note : Firefox 3.6 is included in the standard CRUX installation.
$ sudo prt-get depinst firefox
(optional, the dreaded flash plugin)
$ sudo prt-get install flash-player-plugin

NOTE: with Firefox 4 comes the support for HTML5 video, so the flash plugin is not mandatory anymore to see videos on youtube!
(see http://www.youtube.com/html5)

Sylpheed, lightweight email client
$ sudo prt-get depinst sylpheed

If you need some heavy office suite, OpenOffice is available through the contrib repository
You may want to edit the Pkgfile beforehand :
# cd /usr/ports/contrib/openoffice/
# nano Pkgfile
edit the source line to select a closer download mirror and/or a different/localized version)
in my case :

source=(http://openoffice.cict.fr/localized/fr/3.3.0/OOo_3.3.0_Linux_x86_install-rpm_fr.tar.gz)

be sure to remove the .md5sum and the .footprint files or installation will fail
# rm .md5sum .footprint

then download and install
# pkgmk -i -d

if installation went through, then run it
$ soffice

(now your system isn’t considered lightweight anymore!)

Some eye-candy🙂

It’s time to change the current GTK theme
$ gtk-chtheme

And openbox’s theme
$ obconf

(optional, but very recommended!) Installing obmenu (not included in the ports)
$ cd && wget http://sourceforge.net/projects/obmenu/files/obmenu/1.0/obmenu-1.0.tar.gz/download
$ tar xvzf obmenu*
$ cd obmenu-1.0
$ sudo prt-get depinst pygtk
$ sudo python setup.py install
$ cp /usr/etc/xdg/openbox/menu.xml $HOME/.config/openbox/

Now you can customize the menu :
$ obmenu

(lightweight) compositing manager!
$ xcompmgr -nfc

Conky
$ sudo prt-get install conky
$ cp /usr/etc/conky/conky.conf $HOME/.conkyrc
$ nano $HOME/.conkyrc

edit/add the lines :

alignment top_right
background yes
double_buffer yes
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
gap_x 0
gap_y 0

Let’s finalize our .xinitrc and openbox’s autostart.sh
$ nano ~/.xinitrc

exec openbox-session

$ nano ~/.config/openbox/autostart.sh

#`cat ~/.fehbg` &
# doesn't work! so workaround below
feh --bg-scale "$HOME/wallpaper/wallpaper.jpg" &
setxkbmap fr &
pypanel &
xterm &
xcompmgr -nfc &
conky &

(Please note, the order in which the programs are started is important here)

Pypanel customization
$ nano ~/.pypanelrc
modify/add lines :

SHOWLINES  = 1
SHOWBORDER = 1
DESKTOP = 4
TASKS = 2
TRAY =3
CLOCK = 5
LAUNCHER = 1
LAUNCH_LIST = [
("firefox", "/usr/lib/firefox/chrome/icons/default/default32.png"),
("sylpheed", "/usr/share/pixmaps/sylpheed.png"),
]

Conclusion

You now have a base for a nice, light and fast CRUX desktop system!

TODO :
– install PCManFM filemanager instead of Rox, but the libfm port doesn’t compile on my system at the time of this writing.

TIPS

see which packages can be updated
# ports -u && ports -d

complete system update
# prt-get sysup

search for a port
# prt-get search

List installed packages
# pkginfo -i |more

APPENDIX

#
# /etc/rc.conf: system configuration
#

FONT=default
KEYMAP=fr
TIMEZONE=Europe/Paris
HOSTNAME=crux27
SYSLOG=sysklogd
SERVICES=(net crond acpid alsa sshd dbus slim)

# End of file

Screenshot!

The resulting desktop

26 thoughts on “A fast and lightweight Linux desktop with CRUX Linux 2.7 (i686)

  1. Thank you for this tutorial, looking forward to try crux on my old P3 566MhZ, since my last try with it, was a disaster🙂

    • Some hints maybe :

      – Before compiling the kernel, do a
      # make i386_defconfig
      to generate default kernel configuration for x86 architecture. Then do make menuconfig to configure the kernel.

      – Be sure to include the filesystem drivers (Ext2/3/4) directly in your kernel. (ie. not as modules!)

  2. would one select just the file support option, or everything else? example it has ext4 file extention support and then a bunch of other sub options.

  3. i feel like the reason this is not working for me is because im doing it on a virtual machine…but i dont wanna risk wiping down my system for something that might not work. xD

    • Works perfectly in VirtualBox on my system!
      Hang on, I will try to make a small tutorial for the kernel compilation part shortly…

  4. the one issue i am having is finding the video graphic card drivers. i’m not sure if they’re in there or not, (i didn’t see it in the tut), but, i followed the rest, and, am currently compiling the kernel. fingers and toes crossed. xD

    • I have the same error message “i915/drm”. It’s when your kernel is configured with DRI for intel graphics and you don’t have intel graphics in your virtual machine.

      But this is NOT what makes your kernel crash!

      I have the first error (“EXT3-fs… unsupported optional features”) as well, but it does not prevent my system from booting!

      The blocking error is “VFS: unable to mount root fs on unknown block”.

      please post your lilo.conf and the result of fdisk -l
      also, which filesystem do you use (EXT2/3/4?)

  5. i take it you have no idea either…lol, i guess thats okay, ill try something else. thanks for the help though!

  6. Wow, great tutorial. Thnx, u make me want to try Crux. IMHO Crux has a lot of potential. I wonder if they could avoid kernel compile during install and implement an installer, like Slackware for example…Slackware is for me the best ncurse installer for any type of users.

    • Thanks!

      Crux is all about customizing your system from A to Z, and it’s a great way to learn how a Linux system works.

      I think an “easy” slackware-like installation would ruin the purpose!🙂

  7. I know this is a lot to ask for, but if you ever have time on your hands, i’d like to setup a remote host on my other computer while i ssh into the computer im installing crux on.

    maybe if you can see what i do while i install it, you can pinpoint my error.
    I keep getting that damn kernel panic, not syncing message, and to be honest, i KNOW i added support for it. i even formated to different file systems and still have no luck. if you can manage the time, i’d be really greatful.

    • Sorry, not much time for this right now!

      I suggest you wait for the next Crux release, which should be out before the end of the year

      I know it’s frustrating🙂

      Have you tried Arch?

  8. I got crux to work, i figured out the problem.

    The only issue i have now is when i try to install vlc with its dependancies, i get an error telling me some of the lib files were not installed or something. i’ve already updated glib2 as well as the ports

  9. Been running Crux for a few months now. Still can’t believe how FAST this box is! Used Arch for a decade, but was really glad to finally see the back of systemd. Thx for the tips…used a few while setting up the new world. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s