[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a cautionary tale w/ successful recovery



On 20091103_114547, Boyd Stephen Smith Jr. wrote:
> On Tuesday 03 November 2009 10:38:41 Johannes Wiedersich wrote:
> > Andrew Sackville-West wrote:
> > > On Sun, Nov 01, 2009 at 07:08:00PM -0500, Andrew Reid wrote:
> > >>   For the sysems I back up at work, we do the dpkg --get-selections
> > >> thing, but I've never kept a copy of the boot sector -- that's an
> > >> excellent idea.
> >
> > I guess the 'state of the art' way of recording a list of installed
> > packages, nowadays is
> >
> > # aptitude -F "%p" search '~i!~M' > package-list
> >
> > You can then just install like
> >
> > # aptitude install $(cat pacage-list)
> >
> > dpkg --get-selections does not distinguish between packages installed
> > manually or automatically, so that information is lost on the reinstall.
> >  The search pattern just looks for packages that were installed
> > manually. The install will automatically install all dependencies.
> 
> However, because of OR dependencies (i.e. using the '|' character), it might 
> install *different* packages to satisfy dependencies.  Your saved 
> configuration files won't work with those packages.
> 
> Some combination of dpkg --get-selections and aptitude search '~M' should be 
> able to save both "all installed packages" and "all automatically installed 
> packages", and some combination of dpkg --set-selections, aptitude markauto, 
> and aptitude install should be able to restore them.

My suggestion is:

# aptitude -F "%p %M" search '~i' |tr -s ' '|sed 's/ A$/+M/' > package-list

followed by (without change except for fixing the missing "k" ;-) 

# aptitude install $(cat package-list)

I haven't actually tested this. It is just what I think would work
from reading the aptitude documentation. By later today I may be able
to do some tests without trashing one of my systems. The theory is
that aptitude install understands that appending '+M' to a package
name is an indication that it is to mark the package as having been
installed to satisfy a dependency. The rest of the magic incantation
follows.

Question: Where would be a good place for the file, package-list,
within the Debian way? In /etc/apt/ ? Or /var/backups/ ? Elsewhere?

-- 
Paul E Condon           
pecondon@mesanetworks.net


Reply to: