[SOLVED] How do I prevent kernel updates from reinstalling grub?

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
giabao06
Level 1
Level 1
Posts: 12
Joined: Sun May 10, 2020 2:42 am

[SOLVED] How do I prevent kernel updates from reinstalling grub?

Post by giabao06 »

I have been using systemd-boot with Mint 20.3 for quite some time now, but every kernel update (generic and OEM, Xanmod does not seem to require it) seems to want to reinstall grub.
A workaround that I've been using is to just sudo apt-mark hold grub-* before updating the kernels.
Last edited by LockBot on Wed Jan 04, 2023 11:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
t42
Level 11
Level 11
Posts: 3746
Joined: Mon Jan 20, 2014 6:48 pm

Re: How do I prevent kernel updates from reinstalling grub?

Post by t42 »

apt-get purge grub-common
-=t42=-
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: How do I prevent kernel updates from reinstalling grub?

Post by pbear »

To clarify, the system isn't reinstalling Grub. It's running update-grub, which rewrites a file called grub.cfg.

The command t42 has given you will stop that.
ajgreeny
Level 7
Level 7
Posts: 1662
Joined: Mon Nov 19, 2007 3:27 pm

Re: How do I prevent kernel updates from reinstalling grub?

Post by ajgreeny »

But if you don't allow the update-grub process you will never use the new kernel unless you manually edit the kernel line by hitting e at the grub menu when you reboot.
What's the point of that?
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How do I prevent kernel updates from reinstalling grub?

Post by rene »

OP says he isn't using Grub but systemd-boot.
giabao06
Level 1
Level 1
Posts: 12
Joined: Sun May 10, 2020 2:42 am

Re: How do I prevent kernel updates from reinstalling grub?

Post by giabao06 »

pbear wrote: Mon Jul 04, 2022 9:54 pm To clarify, the system isn't reinstalling Grub. It's running update-grub, which rewrites a file called grub.cfg.

The command t42 has given you will stop that.
Update manager does say that grub will be installed (At that time I purged all grub packages other than grub-common and grub-pc-bin) along with kernels
Purged the two packages mentionned earlier, will reply after another kernel update

Edit: iirc the systemd-boot install guide that I read tells me to write 2 certain, identical files that define what update-initramfs should do after kernel install / remove. Are the update-grub lines located there?
Edit 2: looked it up, those are

Code: Select all

/etc/kernel/postinit.d/zz-update-systemd-boot
/etc/kernel/postrm.d/zz-update-systemd-boot
/etc/kernel/post-update.d/zz-update-systemd-boot
The guide said to write one file in postinit.d, then the other 2 is symlinked to the postinit.d file
pbear
Level 16
Level 16
Posts: 6569
Joined: Wed Jun 21, 2017 12:25 pm
Location: San Francisco

Re: How do I prevent kernel updates from reinstalling grub?

Post by pbear »

I don't use systemd-boot, so can't comment on that. I'm pretty familiar with Grub, though. Installing or updating Grub packages is a very different thing from reinstalling Grub. Update Manager will do the former but not the latter.

By the way, if you're looking to get away from Grub, you might consider rEFInd.
giabao06
Level 1
Level 1
Posts: 12
Joined: Sun May 10, 2020 2:42 am

Re: How do I prevent kernel updates from reinstalling grub?

Post by giabao06 »

There have been kernel updates (Xanmod, Generic and OEM) for me. OEM and Generic wants to reinstall grub once again, even with grub-common removed while Xanmod does not.
t42
Level 11
Level 11
Posts: 3746
Joined: Mon Jan 20, 2014 6:48 pm

Re: How do I prevent kernel updates from reinstalling grub?

Post by t42 »

giabao06 wrote: Wed Aug 03, 2022 3:55 am There have been kernel updates (Xanmod, Generic and OEM) for me. OEM and Generic wants to reinstall grub once again, even with grub-common removed while Xanmod does not.
Grub is a recommended package, open Synaptic -> Settings -> Preferences and uncheck "Consider recommended packages as dependencies" on the General tab.
-=t42=-
giabao06
Level 1
Level 1
Posts: 12
Joined: Sun May 10, 2020 2:42 am

Re: How do I prevent kernel updates from reinstalling grub?

Post by giabao06 »

t42 wrote: Wed Aug 03, 2022 4:18 am
giabao06 wrote: Wed Aug 03, 2022 3:55 am There have been kernel updates (Xanmod, Generic and OEM) for me. OEM and Generic wants to reinstall grub once again, even with grub-common removed while Xanmod does not.
Grub is a recommended package, open Synaptic -> Settings -> Preferences and uncheck "Consider recommended packages as dependencies" on the General tab.
Thank you, it worked!
Locked

Return to “Installation & Boot”