Install bootloader in sdb5

Hi
I used the rescue cd to mount sdb5 and chroot into opensuse (wich is installed in the logical /root partition sdb5). Here I was trying to install the boot loader:

grub2-install /dev/sdb5

but got the following error message:

error cannot find a device for /boot/grub2 (is /dev mounted?)

After installing opensuse as in a dualboot with manjaro(sdb1), opensuse´s bootloader was installed in sdb1 and overtook the boot menue without being able to boot manjaro. Now after trying to solve it, manjaro´s boot menu is back but opensuse doesnt apear there. Thats why I´m trying to install bootloader in sdb5.

What am I doing wrong?

You need to mount /dev, /proc and /sys in chroot.

Thanks for the help!
I tried that, but still got the same error message (“cannot find a device for /boot/grub2 (is /dev mounted?)”)
Is anything missing here?


root
mount /dev/sdb5 /mnt
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
chroot /mnt

:\

A bit of a wild guess, but imho you can not install to a logical partition. You can to the extended partition. Based on my memory that the installer offers to install Grub on the MBR, the root partition or the extended partition. But my memory may be lousy.

The sequence should be:

mount /dev/sdb5 /mnt
mount --bind /dev /mnt/dev
chroot /mnt
mount -t proc proc /proc
mount -t sysfs sysfs /sys
grub2-mkconfig -o /boot/grub2/grub.cfg
grub2-install /dev/sdb5

… but, this is not a UEFI system, is it? If you are using EFI, there are differences in the above commands.

You might, though – as Henk suggests – be better off installing it the the Extended partition.

An additional comment.

Yes, you can install to “/dev/sdb5”. But it might not work, because typical boot code does not look at logical partitions. Hence the suggestion to install to the extended partition.

Also, the command would probably need to be:

grub2-install --force /dev/sdb5

Unless installing to the MBR, you probably need the “–force”. Otherwise you will get an error saying why it is unwise to do that.

And, as Fraser_Bell indicated, if you have a UEFI system then you need a different command to install and you need the EFI partition to be mounted.

Is /boot on separate partition?

No, it should not. Do not confuse newbies even more.

Hi
Reading your suggestions i tried to install grub in the extended partition (sdb3) but without success. Trying to mount sdb3 (mount /dev/sdb3 /mnt) ended up with:

mount.bin: /dev/sdb3 is write-protected, mounting read only
mount.bin: wrong fs type, bad option, bad superblock on /dev/sdb3,
missing codepage or helper program, or other error

trying to install grub (grub2-install --force /dev/sdb3):

error: unable to identify a filesystem in hd0: safety check can´t be performed

-I´m using a bios system
-there is no seperate boot partition
I hope there is an easy solution for that…
?

When sdb3 is the extended partiotion, NO, you can not mount it.
It maybe better to first post your partition table so everybody can have something to focus on:

su -l -c 'fdisk -l'

Here is su -l -c ‘fdisk -l’

Disk /dev/sda: 298,1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf8000000

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 413884415 413882368 197,4G  7 HPFS/NTFS/exFAT
/dev/sda2       413884416 414806015    921600   450M 27 Hidden NTFS WinRE


Disk /dev/sdb: 298,1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x5458e456

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1            2048 276975615 276973568 132,1G 83 Linux
/dev/sdb2       276975616 295407615  18432000   8,8G 82 Linux swap / Solaris
/dev/sdb3       295407616 625135615 329728000 157,2G  5 Extended
/dev/sdb5       295409664 379293695  83884032    40G 83 Linux
/dev/sdb6       379295744 625135615 245839872 117,2G 83 Linux                                                                                                                                                                                
                                                                    

That is real info! Thanks.

I am not that good at the combination of multi-boot and different system disks. But some here are. Thus just wait.

I the mean time you could explain what the partitions on sdb are used for.
sdb32 is for swap.
sdb3 is extended.
But which of them is for / and what are the other two for.

You would not mount sdb3. The above instructions were based on sdb5 being root, which I think it is. Is it?

You need to mount the root partition. If the root partition is sdb5, then:

mount /dev/sdb5 /mnt

Then you install grub to sdb3 (the extended partition), using the --force option as nrickert says.

You will also need to set the boot flag to the extended partition.

You are using a DOS/MBR partitioning scheme, which is why you need to set the boot flag.

