LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 08-25-2021, 01:54 AM   #1
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Rep: Reputation: 56
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:

ls -la /boot/grub/
total 2616
drwxr-xr-x 5 root root 4096 Aug 24 23:14 ./
drwxr-xr-x 3 root root 4096 Aug 24 23:17 ../
-rw-r--r-- 1 root root 197 Apr 3 2010 default
-rw-r--r-- 1 root root 8704 Apr 3 2010 e2fs_stage1_5
-rw-r--r-- 1 root root 8544 Apr 3 2010 fat_stage1_5
drwxr-xr-x 2 root root 4096 Oct 5 2016 fonts/
-rw-r--r-- 1 root root 0 Feb 1 2016 grub2-installed
-r--r--r-- 1 root root 10268 Aug 24 23:25 grub.cfg
-rw-r--r-- 1 root root 1024 Aug 24 23:24 grubenv
drwxr-xr-x 2 root root 20480 Aug 24 23:05 i386-pc/
-rw-r--r-- 1 root root 9568 Apr 3 2010 jfs_stage1_5
drwxr-xr-x 2 root root 4096 Aug 24 23:25 locale/
-rw-r--r-- 1 root root 4214 Sep 13 2010 menu.lst~
-rw-r--r-- 1 root root 4214 Sep 13 2010 menu.lst_backup_by_grub2_postinst
-rw-r--r-- 1 root root 7904 Apr 3 2010 minix_stage1_5
-rw-r--r-- 1 root root 10720 Apr 3 2010 reiserfs_stage1_5
-rw-r--r-- 1 root root 512 Apr 3 2010 stage1
-rw-r--r-- 1 root root 128552 Apr 3 2010 stage2
-rw-r--r-- 1 root root 2396122 Aug 24 23:14 unicode.pf2
-rw-r--r-- 1 root root 10280 Apr 3 2010 xfs_stage1_5

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?
 
Old 08-25-2021, 06:02 AM   #2
mrmazda
LQ Guru
 
Registered: Aug 2016
Location: SE USA
Distribution: openSUSE 24/7; Debian, Knoppix, Mageia, Fedora, others
Posts: 5,819
Blog Entries: 1

Rep: Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068Reputation: 2068
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.
 
Old 08-25-2021, 01:20 PM   #3
colorpurple21859
LQ Veteran
 
Registered: Jan 2008
Location: florida panhandle
Distribution: Slackware Debian, Fedora, others
Posts: 7,358

Rep: Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591Reputation: 1591
as root run

Code:
grub-install /dev/sda
update grub
Change /dev/sda if it is a different device mbr
 
Old 08-25-2021, 07:25 PM   #4
browny_amiga
Member
 
Registered: Dec 2001
Location: /mnt/UNV/Mlkway/Earth/USA/California/Silicon Valley
Distribution: Kubuntu, Debian Buster Stable, Windoze 7
Posts: 684

Original Poster
Rep: Reputation: 56
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Infinite Grub Loop: GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB GRUB... beeblequix MEPIS 2 11-02-2013 10:56 PM
How do I need to format grub entry to boot from grub2 into grub legacy? mitchell7man Linux - Software 6 04-03-2010 03:03 AM
Legacy Grub and Grub2 wars crash my Ferrari and Kubuntu 9.10 minrich Linux - Software 2 10-12-2009 06:20 AM
Help converting grub-legacy to grub2 ssenuta Linux - General 4 08-29-2009 10:04 AM
Grub Legacy or Grub2? RAVC Linux - Software 2 01-21-2006 09:43 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration