On 2009-03-27_13:53:14, green wrote: > Paul E Condon wrote at 2009-03-27 09:26 -0600: > > Now, the discussion has moved to how to query the packaging system to > > get the most useful file of information. I'm still not sure what the > > query string should be. > > Restoring the package set is not so simple as restoring the packages that are > manually selected as installed. There are at least these reasons:
I had not thought it possible to do an automatic total restore. What I was hoping for was a reliable list of installed packages that would be a guide to a manual restore that did not leave out anything that turned out to be important to me. But you seem to be onto something much more than I hoped for. > > - virtual packages or 'OR' dependencies > Package 'ilohamail' depends on 'postfix | mail-transport-agent' so package > 'exim4' (or another mail server) may be set as automatically installed. If a > list of manually installed packages is used, aptitude may select 'postfix' > instead of 'exim4' to satisfy that dependency. > > - 'recommends' dependencies > That some package 'ilohamail' recommends 'gnupg' and 'aspell'. The user has > the option of using that or not, and aptitude has a config option for it too. > > If the user allows 'aspell' to be installed automatically, then it may or not > be installed when a list of manually installed packages is used, depending on > the user of the -r or -R flags. Either way, either a package is installed > automatically that was not before, or a package is not installed that was > before. > > > So, one must do backups slightly differently. Here are the commands that I > use: > > # Save aptitude state bundle > aptitude-create-state-bundle state.tar.bz2 > # Save a list of all installed packages > aptitude -F "%?p" --disable-columns search \~i >| installed-all > # Save a list of all installed packages with their versions > aptitude -F "%?p=%?V" --disable-columns search \~i >| installed-all-ver > # Save a list of all automatically installed packages > aptitude -F "%?p" --disable-columns search \~i\~M >| installed-auto > > > Here are the commands I have saved for restoring from the aforementioned > backups: > > # Install all essential, important, required, or standard packages > aptitude -R --schedule-only install $( aptitude -F "%?p" search > \!\~i?or(\~E,\~pimportant,\~prequired,\~pstandard) ) > # Mark as manually installed all essential, important, required, or standard > priority packages > aptitude -R --schedule-only unmarkauto $( aptitude -F "%?p" search > \~i?or(\~E,\~pimportant,\~prequired,\~pstandard) ) > # Mark as automatically installed all packages that are not essential, > important, required, or standard priority > aptitude --schedule-only markauto $( aptitude -F "%?p" search > \~i\!\~E\!\~pimportant\!\~prequired\!\~pstandard ) > # Install all the packages in the installed package list (manual + automatic) > aptitude -R --schedule-only install $( cat installed-all ) > # Select specific versions of packages (you may want to skip this step) > aptitude -R --schedule-only install $( cat installed-all-ver ) > # Mark as automatically installed all packages in that list > aptitude --schedule-only markauto $( cat installed-auto ) > # Run aptitude, check scheduled actions, and apply > aptitude > It will take me a while to understand your process steps, but this really looks interesting. Give me some time to absorb it. Thanks > > I think I have minimally tested these commands, but it has been a while. It > would be great if someone could try this out and add a wiki page for it. Well, I'm going to try it out, I can't promise a wiki that anyone would care to look at. We'll see how it goes... > > > Of course, it would likely help to restore a /etc/apt backup before doing any > of the restore commands. Obviously a different sources.list would cause > problems. In my idea of a good backup, I take a complete copy of all of /etc, so I already am getting all of /etc/apt, as well as my exim4 configs, and all the other stuff for which it is easy to forget the details under the pressure of a disaster recovery situation. So /etc/apt seemed a natural place to put the selections, but Andrei has another good idea. > > Lastly, I don't think it is possible to restore the package set perfectly if > much time has passed between the backup and the restore, because of changes > in > package versions; the more time passes, the more the package set will have to > change for a restore. This is why I have added the backup command that saves > the versions for all installed packages. The only way to get around this is > to > have a backup of debs for ALL installed packages. > I think you are too demanding. Your standards of automation are too high. When I think of an automatic restore, I think of it being a situation where my system was distroyed or corrupted while I was away from home. The time lapse from the last time the system was working properly (and the last backup was made) until I try to restore is a few hours to a few months. In the case of a few months, I might not want an exact restore because there might have been security fixes released that I would want to include in the new system. -- Paul E Condon pecon...@mesanetworks.net -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org