Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
initramfs problem: /bin/sh: blkid: permission denied[SOLVED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Mon Aug 13, 2012 5:18 pm    Post subject: initramfs problem: /bin/sh: blkid: permission denied[SOLVED] Reply with quote

Hello,

I'm desperate! :lol: 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')
Code:
/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:
Code:
$ 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
nod /dev/tty 0666 0 0 c 5 0
nod /dev/tty0 0660 0 0 c 4 0
nod /dev/null 0660 0 0 c 1 3
nod /dev/random 0666 0 0 c 1 8
nod /dev/urandom 0666 0 0 c 1 9

dir /root 0700 0 0
dir /etc 0700 0 0
dir /proc 0755 0 0
dir /sys 0755 0 0
dir /mnt 0755 0 0
dir /mnt/newroot 0755 0 0

dir /bin 0755 0 0
#dir /lib 0755 0 0
dir /sbin 0755 0 0

# init file!
file /init /home/samtech/linux-build/initramfs/init 0755 0 0

# busybox
file /bin/busybox /bin/busybox 0755 0 0
slink /bin/sh /bin/busybox 0777 0 0
slink /bin/mount /bin/busybox 0777 0 0
slink /bin/umount /bin/busybox 0777 0 0
slink /sbin/mdev /bin/busybox 0777 0 0
slink /sbin/switch_root /bin/busybox 0777 0 0

# executables
file /sbin/blkid /sbin/blkid 0755 0 0
file /sbin/cryptsetup /sbin/cryptsetup 0755 0 0
file /sbin/lvm /sbin/lvm 0755 0 0
slink /sbin/lvchange /sbin/lvm 0777 0 0
slink /sbin/vgscan /sbin/lvm 0777 0 0
# end of 'files.list.basic'


# libs
dir /lib64 0755 0 0
file /lib64/ld-linux-x86-64.so.2 /lib64/ld-linux-x86-64.so.2 0644 0 0
dir /lib 0755 0 0
file /lib/libcryptsetup.so.4 /lib/libcryptsetup.so.4 0644 0 0
dir /lib/x86_64-linux-gnu 0755 0 0
file /lib/x86_64-linux-gnu/libblkid.so.1 /lib/x86_64-linux-gnu/libblkid.so.1 0644 0 0
file /lib/x86_64-linux-gnu/libc.so.6 /lib/x86_64-linux-gnu/libc.so.6 0644 0 0
file /lib/x86_64-linux-gnu/libdevmapper-event.so.1.02.1 /lib/x86_64-linux-gnu/libdevmapper-event.so.1.02.1 0644 0 0
file /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1 0644 0 0
file /lib/x86_64-linux-gnu/libdl.so.2 /lib/x86_64-linux-gnu/libdl.so.2 0644 0 0
file /lib/x86_64-linux-gnu/libgcrypt.so.11 /lib/x86_64-linux-gnu/libgcrypt.so.11 0644 0 0
file /lib/x86_64-linux-gnu/libgpg-error.so.0 /lib/x86_64-linux-gnu/libgpg-error.so.0 0644 0 0
file /lib/x86_64-linux-gnu/libpopt.so.0 /lib/x86_64-linux-gnu/libpopt.so.0 0644 0 0
file /lib/x86_64-linux-gnu/libpthread.so.0 /lib/x86_64-linux-gnu/libpthread.so.0 0644 0 0
file /lib/x86_64-linux-gnu/libreadline.so.5 /lib/x86_64-linux-gnu/libreadline.so.5 0644 0 0
file /lib/x86_64-linux-gnu/librt.so.1 /lib/x86_64-linux-gnu/librt.so.1 0644 0 0
file /lib/x86_64-linux-gnu/libselinux.so.1 /lib/x86_64-linux-gnu/libselinux.so.1 0644 0 0
file /lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libtinfo.so.5 0644 0 0
file /lib/x86_64-linux-gnu/libudev.so.0 /lib/x86_64-linux-gnu/libudev.so.0 0644 0 0
file /lib/x86_64-linux-gnu/libuuid.so.1 /lib/x86_64-linux-gnu/libuuid.so.1 0644 0 0

# for dynamic executables
file /etc/ld.so.cache /home/samtech/linux-build/initramfs/ld.so.cache 0644 0 0
file /etc/ld.so.conf /home/samtech/linux-build/initramfs/ld.so.conf 0644 0 0


And this is the start of the /init script:
Code:
#!/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.
Code:
$ /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:)
_________________
The End of the Internet!


Last edited by truc on Thu Nov 22, 2012 4:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
BitJam
Advocate
Advocate


Joined: 12 Aug 2003
Posts: 2429
Location: Silver City, NM

PostPosted: Mon Oct 01, 2012 12:48 pm    Post subject: Reply with quote

Make sure ld-linux-x86-64.so.2 is executable. Use chmod a+x to make it so.
Back to top
View user's profile Send private message
truc
Advocate
Advocate


Joined: 25 Jul 2005
Posts: 3199

PostPosted: Tue Oct 02, 2012 1:27 pm    Post subject: Reply with quote

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 :D



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!
_________________
The End of the Internet!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum