Monday, May 6, 2013

Minimal Xubuntu Desktop installation

 [Image]

Edit: I strongly recommend to continue with the Xubuntu 13.10 installation because many steps described here are obsolete.

I spent a day building a minimum Xubuntu installation to avoid bloat-ware installed by default. I was installing Xubuntu on a small 16GB SSD that was used previously as an ExpressCache drive on Windows 7 and that's why I wanted to install minimum set of software for the Desktop to work.
As the basis for the system I've chosen Ubuntu 13.04 mini.iso. My first attempt was to install Debian Sid branch but software there is already outdated! And installing new software from experimental branch is not possible as apt-get would completely destroy installed Sid system.

This mini.iso can be just dd'ed onto a thumb drive and then booted. When it is booted select 'Command Line Install' and follow the rest of installation steps. The only problem I had with the installation was that the GRUB refused to install itself into any drive except the main HDD. As far as I wanted to have GRUB on the SSD drive I had to continue installation without installing GRUB (read at the end of this article for the solution).

If the base system is successfully installed and apt-get is updated then the next step is to install the xubuntu-desktop meta package without recommended packages
sudo apt-get install --no-install-recommends xubuntu-desktop
This will add 437MB of additional packages.

To complete the desktop I installed the following packages additionally again without recommended packages:
sudo add-apt-repository ppa:catfish-search/catfish-stable
sudo apt-get update
sudo apt-get install --no-install-recommends \
       xfce4-terminal \
       xfce4-power-manager \
       xfce4-volumed \
       xfce4-indicator-plugin \
       xfce4-datetime-plugin \
       xfce4-screenshooter \
       xfce4-xkb-plugin \
       xubuntu-icon-theme \
       xfwm4-themes \
       alacarte \
       pavucontrol \
       file-roller \
       plymouth-theme-xubuntu-logo \
       mousepad \
       gvfs-fuse \
       thunar-archive-plugin \
       catfish
This will add around 65MB.
Note: it is important to add catfish ppa to the repository before installation because this package in the Ubuntu 13.04 repository has a nasty dependency to the zeitgeist spying daemon (skip this ppa if you use 13.10 or above because it is fixed there).

After rebooting the minimal Xubuntu system is up and running!

Now these parts are still missing:
  1. Time and Date Settings Dialog (gnome-time-admin package)
  2. Users Settings Dialog (gnome-system-tools package)
  3. Sound Control Icon (indicator-sound-gtk2 package)
  4. Network Manager (network-manager package)
All these packages have heavy dependency lists. The first two do not bring anything really useful and could be completely skipped and the sound control can be added into the panel using a Launcher:
  1. Time & Data Dialog is only needed to activate ntpd and the equivalent command for that is:
    sudo apt-get install ntp
  2. The Users Settings Dialog is just a wrapper around adduser and addgroup commands.
  3. Sound Icon on the panel is nice to have but indicator-sound-gtk2 package in the Ubuntu 13.04 repository has dependencies to the Unity related packages and to the spying geoclue daemon. Instead I added pavucontrol onto the Settings Dialog and onto the Panel by:
    # first create a local copy of the application desktop file with a different name
    cp /usr/share/applications/pavucontrol.desktop ~/.local/share/applications/pavucontrol2.desktop
    # replacing Categories entry
    # here is the diff
    diff -u /usr/share/applications/pavucontrol.desktop ~/.local/share/applications/pavucontrol2.desktop
    --- /usr/share/applications/pavucontrol.desktop 2012-05-24 21:26:16.000000000 +0200
    +++ /home/alex/.local/share/applications/pavucontrol2.desktop 2013-05-04 13:58:24.154411234 +0200
    @@ -113,4 +113,4 @@
     Icon=multimedia-volume-control
     StartupNotify=true
     Type=Application
    -Categories=AudioVideo;Audio;Mixer;GTK;
    +Categories=Settings;HardwareSettings
    

Here how the Sound Control Dialog Icon looks like on the panel:

[Image]

With the Ubuntu 13.10 these dependencies are removed and it's perfectly safe to install indicator-sound-gtk2.

The Network Manager


The NetworkManager has lots of dependencies and is heavy. The alternative I tried to install was wicd-gtk. First of all it didn't work after installation and I had to understand the reason for the uncaught exception thrown by the wicd-daemon.py. The reason was the symbolic link /etc/resolv.conf created by resolveconf. Removing /etc/resolv.conf symbolic link and creating /etc/resolv.conf as a file solved the problem with crashes. Additionally it was necessary to remove all network interfaces from /etc/network/interfaces except the loopback interface. Otherwise the system waited several minutes for a dhcp to answer by booting.

But the problem with wicd is that it is outdated and has no nice features like NetworkManager has. It has no modem support, no vpn support, no mac cloning, no mtu configuration, etc. So finally I installed NetworkManager with the bluman together:
sudo apt-get install network-manager-gnome blueman

And with the following packages installed I finished my minimal Xubuntu Desktop installation:
sudo apt-get install davfs2 encfs rar libnotify-bin htop gufw
sudo apt-get install --no-install-recommends cifs-utils

Some stats (with Firefox and gnokii installed additionally):
# I have /var and /home on a separate drive

alex@xubuntu:~$ df /
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda1       15260592 1369444  13891148   9% /

alex@xubuntu:~$ dpkg -l | grep '^ii' | wc -l
914


Fixing the GRUB boot loader installation


As I noted in the beginning the GRUB boot loader failed to install itself onto SSD drive so I booted another Linux distribution from a thumb drive and installed GRUB from the cli following these steps:
You will need a live cd for this. Start From the CD and just use hit crl+f1. This will get you in a boot session. Then just do the following:
sudo mount /dev/sda1 /mnt
sudo grub-install --root-directory=/mnt/ /dev/sda
# at this point, also ensure that if /usr and /var are on seperate partitions that you mount them to /mnt/usr and /mnt/var
# whithin the chroot you need to have /dev /run and /proc available for update-grub to work, use the following to acheive that: for i in /sys /proc /run /dev; do sudo mount --bind "$i" "/mnt$i"; done
sudo chroot /mnt
sudo update-grub
sudo reboot
Also a warning, if you installed 64 bit you will need a 64 bit and vice versa else you will be getting an error during chroot. ( as i have )

As far as I booted a 32 bit distribution I could not perform update-grub. Solution was to boot into the GRUB command line interface and then boot linux manually
grub> linux  (hd0,1)/vmlinuz root=/dev/sda1
grub> initrd  (hd0,1)/initrd.img
grub> boot
and execute the 'sudo dpkg-reconfigure grub-pc' from the running system


Boot with bluetooth disabled


There's a bug in the bluetoothd so that it doesn't respect values of the InitiallyPowered and RememberPowered variables in its /etc/bluetooth/main.conf configuration file. No matter what are the values the bluetooth is always enabled after rebooting. Solution is to start bluetoothd manually only when needed. To do so the following should be done:
sudo echo "manual" > /etc/init/bluetooth.override
# to start it call
sudo start bluetooth


Power saving tweaks


  1. I didn't want to install laptop-mode-tools becase pm-utils installed with the xubuntu-desktop meta package does the job well with default scripts. There are two things though I wanted additionally: automatic display brightness adjustment and the powersave cpu governor when running on the battery. Solution was to create following scripts and make them executable:
    alex@xubuntu:~$ cat /etc/pm/power.d/00-brightness 
    #!/bin/bash
    
    case $1 in
      true)
        echo "Enable screen power saving"
        echo 9 > /sys/class/backlight/acpi_video0/brightness
        ;;
      false)
        echo "Disable screen power saving"
        echo 15 > /sys/class/backlight/acpi_video0/brightness
        ;;
    esac
     
     
    alex@xubuntu:~$ cat /etc/pm/power.d/10-cpugovernor 
    #!/bin/bash
    
    case $1 in
      true)
        echo "Use powersave cpu governer when on the battery"
        echo powersave | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
        ;;
      false)
        echo "Use ondemand cpu governer when on AC"
        echo ondemand | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
        ;;
    esac
    
  2. The ethtool needs to be installed to let the pm-utils scripts disable wake on lan feature which reduces power consumption a bit.
  3. Disable NMI watchdog
    echo "kernel.nmi_watchdog = 0" | sudo tee /etc/sysctl.d/disable_watchdog.conf
     
    
  4. Add following defaults to activate pm-utils scripts:
    alex@thinkpad:~$ cat /etc/pm/config.d/defaults 
    # Enable SATA link power management in /usr/lib/pm-utils/power.d/sata_alpm
    SATA_ALPM_ENABLE=true
    
    # these are default system values to override pm-utils values
    # defined in the /usr/lib/pm-utils/power.d/laptop-mode
    LAPTOP_DIRTY_RATIO=10
    LAPTOP_DIRTY_BG_RATIO=5
    # this value is suggested by the powertop
    LAPTOP_DIRTY_WRITEBACK=1500
    
  5. Read this posting to improve power saving options for pci devices

 

Additional tweaks


  1. popularity-contest package shall be removed because it sends some statistics back each day. It is installed together with the ubuntu-standard meta package and it's OK to remove it too:
    sudo apt-get purge popularity-contest
  2. Removing an unwanted partition icon from the Desktop:
    alex@thinkpad:~$ cat /etc/udev/rules.d/10-local.rules
    KERNEL=="sdb1", ENV{UDISKS_IGNORE}="1"
    
  3. Adding Keylock Indicator
  4. Starting with version 24, Firefox supports h.264 video decoding. To enable the feature the media.gstreamer.enabled setting should be set to true in the about:config. Additionally the following packages shall be installed:
    sudo apt-get install gstreamer0.10-plugins-bad --no-install-recommends
    sudo apt-get install gstreamer0.10-ffmpeg
    
    This is valid until Firefox switches to a newer gstreamer version (atm it uses gstremer 0.10). To check if everything works correctly this page can be used. All three video containers shall be visible and playable.


8 comments:

Anonymous said...

Thank you very much

Anonymous said...

I wanted to build a minimal Custom distro with installed apps. I selected x-ubuntu on Ubuntu_amd64_12.04. But I was missing Network and Date config utilities as desktop envi was installed without recommends. You saved my day.
I just used some part of your guide to complete my aim.

Thanks.

-Girish
-India

Trinae said...

Thank you for an easy to follow guide. It helped me install Xubuntu on an old Macbook 3.1 a friend gave to me.

Quick question, can you use the --no-install-recommends command for Network Manager? It looks like it pulls in a lot of dependencies and I am not sure if it will slow down my system.

alex said...

the nm didn't work for me without its recommends. But you may try to install it this way and then install missing packages one by one until it works. You may even post your results here

Anonymous said...

This is an excellent installation. Is there any way to prevent the burden of typing all the text? Can this be put into a script? Or some easier way to implement?

alex said...

I do not like the idea of an automated script because it won't suit everybody. Basically I've documented the steps needed to build my own system for my hardware so that I can repeat all the installation steps if needed. Of course everyone can use this documentation but it's necessary to understand the procedure.

Ginny said...

Seems that with Xubuntu 13.10 catfish can not be installed anymore without Zeitgeist.

alex said...

I doubt that because if you check catfish package dependencies in the Saucy distribution the zeitgeist dependency is moved to the suggest section as the reaction to my bug report. So installing it with the --no-install-recommends should work. I haven't tested 13.10 myself so please give me more details about this problem