To set the boot flag:

While still in the rescue system (or, go back into the rescue system if you left it), do:

parted

You will now have a prompt
(parted)
Do:

select /dev/sdb

You should get a confirmation message that the device is now selected.
Do:

set 3 boot

That is to set/reset the 3rd (extended) partition’s boot flag.
It will prompt you with the line New state?
Do:

on

When it is confirmed, do:

quit

You will be back at the Rescue:~# prompt.
You can now do:

reboot

… well, considering I have done this hundreds of times and it has always worked, it is a good thing I did not know that.:wink:

Usually this works. The message is absolutely weird (I do not even know how to produce it, it implies /proc/self/mountinfo is missing which falls under “cannot happen”). Could you show content of /proc/self/mountinfo in chroot as well as make available output of “ls -l /boot” and “ls -lR /dev”?

Here the outputs:

/proc/self/mountinfo

/proc/self/mountinfo: Premition denied

ls -l /boot

insgesamt 32604
drwxr-xr-x 6 root root 4096 5. Apr 20:09 grub
-rw-r–r-- 1 root root 21468280 3. Apr 13:53 initramfs-4.9-x86_64-fallback.img
-rw-r–r-- 1 root root 6010647 3. Apr 13:53 initramfs-4.9-x86_64.img
-rw-r–r-- 1 root root 983552 15. Nov 18:43 intel-ucode.img
-rw-r–r-- 1 root root 21 31. Mär 19:54 linux49-x86_64.kver
drwxr-xr-x 2 root root 4096 3. Aug 2016 memtest86+
-rw-r–r-- 1 root root 4900640 31. Mär 19:54 vmlinuz-4.9-x86_64

ls -lR /dev (partly):

