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

Re: Apt database screwed up.



Tim Uckun wrote:

> > Something went horribly wrong I think I might have hit the wrong key on 
> > deselect but whenever I quit dselect it wants to remove about 270 packages 
> > and hold three of them. Is there a way to rebuild the package database?

You need to get your selections back to a sane state, sane meaning
dselect thinks you want to keep everything that's currently installed
installed, and keep everything that's currently not installed not
installed.  You can either use dselect (operating on sets of packages
instead of individual packages), or run these commands (warning! amateur
alert! there may be a much easier way to do this! for all I know this
will make your computer explode!):

for pkg in `dpkg-awk "Status:.* installed$" -- Package \
 | grep -v '^$' | sed 's/^Package: //'`; do echo $pkg install ; done \
 | dpkg --set-selections

for pkg in `dpkg-awk "Status:.* not-installed$" -- Package \
 | grep -v '^$' | sed 's/^Package: //'`; do echo $pkg purge ; done \
 | dpkg --set-selections

Then enter dselect and see what happens.  If it still wants to remove a
lot of packages then you have a dependency problem that you'll have to
resolve on your own.  Luckily dselect gives you all the necessary
information to resolve such situations (in the Select interface).

Neil Schemenauer wrote:

> I don't think rebuilding is necessary.  The way I use dselect is
> to set everything to hold.  One way to quickly do this is to run
> these commands as root:
> 
>     $ dpkg --get-selections > s
>     $ awk '{print $1, "hold"}' < s > s2
>     $ dpkg --set-selections s2

And if you're using dselect, you can always hit "=" when the cursor
is over the "Up to date installed packages" line.  But keeping all
your packages on hold all the time is pretty drastic and IMHO is
unnecessarily cautious.



Reply to: