Update packages to most recent releases
(if using debian stable there may be only a few new releases and only ones with security patches)
sudo apt-get update && sudo apt-get upgrade
But safest way to upgrade, that will overcome any dependency problems, would be to use:
sudo aptitude upgrade --full-resolver
if your sources list is correct (on the debian release you are sticking with) you can run this for a real full upgrade (with -s option to simulate if you like)
sudo apt-get dist-upgrade
Debian stable security releases
If you want to keep your debian system up to date with security patches (released as updated packages) make sure you have these lines in your /etc/apt/sources.list
deb http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ wheezy-updates main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
deb-src http://security.debian.org/ wheezy/updates main contrib non-free
and run the first line above to update package lists and upgrade packages
Update to a new debian release
First change your sources list to point to the release you want to upgrade to
sudo nano /etc/apt/sources.list
Check your apt.conf file isn't pointing to your current release, for example it might say
mine doesn't after using netinstall CD. If it does remove that line or change it..
sudo nano /etc/apt/apt.conf
sudo apt-get update
sudo apt-get dist-upgrade
and that can be simulated first with
sudo apt-get -s dist-upgradebut it is probably much better to do this booted into recovery mode so that many daemons and drivers are not loaded.
so first you can download the packages needed withsudo apt-get update && sudo apt-get --download-only dist-upgrade
then boot into recovery mode and run
sudo apt-get dist-upgrade
Aptitude can be used with
sudo aptitude full-upgrade
-this command replaces "aptitude dist-upgrade" - it will present solutions to conflicts, and ask confirmation before downloading
It can be simulated first with
sudo aptitude --simulate full-upgrade
sudo aptitude --simulate full-upgrade > ~/upgrade.txt (to put the result into a text file in home)
You could try the apt-get dist-upgrade way first, and see if its all plain-sailing or not.... but if APT is asking you to remove like about half of your system, because of breakages, then you had better think wisely.
Next, try the aptitude way, as it will offer perhaps a better solution - removing some but not so many packages, which can be reinstalled later on (if they are needed or exist in the release - note that some packages are obsoleted and replaced with one of different name).
I upgraded just now and there were quite a few packages to be removed by aptitude dist-upgrade, so I ran through the ones I though were important (many lib's will have different names) at Debian packages, and I only found a few that will need re-installing.
Caution! If you (by mistake) use the apt-get command "upgrade" after changing your sources file, and actually you are intending to upgrade to another release, apt will not actually upgrade to the new release but will only update your installed packages from the new release -and you will get an irreparable mix of packages from different releases.
For example, if you are stable and you do an upgrade with packages from testing, you will get a mixed install of both stable and testing - and then trying to dist-upgrade, you will have hundreds of packages held back, unable to install because of countless dependency problems.
If you did that, you can revert to stable in sources and do an apt-get update, apt-get upgrade, to revert to stable install, and then change sources to testing again, update lists and do a dist-upgrade.
The plain "upgrade" command will not add any new packages or remove unneeded ones -which is necessary when upgrading to another release.
Upgrading to Jessie without installing systemd
su to root then make this apt conf file with
echo -e 'Package: systemd\nPin: origin ""\nPin-Priority: -100' > /etc/apt/preferences.d/systemd
You may also need to deny "upstart" (ubuntu's startup daemon) from installing as well
echo -e '\nPackage: upstart\nPin: origin ""\nPin-Priority: -100' >> /etc/apt/preferences.d/systemd
then run a dist upgrade with the simulate option to check what will install - and aptitude should be used
note that policykit-1 will not install because it depends on libpam-systemd! This means there may be some errors on startup, hotplugging media will not work (mounting) and there will be no shutdown/reboot option on the logout menu! (this is so with LXDE, as the update removes lxsession, lxpolkit)
To get around these problems, I use a power-off script with a yad dialogue, udevil disk management (see my plain OB page), and to prevent the dbus error messages on media insert, turn off the auto-mounting in pcmanfm preferences.
But we might not have the pleasure of choosing sysvinit over systemd for much longer, with Debian, who knows? If we can't carry on without switching to systemd, then our other choices are... Devuan, or Slackware, which continues to be systemd-free (that's not a package name!)
See my Devuan page!
Using backports to update packages
You may want to stay with Wheezy (while Jessie is still in its early testing life) and give backports a go, which is a way of adding updated packages to your stable debian.
The backports sources list entry looks like
deb http://ftp.debian.org/debian/ wheezy-backports main
check to see if your packages are available in wheezy-backports by doing a search at packages.debian.org
update apt cache and then install a package from backports with
sudo apt-get -t wheezy-backports install <package>
Upgrading the kernel
This may be useful (or necessary) when you have hardware that needs latest drivers or to get hot-keys functioning.
Install the pae kernel for newer computers
Install from stable backports
Install from Testing on Stable - note that this method may install quite a lot of packages from testing and you could end up with a mixed distro Debian.
Install newer kernel after upgrade to Jessie
Wheezy to Jessie
Packages needing re-install after upgrade:
ln -s libdvdnav.so.4.1.2 libdvdnavmini.so.4
Squeeze to Wheezy
so you need to terminal: su and root p/w
cursor down after the line Defaults env_reset
highlight this line here and middle mouse button in the terminal to paste it:
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"then CTRL-X, y and Enter