Yesterday, at work, I realized that one of our main Linux servers desperately needed to be upgraded. It was still running Sarge (Debian v3.1) which is so old that the package mirrors no longer support it. Since Lenny is going to be released before too long and it has fewer bugs than the current stable release (Etch) I decided to make the jump to Lenny. Point 9 has a useful tip that may be obvious to more experienced Debian users.
- Changed the sources.list file to point to the Lenny repository and used ‘apt-get -d dist-upgrade’ to download all of the packages before the time I was scheduled to shut the web server off.
- Ran ‘apt-get dist-upgrade’.
- Tried various things to get the packages to work. ‘apt-get -f install’ brought me various levels of success. Some packages just reported failure, but without explanation.
- Found out that upgrading straight from Sarge to Lenny is not necessarily a good idea.
- No network services, including SSH will start. My existing SSH connection is my lifeline.
- Changed the sources.list file to point to Etch. Ran the upgrade again.
- Some packages fail, like “subversion” so I remove them, planning to reinstall when the upgrade was done.
- Some more packages fail and hold up any installs/removals/upgrades that I attempt. I discover that in the install scripts that come with Debian packages, they are set to fail silently, not giving you any error messages. If you go to /var/lib/dpkg/info/, you’ll find that every package has scripts with extensions like “.postinst”. If one of these fails during installation, it’ll just crap out. Go in and change “#!/bin/sh -e” to #!/bin/sh” or remove the line that says “set -e”. The next time you run the install, you’ll find out exactly what is going wrong and you should be able to fix it.
- Get almost everything to work properly. A few packages are still being jerks, but they aren’t holding anything up, so I switch back to the Lenny repository.
- Run dist-upgrade one more time.
- Everything works perfectly.
- Except one thing: In Sarge, I used php4-sybase and the sybase_ functions to connect to both Sybase and MSSQL servers in PHP. This simply would not work in Lenny and PHP5. In fact, it errored out saying that it couldn’t find sybase_connect(), even though Debian insisted that php5-sybase was installed. It also would not install php5-mssql, as it said php5-sybase was what you had to use. On a whim, I tried changing to the mssql_ functions in PHP and it worked pefectly. Weird. The actual database functions were only called in abstraction through PEAR::DB, though, so a few database connection settings had to be changed in some include files and then everything switched over smoothly.
The moral of the story? Keep your Linux installs up to date or the eventual necessary upgrades are going to be a pain.