Re: How can I find packages manually installed using "dpkg -i"?
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
Reply to: