How to Install Packages from an Ubuntu LiveCD

My attempts to install KDE3 onto Ubuntu Jaunty were recently thwarted when Tim Pearson's KDE3 apt repository was taken out by a nearby lightning strike. By googling, I managed to find a couple of mirrors of his livecd .iso images and was able to download what I needed, but when I booted the livecd, I found it didn't have .deb packages as I was expecting. The installer must copy the packages directly off the live image.

So I wondered, how is is possible to repackage files off a livecd into .deb files for installing on a real installation? Well, it turns out it's not that hard, using dpkg-repack:

  1. Download the .iso
  2. Mount the .iso
    # mkdir /mnt/cdrom
    # mount -t iso9660 -o loop kubuntu-9.04-kde3-desktop-amd64.iso /mnt/cdrom
  3. Mount the SquashFS filesystem stored in the .iso
    # mkdir /mnt/casper
    # losetup -f --show /mnt/cdrom/casper/filesystem.squashfs
    # mount -o loop /dev/loop/1 /mnt/casper
    # df -k /mnt/cdrom /mnt/casper
    Filesystem           1K-blocks      Used Available Use% Mounted on
    /dev/loop0              714676    714676         0 100% /mnt/cdrom
    /dev/loop2              697600    697600         0 100% /mnt/casper
  4. Install dpkg-repack
    # apt-get install dpkg-repack
  5. Change directory to where apt stores its archives by default
    # cd /var/cache/apt/archives
  6. Use dpkg-repack to convert packages from the livecd to .deb files
    # dpkg-repack --root=/mnt/casper $(chroot /mnt/casper /usr/bin/dpkg-query -W -f='${package} ' '*-kde3')
  7. Force install the new .deb files (some files are common to KDE4 packages)
    # dpkg -i --force-all *-kde3*.deb

The configure step will ask you to choose a display manager (kdm/gdm/kdm-kde3). When finished, reboot or restart the display manager from a virtual console (Ctrl-Alt-F1) and log into KDE3.

# /etc/init.d/kdm restart

comments powered by Disqus