Ajitabh Pandey's Soul & Syntax

Exploring systems, souls, and stories – one post at a time

Author: Ajitabh

  • Apt Pinning

    I normally stick with Debian Stable on my laptop. But atleast there was one package which I needed out of testing or unstable, git. So I thought of using the Debian backports repository. I followed the instructions to use the backports repository and came through this very good APT Pinning document. This is how I installed git on my laptop.

    I added the following line to my /etc/apt/source.list file

    # Debian backports
    deb http://www.backports.org/debian/ sarge-backports main contrib non-free

    and the following to my /etc/apt/preferences file. I needed to create this file as I was not using multiple repositories before, so I had to make all the entries. However, only the middle entry which pins the priority of the sarge-backports repository is required. If most of the time stable is preferred then the priority of stable has to be higher than that of sarge-backports. The last pinning which specifies the priority of -10 to other Debian releases is just a proactive measure to make sure that if I add a new Debian repository to the /etc/apt/sources.list file then I need to specify a pinning preference explicitly in this file, else it will have the priority of -10 which is lowest or no priority at all.

    # Debian stable has a higher priority than the
    # backports repository
    Package: *
    Pin: release o=Debian,a=stable
    Pin-Priority: 900
    Package: *
    Pin: release a=sarge-backports
    Pin-Priority: 200
    Package: *
    Pin: release o=Debian
    Pin-Priority: -10

     

  • Streaming with mod_musicindex

    Introduction

    mod_musicindex is an Apache modules which allows nice displaying of directories containing MP3, FLAC, Ogg Vorbis or MP4/AAC files. This includes sorting them on various fields, streaming and or downloading them. It can also construct playlists and search them.

    mod_musicindex started as a C implementation of the perl module Apache::MP3.

    It features a cache system, currently based on mirroring the tree structure handled by the module, storing files data using a flat text file backend. The project plans to support MySQL, PostgreSQL and SQLite backends in future.

    If a picture of CD cover is also added in a directory, it will be displayed in the upper left corner of the web page and as a thumbnail in the parent directory. The file name of the picture must match the following scheme:

    "(.){cover,folder}.{jpg,png,gif}"

    eg: “cover.png” or “.folder.jpg” are valid names.

    The musicindex directory (usually found in /var/www/, atleast on Debian and Ubuntu) contains a sample musicindex.css file which can be tailored as per requirement.

    Setting up mod_musicindex on Debian

    Since Debian provides a package for it, yes in Sarge too, its extremely simple to install:

    apt-get install libapache2-mod-musicindex
    ln -s /etc/apache2/mods-available/musicindex.load musicindex.load

    Next comes the configuration. The location of music files in the web-root is a personal choice. If you are running a dedicated music server then perhaps you have a complete document root and a virtual server in place. I setup this on my laptop which is also my development machine. UserDir is configured on my machine so I did the following:

    vi /etc/apache2/mods-enabled/userdir.conf
            Alias /songs /home/*/www/songs/
    
            Options Indexes MultiViews FollowSymlinks
            AllowOverride       Indexes
            MusicLister         On
            MusicSortOrder      album disc track artist title length bitrate freq filet$
            MusicFields            title artist length bitrate
            MusicAllowDownload  Off
            MusicAllowStream    On
            MusicAllowSearch    On
    #       MusicRssItems       Off
            MusicPageTitle      home
            MusicCssDefault     musicindex.css
            MusicCachePath      /tmp/musicindex
    #       MusicIceServer     [ice.domain.my]:8000
    #       MusicCookieLife    300

    The advantage of this setup is that the module becomes available to all users in the system if they place all audio files in a directory called songs in their web-roots.

    Screenshots

    Here are some screenshots from my server:

  • Using Citrix Metaframe Presentation Server with Citrix ICA Client

    I was trying to connect to my office Citrix farm using the Citrix Metaframe Presentation Server web interface which was setup by the windows administrator. I faced some issues and found ways to fix them and got it working under linux.

    First of all this should be noted that the Citrix ICA client for linux is java based and hence I got it working on the java enabled Firefox. When I connected to the gateway server I was presented with a screen asking various authentication things and the same screen also had an option to download the Citrix ICA client for linux. I downloaded and installed the client although it was quite outdated – ver 7.0 as compared to the latest version 9.0. I still downloaded it as I knew the latest will not work on my slackware laptop as I did not have the required version of libmotif installed (actually lesstiff). After installing it, I connected to the gateway interface of my company and when I clicked on the required desktop, I was prompted by firefox as it did not understood how to handle the .ica file. So I chose the /usr/lib/ICAClient/wfica.sh to execute this. This prompting problem can be fixed using the file associations of your desktop environment. You should assiciate .ica files with the above shell script.

    To my surprise I got prompted “You have chosen not to trust Thawte Premium Server CA”. I thought I needed to import the Thawte root certificates in firefox and hence downloaded them from http://www.thawte.com/roots/ website. But even after importing I got the same message. I then searched the web around and understood that I needed to import the root certificated to the

    /usr/lib/ICAClient/keystore/cacerts
    

    directory. The zip files of various Thawte certificates I downloaded above was having a file “Thawte Server Roots/ThawtePremiumServerCA.cer”, I copied this to /usr/lib/ICAClient/keystore/cacerts as ThawtePremiumServerCA.crt.

    $ sudo cp ThawtePremiumServerCA.cer /usr/lib/ICAClient/keystore/cacerts/
    $ sudo mv /usr/lib/ICAClient/keystore/cacerts/ThawtePremiumServerCA.cer /usr/lib/ICAClient/keystore/cacerts/ThawtePremiumServerCA.crt
    

    The reason for rename was that the Citrix ICA client expects the .crt extension for the certificates.

    This worked, and now I could see the desktop.

  • Upgrading Slackware to 2.6 kernel

    Yesterday I updated the slackware kernel to 2.6.16.22. I picked up this version from the testing directory on the slackware’s ftp site.

    The packages I needed were:

    kernel-generic-2.6.16.22-i486-1.tgz
    kernel-modules-2.6.16.22-i486-1.tgz
    alsa-driver-1.0.11_2.6.16.22-i486-1

    Apart from these I installed the source package also

    kernel-source-2.6.16.22-i486-1.tgz

    After installing these packages using

    installpkg

    I created the initrd image for the kernel.

    mkinitrd -c -k 2.6.16.22 -m reiserfs

    Change LILO
    I added following lines in my lilo.conf

    # vi /etc/lilo.conf
    image = /boot/vmlinuz
    initrd=/boot/initrd.gz
    root = /dev/hda2
    label = Linux-2.6.16
    read-only

    and then

    # lilo -v
    # reboot

    ALSA Driver
    There is a seperate ALSA driver package for every slackware kernel and since I had already installed the required driver for the new kernel. I needed to run the

    alsaconf

    and any mixer program of choice like

    alsamixer

    or

    aumix

  • Moving data to a seperate filesystem

    Often its required that the a directory (for example /home)be moved to a seperate filesystem. The steps are simple:

    • Boot system in single user mode (linux single), or if already booted take it down to single user using,
      init 1
      
    • Create a new partition if its not already done.
      fdisk /dev/hda
      
    • Create the filesystem on the new partition
      mkfs.ext3 /dev/hda3
      
    • Mount the filesystem under a suitable directory in /mnt
      mkdir /mnt/newpart && mount /dev/hda3 /mnt/newpart
      
    • Copy all files from the directory /usr to the new directory using
      cp -a /home/* /mnt/newpart/*
      

    The following steps needs to be done in a sequence.

    • Rename /home
    • Create new /home/ directory
    • Mount the new filesystem in /home
    • Update the /etc/fstab
    mv /usr /old-home && /bin/mkdir /home && /bin/mount /dev/hda3 /home