thewatertower.org.uk

Package management on Ubuntu




Basics

# aptitude search vim
v   virtual package
c   deleted package; configs still present
i    installed
p   no trace of package
# aptitude install <package>
# aptitude remove <package>


Upgrades

# aptitude update
# aptitude safe-upgrade

'update' syncs the package index files. /etc/apt/sources.list contains the sources that are configured, including a bunch that'll be remarked out.

As per the man page, run 'update' before 'upgrade' or 'dist-upgrade'


Caching and proxying


Cleaning up kernels

Removing the installations of old kernels will save disk and remove the extra boot menu items as well.

ben@akira:~$ uname -r
2.6.24-22-generic
ben@akira:~$ aptitude search linux-image | grep ^i | grep -v `uname -r`
i   linux-image-2.6.24-16-generic   - Linux kernel image for version 2.6.24 on x
i   linux-image-2.6.24-19-generic   - Linux kernel image for version 2.6.24 on x
i   linux-image-2.6.24-21-generic   - Linux kernel image for version 2.6.24 on x
i   linux-image-generic             - Generic Linux kernel image 
ben@akira:~$ grep ^title /boot/grub/menu.lst
title           Ubuntu 8.04.1, kernel 2.6.24-22-generic
title           Ubuntu 8.04.1, kernel 2.6.24-22-generic (recovery mode)
title           Ubuntu 8.04.1, kernel 2.6.24-21-generic
title           Ubuntu 8.04.1, kernel 2.6.24-21-generic (recovery mode)
title           Ubuntu 8.04.1, kernel 2.6.24-19-generic
title           Ubuntu 8.04.1, kernel 2.6.24-19-generic (recovery mode)
title           Ubuntu 8.04.1, kernel 2.6.24-16-generic
title           Ubuntu 8.04.1, kernel 2.6.24-16-generic (recovery mode)
title           Ubuntu 8.04.1, memtest86+
ben@akira:~$ sudo aptitude remove linux-image-2.6.24-16-generic
[sudo] password for ben: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Initialising package states... Done
Writing extended state information... Done
Building tag database... Done             
The following packages are BROKEN:
  linux-restricted-modules-2.6.24-16-generic linux-ubuntu-modules-2.6.24-16-generic 
The following packages are unused and will be REMOVED:
  gimp-help-common gimp-help-en iamerican ibritish ispell myspell-en-gb myspell-en-us 
  myspell-en-za wamerican wbritish 
The following packages have been automatically kept back:
  language-pack-en-base language-pack-gnome-en-base libdns35 libfreetype6 libicu-dev libpq5 
  linux-libc-dev linux-restricted-modules-common xserver-xorg-video-ati 
  xserver-xorg-video-intel 
The following packages have been kept back:
  acpi-support acpid apparmor apparmor-utils apport apport-gtk apt apt-utils base-files 
  bind9-host bsdutils console-setup cupsys cupsys-bsd cupsys-client cupsys-common dash dnsutils 
  doc-base evolution-data-server evolution-data-server-common firefox firefox-3.0 
  firefox-3.0-gnome-support firefox-gnome-support flashplugin-nonfree gedit gedit-common 
  ghostscript ghostscript-x gksu gnome-power-manager gnome-system-tools gparted 
  gstreamer0.10-plugins-good guidance-backends gvfs gvfs-backends gvfs-fuse hal-info 
  initscripts jockey-common jockey-gtk language-pack-en language-pack-gnome-en libbind9-30 
  libcamel1.2-11 libcupsimage2 libcupsys2 libcurl3 libcurl3-gnutls libebook1.2-9 libecal1.2-7 
  libedata-book1.2-2 libedata-cal1.2-6 libedataserver1.2-9 libedataserverui1.2-8 
  libegroupwise1.2-13 libexchange-storage1.2-3 libfreetype6-dev libgdata-google1.2-1 
  libgdata1.2-1 libglib2.0-0 libgs8 libgvfscommon0 libicu38 libisc35 libisccc30 libisccfg30 
  libjasper1 libkrb53 liblcms1 libldap-2.4-2 liblwres30 libnm-glib0 libnm-util0 libnss3-1d 
  libntfs-3g23 libpango1.0-0 libpango1.0-common libperl5.8 libpng12-0 libpoppler-glib2 
  libpoppler2 libpurple0 libsndfile1 libssl0.9.8 libvolume-id0 libwmf0.2-7 linux-generic 
  linux-headers-generic linux-image-generic linux-restricted-modules-generic mount mplayer 
  mplayer-doc nautilus-share network-manager network-manager-gnome ntfs-3g ntp ntpdate 
  nvidia-glx-new openssl perl perl-base perl-modules pidgin pidgin-data poppler-utils 
  python-apport python-apt python-gobject python-problem-report readahead sudo sysv-rc 
  sysvutils tasksel tasksel-data totem totem-common totem-gstreamer totem-mozilla totem-plugins 
  tzdata udev ufw update-manager update-manager-core util-linux util-linux-locales vim-common 
  vim-tiny xfonts-scalable xterm xulrunner-1.9 xulrunner-1.9-gnome-support 
