GRUB broken on newly updated MX-21

Report Bugs, Issues and non- package Requests
Message
Author
theprofa325
Posts: 21
Joined: Sat Jan 11, 2020 9:13 am

Re: GRUB broken on newly updated MX-21

#21 Post by theprofa325 »

Here is the grub.cfg from the non-bootable system installed on disk:

Code: Select all

demo@mx1:~
$ cat disk/grub/grub.cfg
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd1,msdos7'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos7 --hint-efi=hd1,msdos7 --hint-baremetal=ahci1,msdos7  9c79d178-2a9e-4556-b52a-8236447d0732
else
  search --no-floppy --fs-uuid --set=root 9c79d178-2a9e-4556-b52a-8236447d0732
fi
    font="/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=5
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=5
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
	set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###

### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg
fi
### END /etc/grub.d/41_custom ###
demo@mx1:~
$ 
As always, thank you for your assistance.

User avatar
fehlix
Developer
Posts: 12903
Joined: Wed Apr 11, 2018 5:09 pm

Re: GRUB broken on newly updated MX-21

#22 Post by fehlix »

theprofa325 wrote: Fri Oct 21, 2022 12:57 pm

Code: Select all

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
	set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode

### END /etc/grub.d/10_linux ###
Hmme not much grub.cfg between BEGIN and END of 10_linux,
so it cannot boot b/c no grub-entries have been generated.
Something to check further I guess:
A) check what's an the boot- partition under with the top directory "/"
B) check what under the /boot directory on the MX-21 root-partitions
C) check whats the content of /etc/grub.d directory on the MX-21 root-partitions.

Do all this when booted with LiveUSB

to A:
Mount boot partition in Thunar,
Right click an open Terminal here:
List the content

Code: Select all

ls -al 
to B:
Mount int Thunar MX-21 root open.
right click on the /boot directory,
this directroy should be empty.
If not open terminal here and

Code: Select all

ls -al
to C:
Same as B: but show content of etc/grub.d on the MX-21 root partition
within the directory /etc/grub.d

Code: Select all

ls -al 
That's it for now.

User avatar
pbear
Posts: 311
Joined: Tue Aug 09, 2022 9:24 pm

Re: GRUB broken on newly updated MX-21

#23 Post by pbear »

theprofa325 wrote: Fri Oct 21, 2022 12:57 pm Here is the grub.cfg from the non-bootable system
Shot in the dark. Did you perchance install Grub Customizer?

@fehlix, whether or not the OP did, I respectfully suggest purge-and-reinstall of Grub, from chroot of course.
You're captain of the ship, though, so your call whether to pursue that strategy.

theprofa325
Posts: 21
Joined: Sat Jan 11, 2020 9:13 am

Re: GRUB broken on newly updated MX-21

#24 Post by theprofa325 »

OK, here we go. To pbear- no grub customization used.

listing boot partition:

Code: Select all

$ sudo fdisk -l /dev/sda
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: CT1000MX500SSD1 
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: dos
Disk identifier: 0xfc6cd71c

Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1             2048    1953791    1951744   953M 83 Linux
/dev/sda2          1955838 1907783679 1905827842 908.8G  5 Extended
/dev/sda3       1907783680 1953523711   45740032  21.8G 82 Linux swap / Solaris
/dev/sda5        126955520  142579711   15624192   7.5G ef EFI (FAT-12/16/32)
/dev/sda6        142581760 1907363839 1764782080 841.5G 83 Linux
/dev/sda7  *       1957888  126953471  124995584  59.6G 83 Linux

Partition 2 does not start on physical sector boundary.
Partition table entries are not in disk order.
demo@mx1:~
$ sudo mount /dev/sda1 disk
demo@mx1:~
$ cd disk
demo@mx1:~/disk
$ ls -la
total 12
drwxr-xr-x  4 root root 4096 Sep 30 11:29 .
drwxr-xr-x 19 demo demo  540 Oct 24 09:56 ..
drwxr-xr-x  2 root root 4096 Sep 30 11:29 efi
drwxr-xr-x  6 root root 4096 Oct 15 06:13 grub

$ ls -la grub
total 2396
drwxr-xr-x 6 root root    4096 Oct 15 06:13 .
drwxr-xr-x 4 root root    4096 Sep 30 11:29 ..
drwxr-xr-x 2 root root    4096 Sep 30 11:30 fonts
-rw-r--r-- 1 root root    3142 Oct 15 06:13 grub.cfg
-rw-r--r-- 1 root root    1024 Sep 30 11:30 grubenv
drwxr-xr-x 2 root root   20480 Oct 15 06:21 i386-pc
drwxr-xr-x 2 root root    4096 Oct 15 06:21 locale
-rw-r--r-- 1 root root 2394108 Oct 15 06:11 unicode.pf2
drwxr-xr-x 2 root root   12288 Sep 30 11:30 x86_64-efi
demo@mx1:~/disk
$ ls -la efi
total 8
drwxr-xr-x 2 root root 4096 Sep 30 11:29 .
drwxr-xr-x 4 root root 4096 Sep 30 11:29 ..
demo@mx1:~/disk
Next, listing /boot on MX-21 root directory:

Code: Select all


$ sudo umount /dev/sda1
demo@mx1:~
$ sudo mount /dev/sda7 disk
demo@mx1:~
$ cd disk
demo@mx1:~/disk
$ ls -la
total 100
drwxr-xr-x  20 root root  4096 Oct 15 06:11 .
drwxr-xr-x  19 demo demo   540 Oct 24 09:56 ..
lrwxrwxrwx   1 root root     7 Oct 18  2021 bin -> usr/bin
drwxr-xr-x   2 root root  4096 Feb 28  2022 boot
drwx------   2 root root  4096 Feb 28  2022 .cache
drwx------   3 root root  4096 Feb 28  2022 .config
drwxr-xr-x   2 root root  4096 Feb 28  2022 dev
drwxr-xr-x 151 root root 12288 Oct 15 06:11 etc
-rwxr-xr--   1 root root    80 Sep 19 16:17 .fehbg
drwxr-xr-x   2 root root  4096 Feb 28  2022 home
lrwxrwxrwx   1 root root     7 Oct 18  2021 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Oct 18  2021 lib64 -> usr/lib64
lrwxrwxrwx   1 root root    10 Oct 18  2021 libx32 -> usr/libx32
drwx------   2 root root 16384 Feb 28  2022 lost+found
drwxr-xr-x   3 root root  4096 Jul 20 09:26 media
drwxr-xr-x   2 root root  4096 Feb 28  2022 mnt
drwxr-xr-x   5 root root  4096 Jun  2 12:53 opt
drwxr-xr-x   2 root root  4096 Feb 28  2022 proc
drwx------   2 root root  4096 Mar 10  2022 pulse
drwx------  20 root root  4096 Oct 15 06:17 root
drwxr-xr-x   2 root root  4096 Feb 28  2022 run
lrwxrwxrwx   1 root root     8 Oct 18  2021 sbin -> usr/sbin
drwxr-xr-x   2 root root  4096 Feb 28  2022 sys
drwxrwxrwt   5 root root  4096 Sep 27 12:53 tmp
drwxr-xr-x  14 root root  4096 Oct 18  2021 usr
drwxr-xr-x  12 root root  4096 Oct 18  2021 var
demo@mx1:~/disk$
ls -la boot
total 8
drwxr-xr-x  2 root root 4096 Feb 28  2022 .
drwxr-xr-x 20 root root 4096 Oct 15 06:11 ..


And finally, /etc/grub.d:

Code: Select all

demo@mx1:~/disk


demo@mx1:~/disk
$ ls -la etc/grub.d
total 136
drwxr-xr-x   2 root root  4096 Oct 15 06:11 .
drwxr-xr-x 151 root root 12288 Oct 15 06:11 ..
-rwxr-xr-x   1 root root 10046 Jul 10  2021 00_header
-rwxr-xr-x   1 root root  6260 Jul 10  2021 05_debian_theme
-rwxr-xr-x   1 root root 14123 Aug  1 15:26 10_linux
-rwxr-xr-x   1 root root 13654 Mar  1  2022 10_linux.dpkg-old
-rwxr-xr-x   1 root root 14180 Aug  1 15:26 20_linux_xen
-rwxr-xr-x   1 root root  1444 Oct 18  2021 20_memtest86+
-rwxr-xr-x   1 root root 12910 Aug  1 15:26 30_os-prober
-rwxr-xr-x   1 root root 12162 Oct 18  2021 30_os-prober.dpkg-old
-rwxr-xr-x   1 root root  1372 Aug  1 15:26 30_uefi-firmware
-rwxr-xr-x   1 root root  1594 Oct 18  2021 30_uefi-firmware.dpkg-old
-rwxr-xr-x   1 root root   214 Jul 10  2021 40_custom
-rwxr-xr-x   1 root root   215 Aug  1 15:26 41_custom
-rw-r--r--   1 root root   483 Jul 10  2021 README
Thank you for continuing with this extended thread.

User avatar
fehlix
Developer
Posts: 12903
Joined: Wed Apr 11, 2018 5:09 pm

Re: GRUB broken on newly updated MX-21

#25 Post by fehlix »

Hmm...
This is on sda1 which got as mounted onto /boot on sda7 "/"- rootMX21 partition:

Code: Select all

sudo mount /dev/sda1 disk
$ cd disk
$ ls -la
total 12
drwxr-xr-x  4 root root 4096 Sep 30 11:29 .
drwxr-xr-x 19 demo demo  540 Oct 24 09:56 ..
drwxr-xr-x  2 root root 4096 Sep 30 11:29 efi
drwxr-xr-x  6 root root 4096 Oct 15 06:13 grub
and this is on sda7 rootMX21 under boot

