Edit2 2018-10-01: got it. tl;dr is that apt-mark hold grub-foo
(on all desired packages) was the ticket, but appears to have required manually calling on each package apt dist-upgrade
was attempting to bring in.
$ sudo apt-mark hold grub*
grub2 set on hold.
grub set on hold.
grub-common set on hold.
[... a bunch more packages ...]
grub-pc set on hold.
grub-legacy-doc set on hold.
grub2-common set on hold.
grub-gfxpayload-lists set on hold.
grub-pc-bin set on hold.
But right after...
$ sudo apt dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
gcc-6-base:i386 grub-common:i386 grub-gfxpayload-lists:i386 grub-pc:i386 grub-pc-bin:i386 grub2-common:i386 ...
Go figure. However, manually specifying the above grub*
packages to apt-mark hold
worked and apt dist-upgrade
no longer pulls in grub.
Last comment is that I tried this in /etc/apt/preferences.d/grub-blacklist
:
Package: grub*
Pin: origin ""
Pin-Priority: -1
That didn't work.
Edit 2018-10-01: this was not the solution... even with the setting in /etc/apt/apt.conf.d/01autoremove
below, apt dist-upgrade
is still putting it forward to be installed. To be continued...
I think I may have answered both questions.
how can I find out why grub is being summoned?
I'm most familiar with pacman
on arch; looks like the equivalent to pacman -Qi pkg
where you get a list of which packages require the named package. This was one equivalent of that for ubuntu:
$ apt-cache rdepends --installed grub-pc
|linux-image-4.15.0-34-generic
grub-pc:i386
So, the meta-package for the linux kernel pulls it in. If I had more time/inclination, I'd see if there was some set of packages to install directly vs. relying on this convenience package, but I don't care to do that at this time.
how can I prevent it from ever being installed again?
In looking for how to blacklist in ubuntu, there were various options, but I settled on this one because it seemed the least weird/hokey:
$ cat /etc/apt/apt.conf.d/01autoremove
{
...
Never-MarkAuto-Sections
{
...
"grub*";
};
};
grub-*
is installed, then it's newly installed. See my answer for why (it's pulled in as recommended by the kernel image package). Pinning to-1
has fixed it, but there were several blacklisting options along the way and I tried 3; only pinning worked, which still perplexes me. – Hendy Oct 03 '18 at 03:21