/dev:
insgesamt 0
lrwxrwxrwx  1 root root          15  6. Apr 16:20 android -> bus/usb/001/004
crw-------  1 root root     10, 235  6. Apr 16:20 autofs
drwxr-xr-x  2 root root         240  6. Apr 16:20 block
drwxr-xr-x  2 root root         100  6. Apr 16:20 bsg
crw-rw----  1 root disk     10, 234  6. Apr 16:20 btrfs-control
drwxr-xr-x  3 root root          60  6. Apr 16:20 bus
lrwxrwxrwx  1 root root           3  6. Apr 16:49 cdrom -> sr0
drwxr-xr-x  2 root root        3500  6. Apr 16:21 char
crw-------  1 root root      5,   1  6. Apr 16:20 console
lrwxrwxrwx  1 root root          11  6. Apr 16:20 core -> /proc/kcore
drwxr-xr-x  2 root root          60  6. Apr 16:20 cpu
crw-------  1 root root     10,  62  6. Apr 16:20 cpu_dma_latency
crw-------  1 root root     10, 203  6. Apr 16:20 cuse
drwxr-xr-x  6 root root         120  6. Apr 16:49 disk
drwxr-xr-x  2 root root         100  6. Apr 16:20 dri
crw-------  1 root root    242,   0  6. Apr 16:20 drm_dp_aux0
crw-------  1 root root    242,   1  6. Apr 16:20 drm_dp_aux1
crw-r--r--  1 root root     29,   0  6. Apr 16:20 fb
crw-rw----  1 root video    29,   0  6. Apr 16:20 fb0
lrwxrwxrwx  1 root root          13  6. Apr 16:20 fd -> /proc/self/fd
crw-rw-rw-  1 root root      1,   7  6. Apr 16:20 full
crw-rw-rw-  1 root root     10, 229  6. Apr 16:21 fuse
crw-------  1 root root    248,   0  6. Apr 16:20 fw0
crw-------  1 root root    254,   0  6. Apr 16:20 gpiochip0
crw-------  1 root root    247,   0  6. Apr 16:20 hidraw0
crw-------  1 root root    247,   1  6. Apr 16:20 hidraw1
crw-rw----  1 root audio    10, 228  6. Apr 16:20 hpet
drwxr-xr-x  2 root root           0  6. Apr 16:20 hugepages
lrwxrwxrwx  1 root root          25  6. Apr 16:20 initctl -> /run/systemd/initctl/fifo                                                                                                                                                       
drwxr-xr-x  4 root root         520  6. Apr 16:20 input                                                                                                                                                                                      
crw-------  1 root root    241,   0  6. Apr 16:20 kfd                                                                                                                                                                                        
crw-r--r--  1 root root      1,  11  6. Apr 16:20 kmsg                                                                                                                                                                                       
crw-rw----+ 1 root root     10, 232  6. Apr 16:20 kvm                                                                                                                                                                                        
lrwxrwxrwx  1 root root          28  6. Apr 16:20 log -> /run/systemd/journal/dev-log                                                                                                                                                        
crw-rw----  1 root disk     10, 237  6. Apr 16:20 loop-control                                                                                                                                                                               
drwxr-xr-x  2 root root          60  6. Apr 16:20 mapper                                                                                                                                                                                     
crw-------  1 root root     10, 227  6. Apr 16:20 mcelog                                                                                                                                                                                     
crw-------  1 root root    240,   0  6. Apr 16:20 media0                                                                                                                                                                                     
crw-r-----  1 root kmem      1,   1  6. Apr 16:20 mem                                                                                                                                                                                        
crw-------  1 root root     10,  59  6. Apr 16:20 memory_bandwidth                                                                                                                                                                           
drwxrwxrwt  2 root root          40  6. Apr 16:20 mqueue                                                                                                                                                                                     
drwxr-xr-x  2 root root          60  6. Apr 16:20 net                                                                                                                                                                                        
crw-------  1 root root     10,  61  6. Apr 16:20 network_latency                                                                                                                                                                            
crw-------  1 root root     10,  60  6. Apr 16:20 network_throughput                                                                                                                                                                         
crw-rw-rw-  1 root root      1,   3  6. Apr 16:20 null                                                                                                                                                                                       
crw-r-----  1 root kmem      1,   4  6. Apr 16:20 port                                                                                                                                                                                       
crw-------  1 root root    108,   0  6. Apr 16:20 ppp                                                                                                                                                                                        
crw-------  1 root root     10,   1  6. Apr 16:20 psaux                                                                                                                                                                                      
crw-rw-rw-  1 root tty       5,   2  6. Apr 16:56 ptmx                                                                                                                                                                                       
drwxr-xr-x  2 root root           0  6. Apr 16:20 pts                                                                                                                                                                                        
crw-rw-rw-  1 root root      1,   8  6. Apr 16:20 random                                                                                                                                                                                     
crw-rw-r--+ 1 root rfkill   10,  58  6. Apr 16:20 rfkill                                                                                                                                                                                     
lrwxrwxrwx  1 root root           4  6. Apr 16:20 rtc -> rtc0                                                                                                                                                                                
crw-rw----  1 root audio   251,   0  6. Apr 16:20 rtc0                                                                                                                                                                                       
brw-rw----  1 root disk      8,   0  6. Apr 16:20 sda
brw-rw----  1 root disk      8,   1  6. Apr 16:20 sda1
brw-rw----  1 root disk      8,   2  6. Apr 16:20 sda2
brw-rw----  1 root disk      8,  16  6. Apr 16:20 sdb
brw-rw----  1 root disk      8,  17  6. Apr 16:20 sdb1
brw-rw----  1 root disk      8,  18  6. Apr 16:20 sdb2
brw-rw----  1 root disk      8,  19  6. Apr 16:20 sdb3
brw-rw----  1 root disk      8,  21  6. Apr 16:20 sdb5
brw-rw----  1 root disk      8,  22  6. Apr 16:20 sdb6
crw-rw----  1 root disk     21,   0  6. Apr 16:20 sg0
crw-rw----+ 1 root optical  21,   1  6. Apr 16:20 sg1
crw-rw----  1 root disk     21,   2  6. Apr 16:20 sg2
drwxrwxrwt  2 root root          40  6. Apr 16:55 shm
crw-------  1 root root     10, 231  6. Apr 16:20 snapshot
drwxr-xr-x  4 root root         340  6. Apr 16:20 snd
brw-rw----+ 1 root optical  11,   0  6. Apr 16:49 sr0
lrwxrwxrwx  1 root root          15  6. Apr 16:20 stderr -> /proc/self/fd/2
lrwxrwxrwx  1 root root          15  6. Apr 16:20 stdin -> /proc/self/fd/0
lrwxrwxrwx  1 root root          15  6. Apr 16:20 stdout -> /proc/self/fd/1
crw-rw-rw-  1 root tty       5,   0  6. Apr 16:20 tty
crw--w----  1 root tty       4,   0  6. Apr 16:20 tty0
crw--w----  1 root tty       4,   1  6. Apr 16:20 tty1
crw--w----  1 root tty       4,  10  6. Apr 16:20 tty10
crw--w----  1 root tty       4,  11  6. Apr 16:20 tty11
crw--w----  1 root tty       4,  12  6. Apr 16:20 tty12
crw--w----  1 root tty       4,  13  6. Apr 16:20 tty13
crw--w----  1 root tty       4,  14  6. Apr 16:20 tty14
crw--w----  1 root tty       4,  15  6. Apr 16:20 tty15
crw--w----  1 root tty       4,  16  6. Apr 16:20 tty16
crw--w----  1 root tty       4,  17  6. Apr 16:20 tty17
crw--w----  1 root tty       4,  18  6. Apr 16:20 tty18
crw--w----  1 root tty       4,  19  6. Apr 16:20 tty19
crw--w----  1 root tty       4,   2  6. Apr 16:20 tty2
crw--w----  1 root tty       4,  20  6. Apr 16:20 tty20
crw--w----  1 root tty       4,  21  6. Apr 16:20 tty21
crw--w----  1 root tty       4,  22  6. Apr 16:20 tty22
crw--w----  1 root tty       4,  23  6. Apr 16:20 tty23
crw--w----  1 root tty       4,  24  6. Apr 16:20 tty24
crw--w----  1 root tty       4,  25  6. Apr 16:20 tty25
crw--w----  1 root tty       4,  26  6. Apr 16:20 tty26
crw--w----  1 root tty       4,  27  6. Apr 16:20 tty27
crw--w----  1 root tty       4,  28  6. Apr 16:20 tty28
crw--w----  1 root tty       4,  29  6. Apr 16:20 tty29
crw--w----  1 root tty       4,   3  6. Apr 16:20 tty3
crw--w----  1 root tty       4,  30  6. Apr 16:20 tty30
crw--w----  1 root tty       4,  31  6. Apr 16:20 tty31
crw--w----  1 root tty       4,  32  6. Apr 16:20 tty32
crw--w----  1 root tty       4,  33  6. Apr 16:20 tty33
crw--w----  1 root tty       4,  34  6. Apr 16:20 tty34
crw--w----  1 root tty       4,  35  6. Apr 16:20 tty35
crw--w----  1 root tty       4,  36  6. Apr 16:20 tty36
crw--w----  1 root tty       4,  37  6. Apr 16:20 tty37
crw--w----  1 root tty       4,  38  6. Apr 16:20 tty38
crw--w----  1 root tty       4,  39  6. Apr 16:20 tty39
crw--w----  1 root tty       4,   4  6. Apr 16:20 tty4
crw--w----  1 root tty       4,  40  6. Apr 16:20 tty40
crw--w----  1 root tty       4,  41  6. Apr 16:20 tty41
crw--w----  1 root tty       4,  42  6. Apr 16:20 tty42
crw--w----  1 root tty       4,  43  6. Apr 16:20 tty43
crw--w----  1 root tty       4,  44  6. Apr 16:20 tty44
crw--w----  1 root tty       4,  45  6. Apr 16:20 tty45
crw--w----  1 root tty       4,  46  6. Apr 16:20 tty46
crw--w----  1 root tty       4,  47  6. Apr 16:20 tty47
crw--w----  1 root tty       4,  48  6. Apr 16:20 tty48
crw--w----  1 root tty       4,  49  6. Apr 16:20 tty49
crw--w----  1 root tty       4,   5  6. Apr 16:20 tty5
crw--w----  1 root tty       4,  50  6. Apr 16:20 tty50
crw--w----  1 root tty       4,  51  6. Apr 16:20 

It is not executable. You need to show content of this file. “cat /proc/self/mountinfo”.

ls -l /boot

I am not sure why this forum strips off some content, but it does not look like openSUSE /boot at all - neither kernel names, nor lack of /boot/grub2 in the first place. I asked you output from your chroot into openSUSE filesystem. You apparently show something from your live system.

ls -lR /dev (partly):

If you manage to get content of /proc/self/mountinfo, please, provide full output, so it can be matched against each other.

The output of ls -lR /dev is very long…is there a way to save it in a file when I´m in chroot?