Code: Select all

sudo mount /dev/sda7 disk
$ cd disk
ls -la boot
total 8
drwxr-xr-x  2 root root 4096 Feb 28  2022 .
drwxr-xr-x 20 root root 4096 Oct 15 06:11 ..

which tells nowhere any linux kernels to be found, so grub is correct, it can't find anything to boot.
Not sure what you have done, I'm affraid without linux kernels installed this system won't boot.
In case you would be able to use Chroot-Rescue-Scan again to chroot into,
maybe you could install the missing kernel.

theprofa325
Posts: 21
Joined: Sat Jan 11, 2020 9:13 am

Re: GRUB broken on newly updated MX-21

#26 Post by theprofa325 »

OK, fehlix, I confirm that /boot on the installed MX-21 root drive is empty.

Proceeding cautiously, I look at the synaptic package manager (to avoid possible typos with command line installers). It shows
linux-image-5.10.0-13-amd64 5.10.106-1 as the installed kernel. (At least, I think that's what this is.) Of course that reflects the state of the dpkg database, not the actual situation on disk. However, synaptic (perhaps wisely) does not allow me to "mark for reinstallation" this as it does for any other entry.

Should I go ahead with dpkg? From dpkg manual I think steps would be (in chroot environment):
* download linux-image-5.10.0-13-amd64 5.10.106-1.deb from MX mirror or ??
* run:

Code: Select all

dpkg -i  linux-image-5.10.0-13-amd64 5.10.106-1.deb
Any suggestions welcome. Needless to say I have no idea how the contents of /boot got wiped out- I certainly didn't knowingly do it.

Thanks.

User avatar
pbear
Posts: 311
Joined: Tue Aug 09, 2022 9:24 pm

Re: GRUB broken on newly updated MX-21

#27 Post by pbear »

Frankly, if I were in your shoes, this is the point where I would throw in the towel and reinstall the whole system. I assume fehlix can walk you through reinstalling a kernel via chroot. (Heck, I probably could do it.) But there's no way of knowing what else has gone sideways, not to mention the original update problem which set you off on this frolic.

If and when you reinstall, remember to set up Timeshift, so you don't have to go through this again.

User avatar
fehlix
Developer
Posts: 12903
Joined: Wed Apr 11, 2018 5:09 pm

Re: GRUB broken on newly updated MX-21

#28 Post by fehlix »

theprofa325 wrote: Tue Oct 25, 2022 10:59 am OK, fehlix, I confirm that /boot on the installed MX-21 root drive is empty.

Proceeding cautiously, I look at the synaptic package manager (to avoid possible typos with command line installers). It shows
linux-image-5.10.0-13-amd64 5.10.106-1 as the installed kernel. (At least, I think that's what this is.) Of course that reflects the state of the dpkg database, not the actual situation on disk. However, synaptic (perhaps wisely) does not allow me to "mark for reinstallation" this as it does for any other entry.

Should I go ahead with dpkg? From dpkg manual I think steps would be (in chroot environment):
* download linux-image-5.10.0-13-amd64 5.10.106-1.deb from MX mirror or ??
* run:

Code: Select all

dpkg -i  linux-image-5.10.0-13-amd64 5.10.106-1.deb
Any suggestions welcome. Needless to say I have no idea how the contents of /boot got wiped out- I certainly didn't knowingly do it.

Thanks.
Try this,
* Boot from MX Live USB
* open terminal as normal user and run

Code: Select all

sudo chroot-rescue-scan
* in case it found the nstalled system use arrow-keys to slect and enter to visit the installed system

* If you got a "chroot>" prompt,
try this at withni chroot:

Code: Select all

apt update

Code: Select all

apt reinstall linux-image-amd64 linux-headers-amd64
with some luck you will get latest Debian kernal installed
it may have already re-genrated the grub -menu.
But try manyully:

Code: Select all

update-grub
when done type
exit
and press enter to leave chroot.
type twice q to quit
and shutdown pullout the LiveUSB and boot t he pc.

theprofa325
Posts: 21
Joined: Sat Jan 11, 2020 9:13 am

Re: GRUB broken on newly updated MX-21

#29 Post by theprofa325 »

Success!
The system boots and runs after following fehlix's last posted instructions.

The only thing wrong is that there is no GRUB menu with the usual options. Blank screen instead, but after the usual 5 seconds or whatever it is, it boots the installed system. This is not a big deal since system is not dual boot or anything, and I suppose I can fix it by delving into grub manual.

Thank you all so much for your persistence and assistance. I'll now go learn about Timeshift, and hopefully restore the grub menu without destroying my system again.

Post Reply

Return to “Bugs and Non-Package Requests Forum”