Upgrading Your linux Distribution mini-HOWTO
Greg Louis
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
Copyright © 1996, 2002 by Dynamicro Consulting Limited
- Table of Contents
- 1. IMPORTANT!!! Disclaimer and Copyright
- 2. Changes since version 1.1
- 3. Introduction
- 4. Write down everything you do.
- 5. Make a full backup of the existing system.
- 6. Back up /etc and its subdirectories on one or more floppies.
- 7. Make separate backups of each group of files you want to preserve.
- 8. Prepare root and boot floppies for the new installation.
- 9. Format floppies for the temporary kernel and the final build.
- 10. Inhibit logins and back up the /root and /home trees.
- 11. Boot from the new installation's boot and root floppies.
- 12. Delete the linux partitions with fdisk and recreate them.
- 13. Run the new linux installation.
- 14. Restore configuration data to the /etc directory and subdirectories.
- 15. Configure and rebuild the linux kernel.
- 16. Restore the stuff from the backups you made earlier.
- 17. Review security.
- 18. Enable logins.
- 19. Sorry, but once again: USE THIS INFORMATION AT YOUR OWN RISK!
- 20. Acknowledgements
2. Changes since version 1.1
-
Converted to docbook
-
Corrected some obsolete information
-
Added this history section
-
Added Zoltán Hidvégi's suggestion re mtime and ctime. Thanks, Zoltán!
-
Added an Acknowledgements section
3. Introduction
3.1. How to slay and reincarnate your linux box!
Don't take it as gospel, though: your mileage will almost certainly vary. Even the directory names in this document may be different from the ones you need to use; some people have /usr/home instead of /home, for example; others call it /u, and some (delicate shudder :) even put all their users directly under /usr itself! I can't be specific about your system, so I've just used the names the way they are in mine.
You'll also notice that I use Slackware distributions, and that I assume you've enough RAM and hard disk space to install linux kernel source and build your own kernel. If your system is different, some of my recommendations won't apply; but I hope you'll still find the general outline to be of assistance in your rebuild project.
3.2. Why would anyone want to do that?
(These examples are a bit dated, but they serve to illustrate my point:)
For example, I installed a 4Gb hard disk and then found out that Slackware 2.0 vintage linux didn't know a hard disk could have more than 2Gb, and it got horribly confused. So I had to upgrade to the then-current Slackware 2.3. That upgrade was a gruelling experience, and it's part of the reason I'm writing these notes. I did just about everything wrong, and only good luck and the fact that I had another running linux box beside me saved me from disaster.
As another example, I found that I just couldn't succeed in building a working a.out linux kernel in the 1.3 series, using an out-of-the-box Slackware 2.3 installation (another machine, not the one I botched before). I took the plunge, bought Slackware 3.0 on CDROM and converted to ELF. This time the reinstallation went better, thanks in part to the previous bitter experience, and it served as the source of most of the ideas I'm offering you here.
3.3. Do you have to ``destroy and reinstall?''
The latter is safer, oddly enough. If you install over top of an existing linux system, chances are you'll have a mixture of old and new binaries, old and new configuration files, and generally a mess to try to administer. Wiping the system clean, and then putting back only what you know you need, is a drastic but effective way to get a clean result. (Of course we're talking about installing a whole new linux distribution here, not about upgrading one or two packages! The best way to avoid having to do a full reinstallation is, precisely, to keep the individual bits -- especially gcc and its libraries, and binutils -- current. If the stuff you use is reasonably up-to-date, and you can keep it so by bringing in, and if need be compiling, new code from time to time, then there's no need for a mass upgrade.)
3.4. How long will it take?
Those were the bad old days. Now, with faster disks and faster machines and CD writers, things go better. My notebook was stolen in December, 2002, and when the new one came, I was up and pretty near complete -- despite having lost the old system without the chance to save the latest changes -- after about seven hours of effort.
So much for the introduction. Here's how to set about it, once you've decided it must be done. Arm yourself with fortitude and Jolt or whatever, and:
5. Make a full backup of the existing system.
Why then should you start with a full backup? Two basic reasons: first, in the event of a catastrophic failure installing the new system, you'll have a way to get back to the starting point with minimum pain. Second, no matter how carefully you prepare for the new installation, there is a very large chance that one or two important files will be overlooked. In that case the clumsiness of restoring those one or two files from the full backup set will be preferable to the inconvenience of doing without them.
To save time and space, if you've still got the distribution medium for your old linux version, you might want to back up only those files the mtime or ctime of which is more recent than the date of the original installation.
7. Make separate backups of each group of files you want to preserve.
-
files that aren't part of your standard linux installation, or
-
files that are actually newer than the ones you'll install when you do your new linux installation.
and separate out only those files that you want to carry over.
(Another possible strategy is to back up all files with mtime or ctime more recent than the day of the previous linux installation, as mentioned above, and then restore from that. If you do that, you have to take into account that the new linux distribution may contain versions of some files that are newer still than the ones you saved.)
In my case, I ended up making a .tgz file on the backup medium for each of
-
/usr/lib/rn
-
/usr/lib/smail
-
/usr/lib/trn (the rest of /usr/lib would be reinstalled)
-
/usr/local/src
-
/usr/local/bin
-
/usr/local/lib
-
/usr/local/lpfont
-
/usr/local/man
-
/usr/local/sbin
-
/usr/local/thot (there were other /usr/local files I didn't need)
-
/usr/openwin
-
/usr/src/lilo-17 (because my new Slackware still had version 16)
-
/usr/src/linux-1.2.13 (because I'd done some customizing)
-
/usr/X11R6/lib/X11/app-defaults
-
/usr/X11R6/lib/X11/initrc (the rest of Xfree86 was to be reinstalled)
-
/var/named
-
/var/openwin
-
/var/texfonts
My machine was relatively easy in that there were no spool files to worry about. I don't run a news spool on this box, and since there are only two users, it was easiest just to get all the mail read before shutting down. Otherwise, /var/spool directories would have had to be backed up at the last minute. (And, of course, the news library and site directories!)
9. Format floppies for the temporary kernel and the final build.
You'll need two, one floppy for each.
After all that's done, you're ready for the Big Moment. The next step removes the system from production.
11. Boot from the new installation's boot and root floppies.
Or, if you have that capability, boot the installation CD itself.
13. Run the new linux installation.
Along the way, be sure to make a floppy that you can boot as well, since the kernel that the linux setup installs has to be replaced and accidents can happen during that process. Be sure to install the development packages and the kernel source.
15. Configure and rebuild the linux kernel.
Install the rebuilt kernel on a floppy at first; once that boots ok, install on the hard disk, run lilo if you're using it, and reboot.
17. Review security.
Check file permissions and directory permissions to be sure that access is neither too restricted nor too easy. I find that Slackware tends to lean toward a more open environment than I like, so I go around changing 755's to 711's for binaries in the .../bin directories and stuff like that. Or even 700's in the .../sbin ones. Especial care is needed if you've carried over ftp, telnet or web servers; but then, if you were running those, you probably thought of that already. :)
Look at /etc/inetd.conf or /etc/xinetd.conf and make sure you're not running any Internet services you don't need to. Also go through the boot scripts in /etc/rc.d and friends for the same purpose. Check your firewall rules if your box is an Internet gateway or has Internet access.





Comments
Subscribe to Comments Feed