# grub2 - No bootable device

## Joseph_sys

I just installed gentoo on my new SSD (intel 480GB drive SSDSC2BF-480H501)

I mostly was installing everything over ssh (easier) and using grub2 but upon rebooting I get:

"No bootable device - Insert boot disk and press any key"

I boot strap to my system:

```
# swapon /dev/sda3

# mount -t ext4 /dev/sda4 /mnt/gentoo

# mount /dev/sda2 /mnt/gentoo/boot

# cd /mnt/gentoo

# mount -t proc none /mnt/gentoo/proc

# mount --rbind /dev /mnt/gentoo/dev # chroot /mnt/gentoo /bin/bash

# env-update

# source /etc/profile
```

If boot strap and try to start ssh I and get a warning (and can not login)

"You attempting to run an openrc service on a system which openrc did not boot

..."

I can ssh to the system before I boot I bootstrap

My partition:

```
fdisk -l /dev/sda

Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 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: gpt

Disk identifier: 37C37937-6310-4B04-93A6-05CD7792EF16

Device           Start          End   Size Type

/dev/sda1         2048         6143     2M BIOS boot partition

/dev/sda2         6144       268287   128M Linux filesystem

/dev/sda3       268288      4462591     2G Linux swap

/dev/sda4     4462592    937703054   445G Linux filesystem
```

sda2 - boot

sda4 - root

When I installed grub2 I got no errors:

```
grub2-install /dev/sda

Installation finished. No error reported.
```

