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

Re: dpkg --clear-selections seems to empty most of the packages on my system ugh



Mitchell Laks wrote:
> Zenaan Harkness wrote:
> > By using a set of system-default packages from XX years ago, it is
> > likely you will face the types of problems you have faced above.

Yes.  Most definitely.

> > Then 2) add packages. And here's where for you, by the sound of it,
> > it's been a few years, it might take a few hours of trying to run the
> > things you want on your server, and discovering what you have to
> > install to do that.
> > 
> > Keep that list of names of things you've installed.

I do the opposite.  I start off with nothing installed.  Then I
install things that I need as I go along.  Try to use 'less file' and
it says less not found?  'apt-get install less'.  Starting up the web
server?  'apt-get install apache2'.  Using a database?  'apt-get
install ...' and so forth.  You will end up with a cleaner system that
way and everything will work just as you intend it.  When everything
is a simple 'sudo apt-get install ...' away it is no hardship at all
to install what is needed as you need it.

> I guess I was looking for a  up to date tutorial on 
> how 
> dpkg --get-selections 
> dpkg --set-selections

The problem with dpkg --get-selections is that it is more than just
apache2.  

  $ apt-cache show apache2 |grep Depends:
  Depends: lsb-base, procps, perl, mime-support, apache2-bin (= 2.4.4-2), apache2-data (= 2.4.4-2)
  Depends: apache2-mpm-worker (= 2.2.22-13) | apache2-mpm-prefork (= 2.2.22-13) | apache2-mpm-event (= 2.2.22-13) | apache2-mpm-itk (= 2.2.22-13), apache2.2-common (= 2.2.22-13)

It is apache2 plus all of the dependencies.  Plus all of the
dependencies of everything under them.  If you are running Stable and
making a copy of Stable then both the template and the copy will have
the same versions of everything.  But over time all of the names
change just as you found.  So you don't want the names of packages
that you have installed.  You want the names of the top level packages
for things you want installed.  Things like apache2 and not
apache2-mpm-worker.

Debian now also has a concept of whether something was installed as a
dependency or installed by request.  Then later if you remove a top
level package and an dependency is no longer needed then 'apt-get
autoremove' can be used to clean up the lint.  If you simply install
the long list of everything that is installed elsewhere then all of
the packages will be marked as manually installed and then none of
them will be offered for automatic removal.  See the man page for
'apt-mark' for an interface to this.  You could always mark everything
auto and then mark just what you want to keep as manual.

  man apt-mark

> and 
> apt-get dselect-upgrade 
> is supposed to work and 

That should still work the same as it always did.  With the problems I
mentioned above.  But dselect is the quite old interface now.

> in particular what is the role of
> clear-selections
> which when i did it and then looked at the output of 
> dpkg --get-selections >see-what-is-set-now
> 
> showed me most of my packages ready to be zapped.

Right.  That is what --clear-selections does.  It marks everything as
deinstall.  The idea is that you would start with everything cleared
with --clear-selections and then using --set-selections would set just
the ones you want to keep.  Clear then set what you want.

> I then converted all of the remove to install and it still removed
> the whole system which i found amusing.

If you really changed them to install then it would not have removed
them.  Something else must have happened too.

> in the past i used this
> http://panuganty.tripod.com/debiantips/packaging.htm
> but it seems out of date

That is a little out of date.  I didn't see anything that was wrong or
would no longer work.  Most things should still work because Debian
doesn't egregiously break interfaces.  But many things have better
ways of doing them now.  For example instead of doing:

  apt-get -d $package 
  cd /var/cache/apt/archives 
  dpkg -i $package

You can do:

  apt-get install --reinstall $package

Just for example.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: