View previous topic :: View next topic |
Author |
Message |
The_Journey n00b
Joined: 13 Jun 2010 Posts: 20
|
Posted: Tue Jun 21, 2011 5:30 pm Post subject: Initramfs does not have block devices? |
|
|
Hi, I'm trying to install gentoo on a lvm on an encrypted block device.
Here is my /init
Code: | !/bin/busybox sh
busybox --install -s
mount -t tmpfs dev /dev
mount -t proc proc /proc
mount -t sysfs sys /sys
#mount -t devtmpfs none /dev
echo /sbin/mdev > /proc/sys/kernel/hotplug
mdev -s
cryptsetup luksOpen /dev/sda7 lvm
lvm vgchange -ay
mount /dev/vg/gentoo /mnt/root
umount /sys /proc
umount /dev
exec switch_root /mnt/root /sbin/init
|
But when I boot up, I keep getting the error telling me that init can't access /dev/sda7, when I dropped to the shell, there is no /dev/sda*, there's only device nodes like /dev/ram*, /dev/tty and etc...
I thought that mdev is supposed to populate /dev by reading from /sys, but why does it not populate with block device nodes? I can't figure this out for the past few days, if anyone can help me, it would be very much appreciated |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54232 Location: 56N 3W
|
Posted: Tue Jun 21, 2011 5:43 pm Post subject: |
|
|
The_Journey,
For my initrd /dev, I just make a static /dev with only the nodes I need. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21618
|
Posted: Tue Jun 21, 2011 10:36 pm Post subject: |
|
|
Why are you using tmpfs+mdev instead of a devtmpfs? Have you compiled the kernel to support your hard drive? The drive should be mentioned in dmesg if it is detected and supported.
You should add error checking for the commands, so that the script does not rush onward if one command fails. |
|
Back to top |
|
|
cach0rr0 Bodhisattva
Joined: 13 Nov 2008 Posts: 4123 Location: Houston, Republic of Texas
|
Posted: Tue Jun 21, 2011 10:46 pm Post subject: Re: Initramfs does not have block devices? |
|
|
try this:
Code: |
#!/bin/busybox sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev
cryptsetup -T 5 luksOpen /dev/sda7 lvm
lvm vgchange -ay
mount -o ro /dev/vg/gentoo /mnt/root || rescue_shell
umount /dev
umount /sys
umount /proc
exec switch_root /mnt/root /sbin/init
rescue_shell() {
echo "Something went wrong. Dropping you to a shell."
busybox --install -s
exec /bin/sh
}
|
NOTE: for the above to work, you have to have devtmpfs support built into your kernel. _________________ Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash |
|
Back to top |
|
|
The_Journey n00b
Joined: 13 Jun 2010 Posts: 20
|
Posted: Tue Jun 21, 2011 11:21 pm Post subject: |
|
|
I tried copying the block devices into the initramfs dev directly using "cp -a /dev/{sda*}".
But now it's giving me the error: Cannot open device /dev/sda7 for read-only access.
When I dropped into the shell while in initramfs, I can see that /dev/sda7 does exist, but for some reason cryptsetup keep telling me it can't open it for some reason, can anyone help me?
Thank you. |
|
Back to top |
|
|
The_Journey n00b
Joined: 13 Jun 2010 Posts: 20
|
Posted: Tue Jun 21, 2011 11:24 pm Post subject: Re: Initramfs does not have block devices? |
|
|
cach0rr0 wrote: | try this:
Code: |
#!/bin/busybox sh
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devtmpfs none /dev
cryptsetup -T 5 luksOpen /dev/sda7 lvm
lvm vgchange -ay
mount -o ro /dev/vg/gentoo /mnt/root || rescue_shell
umount /dev
umount /sys
umount /proc
exec switch_root /mnt/root /sbin/init
rescue_shell() {
echo "Something went wrong. Dropping you to a shell."
busybox --install -s
exec /bin/sh
}
|
NOTE: for the above to work, you have to have devtmpfs support built into your kernel. |
Hi, I tried that with devtmpfs built into the kernel but my initramfs was still missing the block devices. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21618
|
Posted: Tue Jun 21, 2011 11:26 pm Post subject: Re: Initramfs does not have block devices? |
|
|
cach0rr0 wrote: | Code: | mount -o ro /dev/vg/gentoo /mnt/root || rescue_shell
rescue_shell() {
echo "Something went wrong. Dropping you to a shell."
busybox --install -s
exec /bin/sh
} |
| The function needs to be defined before it is first called. As written, busybox will assume the existence of an external program named rescue_shell and attempt to run that, which will likely fail.
OP: if your block devices are not present when you use devtmpfs, then your kernel does not know how to handle those hard drives. |
|
Back to top |
|
|
cach0rr0 Bodhisattva
Joined: 13 Nov 2008 Posts: 4123 Location: Houston, Republic of Texas
|
Posted: Tue Jun 21, 2011 11:32 pm Post subject: Re: Initramfs does not have block devices? |
|
|
Hu wrote: | The function needs to be defined before it is first called. As written, busybox will assume the existence of an external program named rescue_shell and attempt to run that, which will likely fail. |
Didn't know that. Of course, I wouldn't, because mounting worked!
Hu wrote: |
OP: if your block devices are not present when you use devtmpfs, then your kernel does not know how to handle those hard drives. |
The explanation you gave me for this in this thread made the most sense to me. _________________ Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash |
|
Back to top |
|
|
The_Journey n00b
Joined: 13 Jun 2010 Posts: 20
|
Posted: Tue Jun 21, 2011 11:36 pm Post subject: |
|
|
What options will allow the kernel to recognize my drive? |
|
Back to top |
|
|
cach0rr0 Bodhisattva
Joined: 13 Nov 2008 Posts: 4123 Location: Houston, Republic of Texas
|
Posted: Tue Jun 21, 2011 11:39 pm Post subject: |
|
|
The_Journey wrote: | What options will allow the kernel to recognize my drive? |
depends on your hardware
can you paste your lspci -n output here?
as well, if you head to pastebin (.com) and dump your kernel config there, sharing the link with us, we can look and see what you might be missing. _________________ Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash |
|
Back to top |
|
|
The_Journey n00b
Joined: 13 Jun 2010 Posts: 20
|
Posted: Tue Jun 21, 2011 11:51 pm Post subject: |
|
|
Here is lspci -n from chrooted session:
Code: | 00:00.0 0500: 10de:03e2 (rev a1)
00:01.0 0601: 10de:03e1 (rev a2)
00:01.1 0c05: 10de:03eb (rev a2)
00:01.2 0500: 10de:03f5 (rev a2)
00:02.0 0c03: 10de:03f1 (rev a3)
00:02.1 0c03: 10de:03f2 (rev a3)
00:04.0 0604: 10de:03f3 (rev a1)
00:05.0 0403: 10de:03f0 (rev a2)
00:06.0 0101: 10de:03ec (rev a2)
00:07.0 0680: 10de:03ef (rev a2)
00:08.0 0101: 10de:03f6 (rev a2)
00:08.1 0101: 10de:03f6 (rev a2)
00:09.0 0604: 10de:03e8 (rev a2)
00:0b.0 0604: 10de:03e9 (rev a2)
00:0c.0 0604: 10de:03e9 (rev a2)
00:18.0 0600: 1022:1200
00:18.1 0600: 1022:1201
00:18.2 0600: 1022:1202
00:18.3 0600: 1022:1203
00:18.4 0600: 1022:1204
02:00.0 0300: 1002:6738
02:00.1 0403: 1002:aa88
|
Here is cat .config
http://pastebin.com/CpRTnAXK
Thank you!! |
|
Back to top |
|
|
cach0rr0 Bodhisattva
Joined: 13 Nov 2008 Posts: 4123 Location: Houston, Republic of Texas
|
Posted: Wed Jun 22, 2011 12:36 am Post subject: |
|
|
right, so you're missing this:
Code: |
# CONFIG_SATA_NV is not set
|
that needs to be set to =y (as a built-in, not a module)
I took your lspci -n, pasted it into the link in my signature, saw your mobo has an nvidia MCP61 SATA Controller, which uses the SATA_NV driver.
Then checked your .config, and of course SATA_NV was not set.
...so, yeah, make that change, recompile your kernel, move it over to /boot, adjust grub.conf if needed, should be good to go _________________ Lost configuring your system?
dump lspci -n here | see Pappy's guide | Link Stash |
|
Back to top |
|
|
The_Journey n00b
Joined: 13 Jun 2010 Posts: 20
|
Posted: Wed Jun 22, 2011 12:50 am Post subject: |
|
|
Thank you very much cach0rr0, that was exactly the problem. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21618
|
Posted: Wed Jun 22, 2011 2:52 am Post subject: Re: Initramfs does not have block devices? |
|
|
cach0rr0 wrote: | Hu wrote: | The function needs to be defined before it is first called. As written, busybox will assume the existence of an external program named rescue_shell and attempt to run that, which will likely fail. | Didn't know that. Of course, I wouldn't, because mounting worked! | Right. This is why you should always test the failure conditions when you have the luxury of a working environment to repair them. |
|
Back to top |
|
|
|