but looking at grub2 configuration, it is looking for kernel on sda4 (shouldn't it be sda2?).

linux   /vmlinuz-3.14.14-gentoo root=/dev/sda4 ro single

```
### BEGIN /etc/grub.d/00_header ###

if [ -s $prefix/grubenv ]; then

 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

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_gpt

insmod ext2

set root='hd0,gpt4'

if [ x$feature_platform_search_hint = xy ]; then

 search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt4 --hint-efi=hd0,gpt4 --hint-baremetal=ahci0,gpt4  00e8b950-21c6-4558-918f-855042b42d36

else

 search --no-floppy --fs-uuid --set=root 00e8b950-21c6-4558-918f-855042b42d36

fi

   font="/usr/share/grub/unicode.pf2"

fi

if loadfont $font ; then

 set gfxmode=auto

 load_video

 insmod gfxterm

 set locale_dir=$prefix/locale

 set lang=en_US

 insmod gettext

fi

terminal_output gfxterm

if sleep --interruptible 0 ; then

 set timeout=10

fi

### END /etc/grub.d/00_header ###

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

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-00e8b950-21c6-4558-918f-855042b42d36' {

        load_video

        insmod gzio

        insmod part_gpt

        insmod ext2

        set root='hd0,gpt2'

        if [ x$feature_platform_search_hint = xy ]; then

          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  4fac7293-6a58-43a4-857b-6e3095a8e50d

        else

          search --no-floppy --fs-uuid --set=root 4fac7293-6a58-43a4-857b-6e3095a8e50d

        fi

        echo    'Loading Linux 3.14.14-gentoo ...'

        linux   /vmlinuz-3.14.14-gentoo root=/dev/sda4 ro  }

submenu 'Advanced options for Gentoo GNU/Linux' $menuentry_id_option 'gnulinux-advanced-00e8b950-21c6-4558-918f-855042b42d36' {

        menuentry 'Gentoo GNU/Linux, with Linux 3.14.14-gentoo' --class gentoo

--class gnu-linux --class gnu --class os $menuentry_id_option

'gnulinux-3.14.14-gentoo-advanced-00e8b950-21c6-4558-918f-855042b42d36' {

                load_video

                insmod gzio

                insmod part_gpt

                insmod ext2

                set root='hd0,gpt2'

                if [ x$feature_platform_search_hint = xy ]; then

                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  4fac7293-6a58-43a4-857b-6e3095a8e50d

                else

                  search --no-floppy --fs-uuid --set=root 4fac7293-6a58-43a4-857b-6e3095a8e50d

                fi

                echo    'Loading Linux 3.14.14-gentoo ...'

                linux   /vmlinuz-3.14.14-gentoo root=/dev/sda4 ro       }

        menuentry 'Gentoo GNU/Linux, with Linux 3.14.14-gentoo (recovery mode)'

--class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option

'gnulinux-3.14.14-gentoo-recovery-00e8b950-21c6-4558-918f-855042b42d36' {

                load_video

                insmod gzio

                insmod part_gpt

                insmod ext2

                set root='hd0,gpt2'

                if [ x$feature_platform_search_hint = xy ]; then

                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2  4fac7293-6a58-43a4-857b-6e3095a8e50d

                else

                  search --no-floppy --fs-uuid --set=root 4fac7293-6a58-43a4-857b-6e3095a8e50d

                fi

                echo    'Loading Linux 3.14.14-gentoo ...'

                linux   /vmlinuz-3.14.14-gentoo root=/dev/sda4 ro single        }

}

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

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

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

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

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

### 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 ###
```

Last edited by Joseph_sys on Fri Sep 05, 2014 1:53 pm; edited 1 time in total

----------

## sebB

```
/dev/sda2         6144       268287   128M Linux filesystem

/dev/sda2     4462592    937703054   445G Linux filesystem
```

Can you post your fstab?

----------

## Joseph_sys

 *sebB wrote:*   

> 
> 
> ```
> /dev/sda2         6144       268287   128M Linux filesystem
> 
> ...

 

My BIOS is from around 2008 so it is not EFI type.

```
cat /etc/fstab

/dev/sda2      /boot      ext2      noauto,noatime   1 2

/dev/sda4      /      ext4      defaults,relatime,discard   0 1

/dev/sda3      none      swap      sw,pri=3,discard      0 0

# for USB stick camera devices

/dev/sdb1   /media/stick   auto   noauto,rw,users,exec    0 0

/dev/sdc1   /media/stick   auto   noauto,rw,users,exec,umask=0077    0 0

shm          /dev/shm    tmpfs       defaults,nodev,nosuid,mode=1777 0 0
```

----------

## sebB

Did you run ?

```
grub2-mkconfig -o /boot/grub/grub.cfg
```

----------

## Joseph_sys

 *sebB wrote:*   

> Did you run ?
> 
> ```
> grub2-mkconfig -o /boot/grub/grub.cfg
> ```
> ...

 

Yes, I did.  

```
grub2-mkconfig -o /boot/grub/grub.cfg

Generating grub.cfg ...

Found linux image: /boot/vmlinuz-3.14.14-gentoo

done
```

----------

## Joseph_sys

I think my problem is I have a GPT partition and old BIOS 2008 system so I can not use EIF

I make /dev/sda1 as BIOS boot partition but it is not mark with "*" as bootable in addition I fink it need to be formatted as DOS isn't it?

I do not dual boot.

----------

## NeddySeagoon

Joseph_sys,

With a GPT partition and old BIOS 2008 system, you need to set the bootable flag on the protective MSDOS partition.  Thats all your BIOS can see.

Use an older fdisk and ignore the dire warning about a GPT partition table being detected.

You are only changing a flag, which is quite safe.

Setting the bootable flag on one of the GPT partitions is totally ineffective, as the BIOS can't see it.

----------

## Joseph_sys

 *NeddySeagoon wrote:*   

> Joseph_sys,
> 
> With a GPT partition and old BIOS 2008 system, you need to set the bootable flag on the protective MSDOS partition.  Thats all your BIOS can see.
> 
> Use an older fdisk and ignore the dire warning about a GPT partition table being detected.
> ...

 

Thank you, which version of "gptfdisk" will allow me to do that?

current gptfdisk-0.8.8 contain fdisk = util-linux 2.24.1

In addition I'm in chroot evn. and booted from ISO.

----------

## NeddySeagoon

Joseph_sys,

I don't know version numbers - sorry.

Until recently ordinary fdisk was good for this. Now it understands GPT, it will only show you the GPT.

If all else fails a hex editor will work.

----------

## kglos

Hello!

I know that years passed by, but... if it would help anyone still seeking…

You have to fire up fdisk:

fdisk /dev/sda

It's gonna see your gpt layout, so who have to switch to MBR view mode with 'M' command

now you can check with 'p' command, you should see something like:

device      boot    begining   end …

/dev/sda1           1              ……

This single partition (seen as of MBR) is to cheat other legacy partition programs, so they/you don't overwrite your GPT layout by mistake

Now make this bootable with 'a' command and write this with 'w'.

It worked for me.

----------

