When working with Ubuntu 8.04 LTS (Hardy Heron), you'll often encounter this scenario:
$ sudo apt-get upgrade
Reading package lists... Done
The following packages have been kept back:
apache2 mysql-server php5
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
This indicates that while updates exist for these packages, they're being held back due to dependency constraints that apt-get upgrade
won't automatically resolve.
The key differences between these commands:
# Standard upgrade (safe)
sudo apt-get update && sudo apt-get upgrade
# Distribution upgrade (more aggressive)
sudo apt-get update && sudo apt-get dist-upgrade
- upgrade: Only upgrades existing packages without installing/removing dependencies
- dist-upgrade: Smartly handles dependency changes, may add/remove packages
For your specific concern about Ubuntu 8.04 LTS:
# Check current release
lsb_release -a
Using dist-upgrade
won't automatically upgrade you to 8.10 (Intrepid Ibex) because:
- LTS releases have separate repositories
- You'd need to explicitly change your
/etc/apt/sources.list
- LTS-to-LTS upgrades require different commands (
do-release-upgrade
)
Before running dist-upgrade
on a production server:
# 1. Check what would change
sudo apt-get -s dist-upgrade
# 2. Create a snapshot if using virtualization
# 3. Check for held packages
apt-mark showhold
# 4. Review important config files
sudo apt-get -o Debug::pkgProblemResolver=yes dist-upgrade
Here's how we recently handled a kept-back MySQL package:
# Initial state
$ apt-cache policy mysql-server
mysql-server:
Installed: 5.0.51a-3ubuntu5.4
Candidate: 5.0.51a-3ubuntu5.6
Version table:
5.0.51a-3ubuntu5.6 0
500 http://archive.ubuntu.com hardy-updates/main Packages
500 http://security.ubuntu.com hardy-security/main Packages
*** 5.0.51a-3ubuntu5.4 0
100 /var/lib/dpkg/status
# Safe upgrade approach
$ sudo apt-get install mysql-server=5.0.51a-3ubuntu5.6
Instead of immediately jumping to dist-upgrade
, consider:
# Option 1: Install specific versions
sudo apt-get install package=version
# Option 2: Use aptitude (often handles dependencies better)
sudo aptitude safe-upgrade
# Option 3: Temporary ignore dependencies
sudo apt-get -o Dpkg::Options::="--force-overwrite" upgrade
Always verify after major updates:
# Check services
sudo service --status-all
# Verify config files
sudo dpkg --verify
# Review changed files
sudo apt-get install debian-goodies
sudo debchanges -a
When managing an Ubuntu 8.04 LTS server, you might encounter this common scenario:
$ sudo apt-get upgrade
Reading package lists... Done
The following packages have been kept back:
libapache2-mod-php5 mysql-server-5.0
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
The key distinction between regular upgrades and dist-upgrade:
apt-get upgrade
: Updates existing packages without changing distribution versionapt-get dist-upgrade
: Handles dependencies and may install/remove packages
For a controlled approach:
# First check what would change
$ sudo apt-get -s dist-upgrade
# Then perform the actual upgrade
$ sudo apt-get dist-upgrade
For mission-critical systems:
# Create a snapshot of current package states
$ sudo apt-get install debconf-utils
$ sudo debconf-get-selections > debconf-selections-backup.txt
$ dpkg --get-selections > dpkg-selections-backup.txt
# Review changed dependencies
$ apt-cache policy [package-name]
$ apt-cache depends [package-name]
Essential checks after upgrading kept-back packages:
# Verify successful upgrades
$ dpkg -l | grep -i [package-name]
# Check service status
$ sudo service --status-all
# Review config file changes
$ sudo dpkg --configure -a