Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #262144

Re: How can I find packages manually installed using "dpkg -i"?

From Mike Castle <dalgoda+debian@gmail.com>
Newsgroups linux.debian.user
Subject Re: How can I find packages manually installed using "dpkg -i"?
Date 2023-10-04 05:00 +0200
Message-ID <Hl0hb-do79-1@gated-at.bofh.it> (permalink)
References <Hko2d-d0Pd-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Some tools I've been using lately are apt-mark and "dpkg-query --show".

The following UNTESTED commands (ran as a normal user):

(apt-mark showauto ; apt-mark showmanual) > apt-thinks-you-installed.txt
dpkg-query --show --showformat='${Package}\n' | grep -v -F
apt-thinks-you-installed.txt > rest.txt

The file "rest.txt" should have a list of packages installed that were
NOT installed via apt.  With any luck, it is small enough to examine
manually.

You could do something like "apt list" to get a list of all packages
known by apt and see if you'd prefer to use just use the Debian
instead of Mint versions.  And anything not in that list *probably*
came from other manual sources and you can do what you will with that
information.

You could poke around in /var/lib/apt/lists/ and see if the files from
the mint repos you used in the past are still there (I don't know if
they get cleaned up or not, might get lucky).


Regarding the comment in the thread about packages that the installer
added that show up as manual, you can do something like the following
to at least make apt think they were auto:

dpkg-query --show --showformat='${Package} ${Priority}\n' | awk '$2 ==
required {print $1}' > required.txt
sudo apt-mark auto $(apt-mark showmanual | grep -F required.txt)  #
apt-mark will prompt, so you don't want to use xargs

Again, the above is untested, so verify first!

You might do the same for other priorities, like  standard or
important.  If for no other reason than breaking the list of packages
into smaller, digestible chunks that you can focus on.  For example,
on my machine:
$ dpkg-query --show --showformat='${Priority}\n' | sort | uniq -c | sort -n
      5 extra
     29 important
     29 standard
     33 required
   1472 optional

I could probably handle going through those smaller collections to
identify where they came from fairly easily.  But that big optional
collection, not so much.  For something like that, I might add
${Section} to the --showformat option, and divide them up that way.

Also, as a future project, you might consider creating metapackages to
help organize your installation.  Again, for my machine:
$ apt-mark showmanual | wc -l
1
$ apt-mark showauto | wc -l
1563

I have a handful of debian control files that I use (base, desktop,
dev, serviceX, serviceY, machine1, machine2,...).  The machine ones
depends on the services they host (NFS, LDAP, VMs), and whether they
need a GUI (desktop), whether I build on them (dev), or play games,
etc.  Then each machine, after a base install I do something like:

apt-mark auto $(apt-mark showmanual)
apt install machineN
apt autoremove --purge

Of course, I monitor that autoremove to make sure it doesn't do
anything silly, and if it tries to remove a package I missed, I go add
it to the appropriate control file.  My simple little way of doing
this is:

$ cat doit.sh
#!/bin/bash

for v in *.control; do
  equivs-build $v > $v.log &
done

echo 'Waiting....'
wait
echo 'Done waiting'

OUTPUT=/srv/deb/packages
rm -rf $OUTPUT
mkdir -p $OUTPUT
cp *.deb $OUTPUT
cd $OUTPUT

dpkg-scanpackages . > Packages
$ cat /etc/apt/sources.list.d/mrc-home.list
deb [trusted=yes] file:/srv/deb/packages ./

And yes, I should do better than the [trusted=yes].

Good luck on your upgrade!
mrc

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How can I find packages manually installed using "dpkg -i"? Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> - 2023-10-02 12:10 +0200
  Re: How can I find packages manually installed using "dpkg -i"? <tomas@tuxteam.de> - 2023-10-02 12:20 +0200
  Re: How can I find packages manually installed using "dpkg -i"? "Marco M." <mm@dorfdsl.de> - 2023-10-02 12:20 +0200
    Re: How can I find packages manually installed using "dpkg -i"? Ottavio Caruso <ottavio2006-usenet2012@yahoo.com> - 2023-10-02 15:30 +0200
      Re: How can I find packages manually installed using "dpkg -i"? "Marco M." <mm@dorfdsl.de> - 2023-10-02 15:50 +0200
      Re: How can I find packages manually installed using "dpkg -i"? The Wanderer <wanderer@fastmail.fm> - 2023-10-02 15:50 +0200
        Re: How can I find packages manually installed using "dpkg -i"? Greg Wooledge <greg@wooledge.org> - 2023-10-02 16:00 +0200
          Re: How can I find packages manually installed using "dpkg -i"? <tomas@tuxteam.de> - 2023-10-02 16:10 +0200
            Re: How can I find packages manually installed using "dpkg -i"? David Wright <deblis@lionunicorn.co.uk> - 2023-10-03 06:30 +0200
              Re: How can I find packages manually installed using "dpkg -i"? <tomas@tuxteam.de> - 2023-10-03 08:30 +0200
          Re: How can I find packages manually installed using "dpkg -i"? The Wanderer <wanderer@fastmail.fm> - 2023-10-02 16:10 +0200
  Re: How can I find packages manually installed using "dpkg -i"? Max Nikulin <manikulin@gmail.com> - 2023-10-02 13:00 +0200
  Re: How can I find packages manually installed using "dpkg -i"? Mike Castle <dalgoda+debian@gmail.com> - 2023-10-04 05:00 +0200
    Re: How can I find packages manually installed using "dpkg -i"? Mike Castle <dalgoda+debian@gmail.com> - 2023-10-04 05:20 +0200
    Re: How can I find packages manually installed using "dpkg -i"? Max Nikulin <manikulin@gmail.com> - 2023-10-04 09:50 +0200
    Re: How can I find packages manually installed using "dpkg -i"? David Wright <deblis@lionunicorn.co.uk> - 2023-10-05 06:20 +0200
      Re: How can I find packages manually installed using "dpkg -i"? John Crawley <john@bunsenlabs.org> - 2023-10-05 08:10 +0200
        Re: How can I find packages manually installed using "dpkg -i"? Greg Wooledge <greg@wooledge.org> - 2023-10-05 13:00 +0200

csiph-web