Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
telling kernel which /initrd file to run
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
srd
n00b
n00b


Joined: 13 Apr 2010
Posts: 38

PostPosted: Sun Aug 09, 2015 2:32 am    Post subject: telling kernel which /initrd file to run Reply with quote

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
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Sun Aug 09, 2015 1:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
John R. Graham
Administrator
Administrator


Joined: 08 Mar 2005
Posts: 10261
Location: Somewhere over Atlanta, Georgia

PostPosted: Sun Aug 09, 2015 1:54 pm    Post subject: Reply with quote

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
View user's profile Send private message
szatox
Veteran
Veteran


Joined: 27 Aug 2013
Posts: 1746

PostPosted: Sun Aug 09, 2015 6:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
srd
n00b
n00b


Joined: 13 Apr 2010
Posts: 38

PostPosted: Sun Aug 09, 2015 6:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
Roman_Gruber
Advocate
Advocate


Joined: 03 Oct 2006
Posts: 3806
Location: Austro Bavaria

PostPosted: Sun Aug 09, 2015 6:37 pm    Post subject: Reply with quote

http://www.syslinux.org/wiki/index.php/PXELINUX

Quote:
Example:

LABEL linux-http
LINUX http://boot-server/boot/mykernel
APPEND initrd=http://boot-server/boot/myinitrd


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