How to completely remove Grub legacy from Grub2 install?
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to completely remove Grub legacy from Grub2 install?
Hi,
I have a system that used to run on grub 1 (legacy), but it got upgraded to grub 2. Now I want to clean it up and remove all config left over from grub legacy. How can I do that?
This is a Debian Buster Linux, and when I do
apt purge grub-pc
it will ask me if I want to erase /boot/grub, I say yes, but it does not erase anything there.
All the files are still there. If I now erase them by hand and reinstall grub-pc, it does not recreate them. I had this very strange behaviour before: dpkg somehow notices when a user erases files and marks these to never install them.
So how can I reinstall Grub2 from scratch, reset the whole config and remove all and every little bit of legacy config from grub legacy?
This is the directory with the leftover stuff from grub legacy and grub2 installed:
after I purge grub-pc and then remove the files manually, and reinstall grub-pc, the directory looks like this:
ls -la /boot/grub/
total 2348
drwxr-xr-x 2 root root 4096 Aug 24 23:49 ./
drwxr-xr-x 3 root root 4096 Aug 24 23:49 ../
-rw-r--r-- 1 root root 2396122 Aug 24 23:49 unicode.pf2
which is clearly impossible, there can't be that little in the directory for a functioning grub2 bootloader.
I have had this before, I have run into this again and again on Debian, the basic question is:
how do you remove a software package CLEANLY, meaning nothing left over, no files there and then reinstall it from scratch, a complete reset of the package like it was installed for the very first time on the system?
Also, I can't find out who owns the files in /boot/grub in the above longer directory listing, grub-common and grub-pc seems to not own anything in the /boot dir. But who does?
I only use Grub2 on EFI PCs. The following is from my latest Debian upgrade:
Code:
# inxi -S
System: Host: big31 Kernel: 5.10.0-8-amd64 x86_64 bits: 64 Console: tty pts/0 Distro: Debian GNU/Linux 11 (bullseye)
# dpkg -l | grep grub
ii grub-common 2.04-20 amd64 GRand Unified Bootloader (common files)
ii grub-legacy 0.97-77 amd64 GRand Unified Bootloader (Legacy version)
ii grub-splashimages 1.2.3+nmu1 all a collection of great GRUB splashimages
# ls -l /boot/grub
-rw-r--r-- 1 root root 197 Oct 23 2015 default
-rw------- 1 root root 65 Oct 19 2015 device.map
-rw-r--r-- 1 root root 8636 Oct 23 2015 e2fs_stage1_5
-rw-r--r-- 1 root root 8424 Oct 23 2015 fat_stage1_5
-rw-r--r-- 1 root root 9368 Oct 23 2015 jfs_stage1_5
-rw-r--r-- 1 root root 1094 Aug 23 23:06 menu.lst
-rw-r--r-- 1 root root 7888 Oct 23 2015 minix_stage1_5
-rw-r--r-- 1 root root 10436 Oct 23 2015 reiserfs_stage1_5
-rw-r--r-- 1 root root 0 Oct 20 2015 setup_left_core_image_in_filesystem
drwxr-xr-x 2 root root 3072 Aug 24 02:26 splashimages
-rw-r--r-- 1 root root 512 Oct 23 2015 stage1
-rw-r--r-- 1 root root 117904 Oct 23 2015 stage2
-rw-r--r-- 1 root root 117904 Jan 29 2013 stage2_eltorito
-rw-r--r-- 1 root root 10004 Oct 23 2015 xfs_stage1_5
Note these files are very old, as I have held grub with apt-mark since back around Stretch or so as a means to avoid Grub2, but this list should help you decide what to remove.
Why doesn't dpkg remove files in /boot/grub? It asks me when purging if it should remove them and then doesn't.
Why does purging all the grub2 packets and then erasing the files by hand then cause no files to be installed in /boot/grub when installing grub-pc?
apt and dpkg seems broken, even using the force-all and force-configmiss does nothing.
This is not just restricted to grub, I have run into this before. The problem is basically that you can't reset a package to being freshly installed without any config existing, do a factory reset so to speak.
Why does dpkg record files being erased by hand and then does not install them again? What useful purpose could that ever have?
Is there a place where this info gets saved in dpkg?
Last edited by browny_amiga; 08-25-2021 at 07:28 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.