The following packages will be REMOVED:
  linux-image-2.6.24-16-generic 
0 packages upgraded, 0 newly installed, 11 to remove and 148 not upgraded.
Need to get 0B of archives. After unpacking 119MB will be freed.
The following packages have unmet dependencies:
  linux-restricted-modules-2.6.24-16-generic: Depends: linux-image-2.6.24-16-generic but it is not i
nstallable
  linux-ubuntu-modules-2.6.24-16-generic: Depends: linux-image-2.6.24-16-generic but it is not insta
llable
Resolving dependencies...
The following actions will resolve these dependencies:

Remove the following packages:
linux-restricted-modules-2.6.24-16-generic
linux-ubuntu-modules-2.6.24-16-generic

Score is 188

Accept this solution? [Y/n/q/?] Y
The following packages are unused and will be REMOVED:
  gimp-help-common gimp-help-en iamerican ibritish ispell myspell-en-gb myspell-en-us 
  myspell-en-za wamerican wbritish 
The following packages have been automatically kept back:
[...]
The following packages will be automatically REMOVED:
  linux-restricted-modules-2.6.24-16-generic linux-ubuntu-modules-2.6.24-16-generic
The following packages have been kept back:
[...]
The following packages will be REMOVED:
  linux-image-2.6.24-16-generic linux-restricted-modules-2.6.24-16-generic 
  linux-ubuntu-modules-2.6.24-16-generic 
0 packages upgraded, 0 newly installed, 13 to remove and 148 not upgraded.
Need to get 0B of archives. After unpacking 190MB will be freed.
Do you want to continue? [Y/n/?] Y
Writing extended state information... Done
(Reading database ... 164577 files and directories currently installed.)
Removing gimp-help-en ...
Removing gimp-help-common ...
Removing ibritish ...
Removing linux-restricted-modules-2.6.24-16-generic ...
Removing linux-ubuntu-modules-2.6.24-16-generic ...
update-initramfs: Generating /boot/initrd.img-2.6.24-16-generic
Removing linux-image-2.6.24-16-generic ...
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.24-22-generic
Found kernel: /vmlinuz-2.6.24-21-generic
Found kernel: /vmlinuz-2.6.24-19-generic
Found kernel: /memtest86+.bin
Replacing config file /var/run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done

Removing myspell-en-gb ...
Updating OpenOffice.org's dictionary list... done.
Removing myspell-en-us ...
Updating OpenOffice.org's dictionary list... done.
Removing myspell-en-za ...
Updating OpenOffice.org's dictionary list... done.
Removing wamerican ...
Removing wbritish ...
/usr/sbin/update-default-wordlist No wordlist elements installed.
/usr/sbin/update-default-wordlist No wordlist elements installed.
Removing ispell ...
Removing iamerican ...
/usr/sbin/update-default-ispell No ispell elements installed.
/usr/sbin/update-default-ispell No ispell elements installed.
Reading package lists... Done             
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initialising package states... Done
Writing extended state information... Done
Building tag database... Done   

