Re: How can I find packages manually installed using "dpkg -i"?
On Mon 02 Oct 2023 at 16:00:57 (+0200), tomas@tuxteam.de wrote:
> On Mon, Oct 02, 2023 at 09:52:39AM -0400, Greg Wooledge wrote:
> > On Mon, Oct 02, 2023 at 09:43:39AM -0400, The Wanderer wrote:
> > > On 2023-10-02 at 09:28, Ottavio Caruso wrote:
> > > > Yeah, the one for which I had to manually use "dpkg -i".
> > >
> > > That information is not tracked.
> > >
> > > What is tracked is "the package versions known to be available from each
> > > registered repository" and "the package versions which are installed".
> >
> > There *is* tracking. Packages can be marked as "automatically installed"
> > or not. The problem is, the marking is not consistent with user
> > expectations.
>
> But not if you use dpkg directly (dpkg doesn't even resolve dependencies,
> but just gives up when some aren't met). That's why I proposed comparing
> apt logs and dpkg logs -- things in the latter but not in the former were
> probably installed with straight dpkg.
>
> It probably ain't straightforward, though. And the logs might have been
> rotated out anyway.
If you have complete logs and try this, presumably coming up with a
sorted list of apt-installed packages (remembering --unique) from its
history, and a similar list from the ' install ' lines in dpkg.log*,
bear in mind that you need to ignore the dpkg.log until about when
locales is installed, as APT never sees a load of packages installed
before that point.
Also be careful if you're tempted to sort dpkg.log's install lines
by time, instead of grepping the logs in the correct (non-collating)
order, because for people in the western hemisphere, the packages you
want to ignore will have UTC timestamps, placing them in the midst
of packages installed after the d-i has finished. (The timestamps
jump from UTC to localtime after locales is installed.)
To avoid all these complications in future, I would suggest that the
OP (and anybody else) modify their logrotate configuration files thus:
$ grep rotate /etc/logrotate.d/{apt,dpkg}
/etc/logrotate.d/apt: rotate -1
/etc/logrotate.d/apt: rotate -1
/etc/logrotate.d/dpkg: rotate -1
$
and jettison dpkg -i in favour of: apt install /path/to/some.deb
where the /path/to/ is essential even if it's only ./some.deb.
With those changes, it will be easy to spot these particular packages
just by grepping .deb$ (strictly, \.deb$) in …/apt/history.log*.
Cheers,
David.
Reply to: