# [SOLVED] grub and UUID

## kingfame_147

Hi,

does anybody has an idea why I can't use UUID with my grub?

```

title Gentoo Linux 2.6.35-r4

root (hd0,0)

kernel /boot/kernel-2.6.35-gentoo-r4 root=UUID=5ff86376-732b-48c1-a384-e2fbdd7a5727 video=2560x1600

savedefault

```

```

scooter ~ # grub --version

grub (GNU GRUB 0.97)

```

```

scooter by-uuid # blkid | grep sdb4

/dev/sdb4: UUID="5ff86376-732b-48c1-a384-e2fbdd7a5727" UUID_SUB="af3c37dc-4d8e-4a11-946d-ba8410c4937c" TYPE="btrfs" 

```

I've no clue why it doesn"t work.

Thanks for your thoughts on that one.

Regards,

fameLast edited by kingfame_147 on Sun Aug 29, 2010 8:58 pm; edited 1 time in total

----------

## Gusar

You're not using an initrd, that's your issue. UUID and LABEL stuff is not handled by the kernel, it's handled inside the initrd, which converts UUID or LABEL into the appropriate /dev/sdXY

----------

## NeddySeagoon

kingfame_147,

The kernel does not understand UUID itself. You need an initrd to make that work, so you can call mount before the root filesystem is mounted.

----------

## kingfame_147

I thought the gentoo kernel uses some kind of default initrd which is inside the kernel.

I used busybox some time ago to mount / as an aes encrypted device, but there were  no UUID available per default, I had to create those links by myself inside the init script using blkid etc.

What kind of initrd should I use for that task? I only want to use UUID/LABEL, nothing more :)

Edit:

Ok, I found the gentoo initrd guide with the information I need. Thanks for the help.

I thought that those uuids are avaible per default, like in centos etc. I was wrong :)

----------

## kingfame_147

Hi,

back again with a new problem :D

I setup my busybox with a init script etc.

The problem now is that within the busybox the UUID from the root device isn't there. If I boot into the busybox and do a 'blkid' all devices are there expect the root device o_0 Therefore 'findfs' can't find the device with the given UUID. Any idea?

I'm using mdev like mentioned in the tutorial. /dev/sdb4 (which is my root device) is avaible in the busybox and I can boot normaly when using root=/dev/sdb4.

After booting the gentoo system blkid shows the UUID of the root device. Btw: The root device uses btrfs as the fs.

Regards,

fame

----------

## AdmiralNemo

Check out the Initramfs article on the Gentoo Wiki. It discusses exactly what you want to do.

----------

## kingfame_147

 *AdmiralNemo wrote:*   

> Check out the Initramfs article on the Gentoo Wiki. It discusses exactly what you want to do.

 

Did you read my last post?

I allready read that article. The problem is that in the busybox 'blkid' doesn't show my root device and therefore 'findfs' can't find the right device for the givcen UUID/LABEL.

----------

## xaviermiller

Hello,

Did you tried genkernel ? It has an option to use UUIDs to determine root.

And no, genkernel is not only done for dummies  :Wink: 

----------

## skellr

If genkernel has support for btrfs that would be quick.

 *kingfame_147 wrote:*   

> I'm using mdev like mentioned in the tutorial. /dev/sdb4 (which is my root device) is avaible in the busybox and I can boot normaly when using root=/dev/sdb4.
> 
> After booting the gentoo system blkid shows the UUID of the root device. Btw: The root device uses btrfs as the fs.

 

I can't help you with mdev. But another option is to copy the device nodes you need from /dev into your initramfs. cp -a should do it.

And a warning about using busybox. It gives little to no error messages! If you get stuck you might want to try creating your initramfs from the programs on your system like 'bash, blkid, btrfsctl, mount, etc...' They will tell you more about what is going on. Just use ldd to find the libs they need. They are 'big' but this isn't an embedded device.  :Smile: 

----------

## kingfame_147

 *skellr wrote:*   

> If genkernel has support for btrfs that would be quick.
> 
>  *kingfame_147 wrote:*   I'm using mdev like mentioned in the tutorial. /dev/sdb4 (which is my root device) is avaible in the busybox and I can boot normaly when using root=/dev/sdb4.
> 
> After booting the gentoo system blkid shows the UUID of the root device. Btw: The root device uses btrfs as the fs. 
> ...

 

That is WAY to mutch work. I only need the initrd for mount / with a UUID/LABEL :)

Copy the device nodes doesn't make sense, because then I can't use UUID/LABEL if the device node changes (booting with a usb device plugged in or something like that).

----------

## skellr

 *kingfame_147 wrote:*   

> Copy the device nodes doesn't make sense, because then I can't use UUID/LABEL if the device node changes (booting with a usb device plugged in or something like that).

 

I'd at least put /dev/btrfs-controll , or whatever it's named, in there. I wouldn't trust mdev to make it... yet.

----------

## kingfame_147

 *skellr wrote:*   

>  *kingfame_147 wrote:*   Copy the device nodes doesn't make sense, because then I can't use UUID/LABEL if the device node changes (booting with a usb device plugged in or something like that). 
> 
> I'd at least put /dev/btrfs-controll , or whatever it's named, in there. I wouldn't trust mdev to make it... yet.

 

That doesn't help :/ I'm wondering why there is no UUID of that btrfs filesystem if busybox is able to mount it.

I'll do a test: I'll make a btrfs pen drive and look if there is a UUID. If there is none it is definitly a btrfs related problem with the busybox.

Edit:

As I excepted: no UUID for the btrfs pendrive. Seems to be a busybox/btrfs issue. I'll try to talk to the busybox developer.

----------

## kingfame_147

Oook, it seems that the "bug" is solved in 1.17.1-r1. I tried it with that new version and the UUID is there :)

----------