The extra uninstalls were fallout from upgrading OpenOffice. Missed a bit ..

ben@akira:~$ aptitude search linux | grep ^i | grep '2.6.24-16'
i   linux-headers-2.6.24-16         - Header files related to Linux kernel versi
i   linux-headers-2.6.24-16-generic - Linux kernel headers for version 2.6.24 on
ben@akira:~$ sudo aptitude remove linux-headers-2.6.24-16 linux-headers-2.6.24-16-generic
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initialising package states... Done
Building tag database... Done      
The following packages have been automatically kept back:
[...]
The following packages have been kept back:
[...]
The following packages will be REMOVED:
  linux-headers-2.6.24-16 linux-headers-2.6.24-16-generic 
0 packages upgraded, 0 newly installed, 2 to remove and 148 not upgraded.
Need to get 0B of archives. After unpacking 68.2MB will be freed.
Writing extended state information... Done
(Reading database ... 160067 files and directories currently installed.)
Removing linux-headers-2.6.24-16-generic ...
Removing linux-headers-2.6.24-16 ...
Reading package lists... Done             
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initialising package states... Done
Writing extended state information... Done
Building tag database... Done             

ben@akira:~$ sudo aptitude remove \
linux-image-2.6.24-19-generic \
linux-headers-2.6.24-19 \
linux-headers-2.6.24-19-generic
ben@akira:~$ sudo aptitude remove linux-image-2.6.24-21-generic
[...]
Resolving dependencies...
The following actions will resolve these dependencies:

Remove the following packages:
linux-restricted-modules-2.6.24-19-generic
linux-ubuntu-modules-2.6.24-19-generic

Score is 188
[...]
The following packages will be automatically REMOVED:
  linux-restricted-modules-2.6.24-19-generic linux-ubuntu-modules-2.6.24-19-generic 
[...]
The following packages will be REMOVED:
  linux-headers-2.6.24-19 linux-headers-2.6.24-19-generic linux-image-2.6.24-19-generic 
  linux-restricted-modules-2.6.24-19-generic linux-ubuntu-modules-2.6.24-19-generic 
0 packages upgraded, 0 newly installed, 5 to remove and 148 not upgraded.
Need to get 0B of archives. After unpacking 216MB will be freed.
[...]
ben@akira:~$ sudo aptitude remove \
linux-headers-2.6.24-21 \
linux-headers-2.6.24-21-generic \
linux-image-2.6.24-21-generic
[...]
The following packages will be REMOVED:
  linux-headers-2.6.24-21 linux-headers-2.6.24-21-generic linux-image-2.6.24-21-generic 
  linux-restricted-modules-2.6.24-21-generic linux-ubuntu-modules-2.6.24-21-generic 
0 packages upgraded, 0 newly installed, 5 to remove and 148 not upgraded.
Need to get 0B of archives. After unpacking 217MB will be freed.
[...]
Removing linux-headers-2.6.24-21-generic ...
Removing linux-headers-2.6.24-21 ...
Removing linux-restricted-modules-2.6.24-21-generic ...
Removing linux-ubuntu-modules-2.6.24-21-generic ...
update-initramfs: Generating /boot/initrd.img-2.6.24-21-generic
Removing linux-image-2.6.24-21-generic ...
Running postrm hook script /sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.24-22-generic
Found kernel: /memtest86+.bin
Replacing config file /var/run/grub/menu.lst with new version
Updating /boot/grub/menu.lst ... done

The link /vmlinuz.old is a damaged link
Removing symbolic link vmlinuz.old 
 you may need to re-run your boot loader[grub]
The link /initrd.img.old is a damaged link
Removing symbolic link initrd.img.old 
 you may need to re-run your boot loader[grub]

Printed and hosted by Prater Raines Ltd, 98 Sandgate High Street, Folkestone CT20 3BY.
Published and promoted by Ben Prescott, 14, St James's Square, Bournemouth, BH5 2BX. All rights reserved.
The views expressed are solely those of the author, not of the service provider.