# initramfs problem: /bin/sh: blkid: permission denied[SOLVED]

## truc

Hello,

I'm desperate!  :Laughing:   I've done this many times in the past but cannot make a simple initramfs working. my '/init is starting correctly (/bin/sh -> /bin/busybox(static)), but I can not run any other binary, i get the following message(this is for blkid, but I get similar messages for cryptsetup and lvm also included in the 'system')

```
/bin/sh: blkid: permission denied
```

then I am back at the 'rescue shell' prompt, I still can't start any executables(other than busybox) and I don't see anything wrong with the permission which are as described in the file below

Here is some more information:

```
$ ldd /sbin/blkid

        linux-vdso.so.1 =>  (0x00007fff11fff000)

        libblkid.so.1 => /lib/x86_64-linux-gnu/libblkid.so.1 (0x00007fe4e7c3b000)

        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe4e78b4000)

        libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007fe4e76ae000)

        /lib64/ld-linux-x86-64.so.2 (0x00007fe4e7e7f000)
```

 *Quote:*   

> # my initramfs definition
> 
> dir /dev 0755 0 0
> 
> nod /dev/console 0600 0 0 c 5 1
> ...

 

And this is the start of the /init script:

```
#!/bin/sh

export PATH=/bin:/sbin

#crypted -> (sda4)

uuid_crypted=f14c1625-9e43-4041-9c22-c95c75eee308

root_dev=/dev/vg_tosh/lv_deb_root

rescue_shell() {

    echo "Something went wrong. Dropping you to a shell."

    busybox --install -s

    exec /bin/sh

}

echo "mounting procfs&sysfs"

mount -t proc proc /proc

mount -t sysfs sysfs /sys

echo "populating /dev with mdev"

echo /sbin/mdev > /proc/sys/kernel/hotplug

mdev -s

dev_crypted=$(blkid -U "$uuid_crypted")

[ -z "$dev_crypted" ] && rescue_shell

echo "$uuid_crypted -> $dev_crypted"

```

I stop here since the script doesn't go any further!

Last time I played with initramfs, I think I had static binaries, so the problem may be related to this.

```
$ /sbin/ldconfig -C ld.so.cache -p

17 libs found in cache `ld.so.cache'

        libuuid.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libuuid.so.1

        libudev.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libudev.so.0

        libtinfo.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libtinfo.so.5

        libselinux.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libselinux.so.1

        librt.so.1 (libc6,x86-64, OS ABI: Linux 2.6.26) => /lib/x86_64-linux-gnu/librt.so.1

        libreadline.so.5 (libc6,x86-64) => /lib/x86_64-linux-gnu/libreadline.so.5

        libpthread.so.0 (libc6,x86-64, OS ABI: Linux 2.6.26) => /lib/x86_64-linux-gnu/libpthread.so.0

        libpopt.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libpopt.so.0

        libgpg-error.so.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgpg-error.so.0

        libgcrypt.so.11 (libc6,x86-64) => /lib/x86_64-linux-gnu/libgcrypt.so.11

        libdl.so.2 (libc6,x86-64, OS ABI: Linux 2.6.26) => /lib/x86_64-linux-gnu/libdl.so.2

        libdevmapper.so.1.02.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1

        libdevmapper-event.so.1.02.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libdevmapper-event.so.1.02.1

        libcryptsetup.so.4 (libc6,x86-64) => /lib/libcryptsetup.so.4

        libc.so.6 (libc6,x86-64, OS ABI: Linux 2.6.26) => /lib/x86_64-linux-gnu/libc.so.6

        libblkid.so.1 (libc6,x86-64) => /lib/x86_64-linux-gnu/libblkid.so.1

        ld-linux-x86-64.so.2 (libc6,x86-64) => /lib64/ld-linux-x86-64.so.2

```

I read I can use UML to test initramfs, but I can't compile a ARCH=um linux! I am at the state where it feels like I'm not doing anything right. heeeelp!  :Wink: 

EDIT: I can build it, but can't run it!

EDIT2: ok, I can now run it, debug time! will post back if i find anything relevant:)

----------

## BitJam

Make sure ld-linux-x86-64.so.2 is executable.  Use chmod a+x to make it so.

----------

## truc

 *BitJam wrote:*   

> Make sure ld-linux-x86-64.so.2 is executable.  Use chmod a+x to make it so.

 

I've checked and it's not executable, that's probably my problem indeed! I can't test right now, but I will ASAP.

Thank you  :Very Happy: 

EDIT: for some reason, it is executable and working now(just started again from scratch), I don't know how it was back then.

Thanks!

----------

