View previous topic :: View next topic |
Author |
Message |
srd n00b
Joined: 13 Apr 2010 Posts: 38
|
Posted: Sun Aug 09, 2015 2:32 am Post subject: telling kernel which /initrd file to run |
|
|
I have a diskless node which boots via pxe linux. The pxelinux.cfg/default file is:
Code: | DEFAULT Gentoo-4.0.5
LABEL Gentoo-4.0.5
LINUX /gentoo-x86_64/boot/kernel-4.0.5-gentoo
APPEND ip=dhcp root=/dev/nfs nfsroot=10.0.0.11:/gentoo-x86_64 init=/linuxrc ro
|
I was expecting the init parameter to tell the kernel to execute the /linuxrc file which is in / of my diskless fs which gets exported to the diskless node. The diskless node is getting the kernel, and mounting /, but it's not executing /linuxrc. Rather, I'm guessing it's running it's own or maybe even /sbin/init.
How do I tell the kernel to run this specific file (which I thought PXELinux would do)? |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Sun Aug 09, 2015 1:28 pm Post subject: |
|
|
Usually you tell the bootlaoder which kernel with which parameters and initrd to use.
WAs like that with lilo / grub 0 and grub 2.
thats the way for myself since 1996 with linux ...
you may check dmesg, your bootloader documentation and the kernel config if you can include your initrd to the kernel. I think there was an option in the past to build in the initrd while building the kernel ...
and with your example i do not see anywhere that you specify an initrd file at all
Code: |
DEFAULT Gentoo-4.0.5
LABEL Gentoo-4.0.5
LINUX /gentoo-x86_64/boot/kernel-4.0.5-gentoo
APPEND ip=dhcp root=/dev/nfs nfsroot=10.0.0.11:/gentoo-x86_64 init=/linuxrc ro |
just an example from my box, with grub2 and the linux mint stuff
Code: | menuentry 'Linux Mint 12 LXDE, 3.0.0-12-generic (/dev/sda1) -- recovery mode' --class linuxmint --class gnu-linux --class gnu --class os {
recordfail
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root ....
echo 'Loading Linux 3.0.0-12-generic ...'
linux /vmlinuz-3.0.0-12-generic root=UUID=... ro recovery nomodeset
echo 'Loading initial ramdisk ...'
initrd /initrd.img-3.0.0-12-generic
}
|
initrd /initrd.img-3.0.0-12-generic => is the line which grub2 for example uses for the initrd.
linux /vmlinuz-3.0.0-12-generic root=UUID=... ro recovery nomodeset => is the kernel line from grub2. |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10589 Location: Somewhere over Atlanta, Georgia
|
Posted: Sun Aug 09, 2015 1:54 pm Post subject: |
|
|
Moved from Networking & Security to Kernel & Hardware.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
szatox Advocate
Joined: 27 Aug 2013 Posts: 3136
|
Posted: Sun Aug 09, 2015 6:28 pm Post subject: |
|
|
Quote: | DEFAULT Gentoo-4.0.5
LABEL Gentoo-4.0.5
LINUX /gentoo-x86_64/boot/kernel-4.0.5-gentoo
APPEND ip=dhcp root=/dev/nfs nfsroot=10.0.0.11:/gentoo-x86_64 init=/linuxrc ro |
well, that's exactly how you do that. Is your linuxrc executable?
What error does it report?
How you know it runs something else? AFAIR /linuxrc is the default init launched by kernel. |
|
Back to top |
|
|
srd n00b
Joined: 13 Apr 2010 Posts: 38
|
Posted: Sun Aug 09, 2015 6:28 pm Post subject: |
|
|
tw04l124 wrote: | Usually you tell the bootlaoder which kernel with which parameters and initrd to use. |
And in this case, my boot loader is pxelinux. This is a diskless install so it's being installed over the network as opposed to your grub2.
My understanding is that the kernel uses a default initrd. I did not supply one. After it mounts this initrd, it searches for an init file to execute and if not found, then it will invoke the linuxrc file as its startup script. Obviously this isn't happening for me. And this makes me wonder why pxelinux passes an init parameter which doesn't seem to be getting used.
Happy to hear any suggestions?
I didn't want to have to create an initrd image and compile it into the kernel just to execute this script (which I think would work). |
|
Back to top |
|
|
Roman_Gruber Advocate
Joined: 03 Oct 2006 Posts: 3846 Location: Austro Bavaria
|
Posted: Sun Aug 09, 2015 6:37 pm Post subject: |
|
|
http://www.syslinux.org/wiki/index.php/PXELINUX
APPEND initrd=http://boot-server/boot/myinitrd
and use that to point to the genkernel initrd. genkernel can generate you an initrd only as an option too. maybe this will be enough for you.
you may check in the kernel if there is some way to point to the stuff needed for booting in your particular case. |
|
Back to top |
|
|
|