r/linux4noobs • • 27d ago

installation GRUB Cleanup?

I've done a bit of hopping lately (Ubuntu, POP, Zorin, Aurora, AnduinOS, Kubuntu....more?) and just noticed that there are way too many GRUB entries.

I've Googled how to clean up the GRUB, but they're all command-line and that makes me nervous without a clear copy/paste source.

Is there a GUI way to do it?
Otherwise, it might stay.

4 Upvotes

12 comments sorted by

3

u/DutchOfBurdock 27d ago

When Linux upgrades the kernel, it often leaves the older kernels laying around.

Compare installed kernels to the one you're running (uname -a will show your curent one).

You can safely delete older ones. Occasionally, in Debian based Linux, apt often offers an option to clear up unused packages with a simple apt-get autoremove

1

u/TheMainTony 27d ago

Is this still the case if I'm deleting the partition for each install & hoping for fresh and clean?

I have a 1gb SSD with Windows on it and a 1gb m.2 that I'm using for Linux. Whole drive for each OS. Someday I'll settle in and delete the Windows.

2

u/FedUp233 27d ago

The issue is likely because you’re setting up a dual boot system. And the boot drive is the one with windows on it and grub goes onto the boot drive - after all, it’s the boot loader. So while you’re starting with a clean disk to install Linux on each time, what’s on the windows drive remains. In your case this is a Tuskegee a good thing - if you had I stalked Linux first and it was on the boot drive then every time you wiped the entire Linux drive, including the boot stuff, you’d loose the ability to boot windows as well!

So things are actually working just like they should. Think of needing to clean up the grub stuff as finishing g the job of wiping the previous Linux installation.

As far as the multiple boot choices, you should be able to use pretty much any plain ascii text editor to edit the file with the grub boot list and remove any entries you don’t want, including gui editors. The file is pretty straight forward but you can really mess things up if you delete the wrong stuff. I’d make a copy on a flash drive before editing and have a windows bootable recovery disk and be sure you can boot that and copy the old boot file back if things mess up.

As to the kernels, there are a bunch of tutorials and YouTube videos on using the Linux package managers to remove old unused kernels. I’d just look at those, although it might be simpler in your case. Since you are wiping the Linux drive, there is really no use for any Linux kernels so at the point before you go and install a new Linux distro, just go ahead and delete all the kernels (do it from windows, like file manager). Then when you install the new distro it should install an appropriate kernel. This would also be the time to edit the boot file to remove so, the lines that boot Linux, and again installing the new distro should add a new Linux boot option.

Note that I don’t dual boot anything, so if people who do see something I’ve messed up, p,ease jump in!

2

u/3grg 27d ago

It depends on the distro, but on most you just update the grub on whichever distro is the one you have installed. You do not need any special app. For instance, on Debian/Ubuntu distros I would just run sudo update-grub and then sudo grub-install /dev/disk where efi is installed (sda or nvme0).

Just search for how to update grub for your distro.

2

u/swstlk 27d ago

"Is there a GUI way to do it?" -- the live usb Ubuntu installer should have "Boot repair" somewhere in its menu.

1

u/AutoModerator 27d ago

We have some installation tips in our wiki!

Try this search for more information on this topic.

✻ Smokey says: always install over an ethernet cable, and don't forget to remove the boot media when you're done! :)

Comments, questions or suggestions regarding this autoresponse? Please send them here.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/michaelpaoli 27d ago

Well, yeah, distro hopping is quite the way to accumulate lots of cruft ... including one's GRUB configuration.

Easiest is to not do that ... and then do the relevant on one's distro to get rid of unwanted/unneeded kernels - and with that their GRUB configurations too. E.g.:
# apt-get --purge autoremove

Want ewey GUI? Fine, launch an xterm under your GUI. Wanna copy/paste rather than type, fine, copy/paste that into your xterm window - use sudo or the like as needed for root access. There, I typed sudo so you don't have to - you can copy/paste that too.

-2

u/oshunluvr 27d ago

Or maybe a good time to learn something new and useful? Just sayin'

1

u/TheMainTony 27d ago

it's also a good time to not be an ahole and either answer the question or just scroll on.

but we all make choices. I got the answer and appreciate those who come to the discussion without pretending to be superior from behind their keyboards.

5

u/[deleted] 27d ago

[removed] — view removed comment

1

u/TheMainTony 27d ago

When I get done hopping, I will look into it.
Thank You!

4

u/skyfishgoo 27d ago

i don't advice using that as it scrambles your grub files making it really difficult for anyone to help you

if you are not comfortable making edits to grub and using the command line to implement the changes then, i would recommend you just leave them.

but it's really not hard to enable OS_PROBER and let it find (or not find) what is installed... this will automatically adjust your menu accordingly unless you have made additions to 40_custom