Grub does not detect Debian 9 [SOLVED]

Help with issues regarding installation of Debian

Grub does not detect Debian 9 [SOLVED]

Postby fawkesjr » 2018-11-01 23:50

I used Debian 9 and wanted to install OpenSuse Tumbleweed in dual boot to try out. I made the installation and created a partition for OpenSuse and one for the swap.
Soon after the installation, grub recognized Debian, but could not boot the system. I used the fsck / dev / sda command and everything went back to normal.
Three days ago, I was using Debian and decided to use OpenSuse. To do this, I rebooted the machine normally, I joined OpenSuse, I updated the system and since then grub no longer recognizes Debian. On the Grub screen there is only the OpenSuse. I have tried to fix the problem by searching solutions on the internet, but I have failed.

(output in portuguese, because Konsole keeps the output in portuguese even though I change the configuration. Sorry about that)

Output of fdisk -l
Disco /dev/sda: 931,5 GiB, 1000204886016 bytes, 1953525168 setores
Unidades: setor de 1 * 512 = 512 bytes
Tamanho de setor (lógico/físico): 512 bytes / 4096 bytes
Tamanho E/S (mínimo/ótimo): 4096 bytes / 4096 bytes
Tipo de rótulo do disco: dos
Identificador do disco: 0xfbe1c9c3

Dispositivo Inicializar Início Fim Setores Tamanho Id Tipo
/dev/sda1 * 2048 1073743871 1073741824 512G 83 Linux
/dev/sda2 1945325566 1953523711 8198146 3,9G 5 Estendida
/dev/sda3 1073743872 1936930815 863186944 411,6G 83 Linux
/dev/sda4 1936930816 1945325565 8394750 4G 82 Linux swap / Solaris
/dev/sda5 1945325568 1953523711 8198144 3,9G 82 Linux swap / Solaris

Partition 2 does not start at a physical sector boundary.
Logical partitions out of disk order.
(Translated)

Output from grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Tema encontrado: /boot/grub2/themes/openSUSE/theme.txt
Imagem Linux encontrada: /boot/vmlinuz-4.18.15-1-default
Imagem initrd encontrada: /boot/initrd-4.18.15-1-default
Imagem Linux encontrada: /boot/vmlinuz-4.18.14-1-defaultGenerating grub configuration file ...
Tema encontrado: /boot/grub2/themes/openSUSE/theme.txt
Imagem Linux encontrada: /boot/vmlinuz-4.18.15-1-default
Imagem initrd encontrada: /boot/initrd-4.18.15-1-default
Imagem Linux encontrada: /boot/vmlinuz-4.18.14-1-default
Imagem initrd encontrada: /boot/initrd-4.18.14-1-default
Encontrado Debian GNU/Linux 9 (stretch) em /dev/sda1
concluído

Is there anything else I can do? Please, I need help
Last edited by fawkesjr on 2018-11-10 03:27, edited 1 time in total.
fawkesjr
 
Posts: 6
Joined: 2018-10-08 20:32

Re: Grub does not detect Debian 9

Postby p.H » 2018-11-02 08:25

First of all, this seems to be an openSUSE issue, as it affects the GRUB boot loader installed by openSUSE.
fawkesjr wrote:output in portuguese

You can prefix commands with "LANG=C" to get output in default (English) language.
fawkesjr wrote:Encontrado Debian GNU/Linux 9 (stretch) em /dev/sda1

It appears that grub2-mkconfig finds Debian in /dev/sda1, so it should add it to /boot/grub2/grub.cfg.
1) Can you check if Debian is indeed present in /boot/grub2/grub.cfg ?
2) Can you check if the openSUSE GRUB boot loader actually uses /boot/grub2/grub.cfg as the config file or some other pathname such as /boot/grub/grub.cfg, /boot/grub2/grub2.cfg ? Note that update-grub or update-grub2 should invoke grub2-mkconfig and write the configuration to the expected pathname.
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

Re: Grub does not detect Debian 9

Postby fawkesjr » 2018-11-03 00:03

p.H wrote:First of all, this seems to be an openSUSE issue, as it affects the GRUB boot loader installed by openSUSE.
fawkesjr wrote:output in portuguese

You can prefix commands with "LANG=C" to get output in default (English) language.
fawkesjr wrote:Encontrado Debian GNU/Linux 9 (stretch) em /dev/sda1

It appears that grub2-mkconfig finds Debian in /dev/sda1, so it should add it to /boot/grub2/grub.cfg.
1) Can you check if Debian is indeed present in /boot/grub2/grub.cfg ?
2) Can you check if the openSUSE GRUB boot loader actually uses /boot/grub2/grub.cfg as the config file or some other pathname such as /boot/grub/grub.cfg, /boot/grub2/grub2.cfg ? Note that update-grub or update-grub2 should invoke grub2-mkconfig and write the configuration to the expected pathname.


The "LANG=C" command worked, thank you very much. Here are the outputs I posted before:

Output from fdisk -l
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
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: 0xfbe1c9c3

Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 1073743871 1073741824 512G 83 Linux
/dev/sda2 1945325566 1953523711 8198146 3.9G 5 Extended
/dev/sda3 1073743872 1936930815 863186944 411.6G 83 Linux
/dev/sda4 1936930816 1945325565 8394750 4G 82 Linux swap / Solaris
/dev/sda5 1945325568 1953523711 8198144 3.9G 82 Linux swap / Solaris

Partition 2 does not start on physical sector boundary.
Partition table entries are not in disk order.

Output from grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-4.18.15-1-default
Found initrd image: /boot/initrd-4.18.15-1-default
Found linux image: /boot/vmlinuz-4.18.14-1-default
Found initrd image: /boot/initrd-4.18.14-1-default
Found Debian GNU/Linux 9 (stretch) on /dev/sda1
done

I hope that it is helpful.

About what you asked me to do, the "update-grub" and "update-grub2" just shows "command not found" what I think is weird.
I used "cat /boot/grub2/grub.cfg" and the result is in this link (text file): https://drive.google.com/file/d/1sJvo5G ... sp=sharing
I didn't find any "debian" or "/dev/sda1" mention.
Here is the /etc/default/grub file (text file): https://drive.google.com/file/d/1OHNSWO ... sp=sharing
.
I don't know how I can check if the openSUSE GRUB boot loader actually uses /boot/grub2/grub.cfg as the config file.

Is there anything else I can do?

Thank you very much for your time!
fawkesjr
 
Posts: 6
Joined: 2018-10-08 20:32

Re: Grub does not detect Debian 9

Postby Head_on_a_Stick » 2018-11-03 07:23

The Debian installer ISO image has a "rescue mode" from which GRUB can be re-installed:

https://www.debian.org/releases/stable/ ... 07.html.en

We could work on adding Tumbleweed to Debian's GRUB menu afterwards.
I suffer from depression and may lash out occasionally, try not to take it personally.
User avatar
Head_on_a_Stick
 
Posts: 8169
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Grub does not detect Debian 9

Postby p.H » 2018-11-03 09:33

Sorry, no clue why grub-mkconfig detects Debian but does not add it in grub.cfg.
Quick and dirty workaroud : create a plain text file custom.cfg with the following contents in /boot/grub2/ (or whatever path which contains GRUB runtime files) :

Code: Select all
menuentry 'Debian core.img' {
   insmod part_msdos
   insmod ext4
   set root='hd0,msdos1'
   multiboot /boot/grub/core.img
}

menuentry 'Debian grub.cfg' {
   insmod part_msdos
   insmod ext4
   set root='hd0,msdos1'
   configfile /boot/grub/grub.cfg
}
p.H
 
Posts: 631
Joined: 2017-09-17 07:12

Re: Grub does not detect Debian 9

Postby fawkesjr » 2018-11-09 09:35

I solved my problem reinstalling grub2.
First, I removed grub2 using sudo zypper rm grub2 and accepting removing some packages that OpenSuse indicated. Then, I reinstalled grub2 with sudo zypper in grub2 *other packages that a removed before*.

Before rebooting the system, I used sudo grub2-mkconfig -o /boot/grub2/grub.cfg thinking that everything would reboot with no errors, but I was wrong.... The grub rescue mode opened and I could not fix the boot problem, so I downloaded an OpenSuse iso with another computer and installed it in a USB flash drive.

After rebooting with the USB I ran the following commands in the Rescue System mode:
#root
#fdisk -l
#mount /dev/sda3 /mnt (IN MY CASE OPENSUSE IS INSTALLED IN sda3)
#mount -o bind /proc /mnt/proc
#mount -o bind /dev /mnt/dev
#mount -o bind /sys /mnt/sys
#chroot /mnt
#grub2-mkconfig -o /boot/grub2/grub.cfg
#grub2-install /dev/sda (IN MY CASE IT WAS sda)
#exit
#reboot

When I finally rebooted my computer....Debian wasn't there again.... So I booted OpenSuse, opended the terminal and typed sudo grub2-mkconfig -o /boot/grub2/grub.cfg and rebooted again.

Finally Debian was listed in GRUB!!!!

That is what worked for me here.

Thank you for your time and for trying to help me!!
fawkesjr
 
Posts: 6
Joined: 2018-10-08 20:32


Return to Installation

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable