# [SOLVED]Booting without initramfs

## AndrewAmmerlaan

Hi

When I first installed gentoo, I used genkernel, because my manual configuration weren't working. Now the kernel boots fine, but because I used genkernel I now have a initramfs. There's nothing wrong with this, but when I change kernel configuration, and rebuild the kernel, I keep forgetting to install a initramfs, which results in a un-bootable system. without initramfs, I keep getting asked where the root device is (it asks for a UUID). Just to make stuff easier for me, I decided that I would try to make the kernel boot without initramfs, but so far I've been unsuccessful. I'm quite sure that the kernel can boot without initramfs on my system, I have a very simple partition lay-out

sda1   swap          8gb

sda2   /                the rest

sda3  bios_grub    tiny

I think I have the right stuff enabled in the kernel, otherwise, it wouldn't ask me about the root partition anyway, right?

I looked through the kernel config file, but there's nothing there, that looks like it can be set to point to the root partition.

I did read something about setting root= in grub, but I can't seem to find exactly where I should set this value. 

There probably is something very obvious I missed.

Any help will be appreciated

Andrew

----------

## NeddySeagoon

AndrewAmmerlaan,

On the kernel line, add root=/dev/sd...  in place of your root=UUID=

This will break if your BIOS enumerates USB storage before internal hard drives and USD devices came and go.

You can also use PARTUUID which is like the filesystem UUID only it applies to partitons. The kernel understands this itself.

Try blkid

MSDOS Partitions will show something like

```
/dev/sda1: UUID="9392926d-6408-6e7a-8663-82834138a597" TYPE="linux_raid_member" PARTUUID="0553caf4-01"
```

and GPT Partitions

```
/dev/sde1: UUID="6896bc7a-a5ac-455c-a091-ddde1a3d5f0a" TYPE="ext4" PARTLABEL="boot" PARTUUID="11e282f4-2f24-4939-bbc6-ca3eabc15961"
```

Beware the MSDOS case PARTUUID="0553caf4-01"  is the Volume number followed by the partition number.  Thas reasonably safe for primary partitions but it can change in the case of extended partiions.

----------

## AndrewAmmerlaan

 *NeddySeagoon wrote:*   

> AndrewAmmerlaan,
> 
> On the kernel line, add root=/dev/sd...  in place of your root=UUID=
> 
> This will break if your BIOS enumerates USB storage before internal hard drives and USD devices came and go.
> ...

 

Okay, but where can I edit this, I found several sources on the Internet, that say I should add root= to GRUB_CMDLINE_LINUX_DEFAULT= , but that would make it default for all entries, wouldn't it?, and I can't find root=UUID, in /etc/default/grub. I think I know what to do, but I can't figure out where to do it. /etc/default/grub, or some other file? I looked at /boot/grub/grub.cfg, but I can't figure out how that file works.

```
Andrew-Gentoo ~ # blkid

/dev/sda1: UUID="83359f6b-78ac-4d0f-81da-01aa7960c2e6" TYPE="swap" PARTLABEL="swap" PARTUUID="cf4d7e62-caa3-4b69-b27c-73497a9aa2e3" 

/dev/sda2: UUID="d66e364f-e3fb-4c5d-989c-c858c4b8b2f6" TYPE="ext4" PARTLABEL="gentoo" PARTUUID="145158e4-9d89-4b5b-be72-e204495fcb2a" 

/dev/sda3: PARTLABEL="grub" PARTUUID="55c7fca8-f99a-4626-ae8d-e90281be865e" 

```

so, I could also set root=145158e4-9d89-4b5b-be72-e204495fcb2a ?

I did find this in /etc/default/grub

```
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel

#GRUB_DISABLE_LINUX_UUID=true
```

So, I could either leave this commented and use root=145158e4-9d89-4b5b-be72-e204495fcb2a, or uncomment it and use root=/dev/sda2. however this still leaves me with the question of, where I add root=xxxx

----------

## AndrewAmmerlaan

So, I decided to just try it, but now I can't boot anymore. Kernel panic can't mount sda2 on unknown-block(0,0)

Looking at the grub entry:

```

setparms 'Gentoo GNU/Linux'

load_video

set gfxpayload=keep

insmod gzio

insmod part_gpt

insmod ext2        <-- this is weird the root partition is ext4

set root='hd0,gpt2'    <-- okay hd0 second partition so far so good

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 -\

-hint='hd0,gpt2' d66e364f-e3fb-4c5d-989c-c858c4b8b2f6

else

search --no-floppy --fs-uuid --set=root d66e364f-e3fb-4c5d-989c-c858c4b8b2f6

fi

echo 'Loading Linux 3.16.5-gentoo ...'

linux /boot/vmlinuz-3.16.5-gentoo root=/dev/sda2 ro resume=/dev/sda1 root=/dev/sda2 <-- why is this double

```

Where did I go wrong? If i change ext2 to ext4: error: file /something-that-goes-away-to-fast-ext4.mod

Also changing /dev/sda2 to hd0,gpt2 doesn't work. How is it that resume always worked, but adding root= the same way doesn't work?

I'm very confused, I edited the kernel to include some stuff that was a module before, and now the error message changes, form asking for a UUID, to kernel panic without a initramfs. I made sure SATA, and ext4 are included, and still it doesn't work

EDIT: I found my live-cd and chrooted into my system, and added a initramfs, now my system boots again, but I'm stuck where I started.

EDIT2: while looking at /boot/grub/grub.cfg, I noticed that the entry for gentoo, is slightly different, than when viewing it from inside grub itself (or installing initramfs changed it, apart from adding the initramfs entry)

```
 

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-d66e364f-e3fb-4c5d-989c-c858c4b8b2f6' {

   load_video

   set gfxpayload=keep

   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 --hint='hd0,gpt2'  d66e364f-e3fb-4c5d-989c-c858c4b8b2f6

   else

     search --no-floppy --fs-uuid --set=root d66e364f-e3fb-4c5d-989c-c858c4b8b2f6

   fi

   echo   'Loading Linux 3.16.5-gentoo ...'

   linux   /boot/vmlinuz-3.16.5-gentoo root=UUID=d66e364f-e3fb-4c5d-989c-c858c4b8b2f6 ro resume=/dev/sda1 root=/dev/sda2  <--so the first root= is actually the UUID, and the second is only added by the entry I added to /etc/default/grub

   echo   'Loading initial ramdisk ...'

   initrd   /boot/initramfs-genkernel-x86_64-3.16.5-gentoo

```

----------

## jonathan183

I suggest you check the drivers to access your root partition are built in to the kernel (not modules). Boot from genkernel and use lspci -vnn to identify the modules used to access your hard drive, then make sure they are compiled into the kernel corresponding entry Y or * rather than M in the manual kernel config. If you use make nconfig you can use F8 to search for the relevant entry  :Wink: 

----------

## NeddySeagoon

AndrewAmmerlaan'

Ah ... grub2.  That's a solution looking for a problem to solve.

You need to get root=PARTUUID= onto the kernel command line. With grub1, you edit the config file directly.

I don't use grub2.

----------

## AndrewAmmerlaan

 *jonathan183 wrote:*   

> I suggest you check the drivers to access your root partition are built in to the kernel (not modules). Boot from genkernel and use lspci -vnn to identify the modules used to access your hard drive, then make sure they are compiled into the kernel corresponding entry Y or * rather than M in the manual kernel config. If you use make nconfig you can use F8 to search for the relevant entry 

 

I thought I did that, but apparently I missed some. I'm not able to find all the kernel modules that lspci -vnn displays,  ivb_uncore and fglrx can't be found, fglrx is of course third party, so it wouldn't be in here, but ivb_uncore belongs to

 *Quote:*   

> 00:00.0 Host bridge [0600]: Intel Corporation 3rd Gen Core processor DRAM Controller [8086:0154] (rev 09)
> 
>         Subsystem: Toshiba America Info Systems Device [1179:fb31]
> 
>         Flags: bus master, fast devsel, latency 0
> ...

 

I wonder if this could cause a problem. There are also some devices where Kernel modules: isn't specified, can this cause a problem.

nconfig is great, I was using xconfig, but I like this better, thanks.

 *NeddySeagoon wrote:*   

> AndrewAmmerlaan'
> 
> Ah ... grub2.  That's a solution looking for a problem to solve.
> 
> You need to get root=PARTUUID= onto the kernel command line. With grub1, you edit the config file directly.
> ...

 

My mistake, I didn't specify which bootloader I am using. There already was a root=PARTUUID entry, but it's not the one displayed by blkid, however, when pressing e to edit the line at grub, it changes to /dev/sda2, even though the PARTUUID is not the right one according to blkid.

EDIT: hmmm....this new kernel hangs a little on determining root device, but hangs shorter on waiting for uvents to be proccesed.

----------

## AndrewAmmerlaan

Thanks very much, this new kernel works after removing initramfs. Thank you both for the help, I appreciat it very much. Now I don't have to worry about forgeting to install initramfs anymore. Only one problem, sound and bluetooth stopped working, I probably have the sound driver compiled as module. Is there a way to easily figure out which modules these are? I don't think it was one of the modules displayed in lspci -vnn, becuase I include all of these.

----------

## NeddySeagoon

AndrewAmmerlaan,

You need to bookmark this page.

----------

## AndrewAmmerlaan

 *NeddySeagoon wrote:*   

> AndrewAmmerlaan,
> 
> You need to bookmark this page.

 

Thank you, that makes this loads easier, just one more question, I can't seem to find it on that page, does yes mean the device is working, or that the device is supported by the kernel?

----------

## AndrewAmmerlaan

I'm not sure what I did, but it's working again now. Thanks you very much.

----------

