Trying to boot from iPXE script

Post bug reports related to either the kiosk ISO or the kiosk wizard here.
Post Reply
nielsbasjes
Ronin
Ronin
Posts: 3
Joined: 08 Apr 2014, 21:42
Distribution: CentOS 6.5
Location: Amstelveen, NL

Trying to boot from iPXE script

Post#1 by nielsbasjes » 08 Apr 2014, 22:17

Hi,

I'm trying to get the Kiosk version to boot via a script in iPXE.
So essentially I 'just' want to convert the /boot/pxelinux.cfg/default into a form that iPXE accepts.
What I have currently setup in a VM running CentOS 6.5 with selinux disabled (I only disabled selinux in this test VM):
  1. I mounted the iso file I downloaded onto a folder called 'iso'
  2. webfsd -p 1234 -r iso/porteus -u nobody -g nogroup
    http://172.21.13.124:1234/ shows

    Code: Select all

    drwxr-xr-x  root      root      Apr 08 18:46    <DIR>  base
    drwxr-xr-x  root      root      Dec 15 18:47    <DIR>  modules
    drwxr-xr-x  root      root      Dec 13 19:54    <DIR>  rootcopy
    -rw-r--r--  root      root      Mar 03  2013    17 kB  GNU_GPL
    -rw-r--r--  root      root      Mar 03  2013   255  B  License.txt
    -rwxr-xr-x  root      root      May 30  2013  1021  B  make_iso.sh
    -rw-r--r--  root      root      Mar 03  2013    55  B  porteus-kiosk-v3.0.sgn
    
  3. webfsd -p 8765 -r iso/boot -u nobody -g nogroup
    http://172.21.13.124:8765/ shows

    Code: Select all

    drwxr-xr-x  root      root      Oct 19 15:04    <DIR>  isolinux
    drwxr-xr-x  root      root      Apr 08 18:46    <DIR>  pxelinux.cfg
    -rw-r--r--  root      root      Mar 08 19:52   137 kB  initrd.xz
    -rw-r--r--  root      root      Feb 18  2013    25 kB  pxelinux.0
    -rw-r--r--  root      root      Mar 08 16:31  1553 kB  vmlinuz
    
  4. I created an iPXE iso image with embedded a script that only does 'chain <url>'
  5. The file I have on this url is

    Code: Select all

    #!ipxe
    kernel http://172.21.13.124:8765/vmlinuz http_server=172.21.13.124:1234
    initrd http://172.21.13.124:8765/initrd.xz 
    initrd http://172.21.13.124:8765/pxelinux.cfg/initrdpxe.xz
    boot
Now when I boot a VM using this iPXE iso image I see:
  1. iPXE loads all 3 files with the notification 'ok'
  2. Porteus boots and immediately says:
    Starting Porteus Kiosk Edition <http://www.porteus.org>
    ^ device not ready yet? delaying <countdown> seconds

    Error: Porteus data not found
    Startup cannot continue.
    ...
When I poke around in the Linux that is then running I find that no networking is running (ifconfig and route show empty) yet there seem to be quite a number of kernel modules for various network devices present under /lib/modules/3.13.6-porteus-kioks/kernel/drivers/net/ethernet/

Apparently something is wrong with my setup but after two nights of trying, googling and reading documentation I've been unable to get it running.

What have I done wrong?

User avatar
fanthom
Site Admin
Site Admin
Posts: 4548
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: Trying to boot from iPXE script

Post#2 by fanthom » 09 Apr 2014, 07:02

hello nielsbasjes,

i guess that passing 'http_server=' parameter does not work in your iPXE setup:

Code: Select all

#!ipxe
kernel http://172.21.13.124:8765/vmlinuz http_server=172.21.13.124:1234
to confirm - please boot once again and when Kiosk fails to boot please run following command:

Code: Select all

cat /proc/cmdline
this variable must be passed to the client otherwise networking (and PXE boot overall) wont be initialized in Kiosk.
Please add [Solved] to your thread title if the solution was found.

nielsbasjes
Ronin
Ronin
Posts: 3
Joined: 08 Apr 2014, 21:42
Distribution: CentOS 6.5
Location: Amstelveen, NL

Re: Trying to boot from iPXE script

Post#3 by nielsbasjes » 09 Apr 2014, 19:42

The command

Code: Select all

 cat /proc/cmdline
shows

Code: Select all

http_server=172.21.13.124:1234
which is exactly the parameter I passed.
So it seems to me that the iPXE script is correct.

I created a new Kiosk ISO image with these settings non default:
  • Disable Firewall (needed to be able to show the homepage which was not on port 80)
  • Set homepage to a test page I put up on a test system
  • Enable PXE with the setting 172.21.13.124:1234
I booted this ISO directly in VirtualBox 4.3.10 r93012 and the Kiosk system behaves exactly as I expected it would: I see the test webpage I created.
I put this ISO into the iPXE setup described above and I get the exact same effect as before: A console, no networking active and Error: Porteus data not found

After some digging I think I actually ran into the same/similar problem as this forum topic:
No network on kiosk in VirtualBox https://forum.porteus.org/viewtopic.php?f=103&t=2062

In the last post the scripting under /etc/rc.d is mentioned as "needs to be changed" so I double checked those .... only to find that the entire /etc directory is empty except for the mtab symlink to /proc/mounts.

I did some more digging around in this very empty Linux system and noticed that the /init is a script that tried to run "busybox modprobe" to load the network modules.
When I tried to run

Code: Select all

busybox modprobe /lib/modules/.../e1000.ko
it simply said

Code: Select all

modprobe: applet not found
The busybox I have here does not have modprobe built in.

So my current assessment is that in the Kiosk version when running via iPXE does not have a busybox that has enough features and as such is unable to load the kernel modules required to setup the network. Ans without network it cannot load the rest of the system.

What do you think?

User avatar
fanthom
Site Admin
Site Admin
Posts: 4548
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: Trying to boot from iPXE script

Post#4 by fanthom » 09 Apr 2014, 20:48

ok - i'll try to explain:
standard initrd.xz contains /bin/busybox which is lacking 'modprobe' as it's not needed when we boot from CD/usb/hd/etc.
initrdpxe.xz contains /busybox which has modprobe and other utils needed for PXE boot (udhcpc, wget). please run your command as:

Code: Select all

./busybox modprobe driver_name (without .ko)
and it will work.

couple things to do:
a) make sure you set networking into 'Bridged' mode in your Centos VM
b) please use PCnet-FAST III card which is supported by 'pcnet32' driver
c) wen booting fails please run 'ifconfig -a' and check if eth0 is up. if it's not then initialize networking manually:

Code: Select all

./busybox modprobe pcnet32
./busybox udhcpc
d) now run 'ifconfig -a' and if eth is up try to ping your http server:

Code: Select all

ping 172.21.13.124
if you get the response then i have no idea what is going on.... - maybe firewall is blocking downloading of modules?

EDIT:\\
please also check update i posted here:
viewtopic.php?f=102&t=3315&p=23636#p23636
Please add [Solved] to your thread title if the solution was found.

nielsbasjes
Ronin
Ronin
Posts: 3
Joined: 08 Apr 2014, 21:42
Distribution: CentOS 6.5
Location: Amstelveen, NL

[SOLVED] Re: Trying to boot from iPXE script

Post#5 by nielsbasjes » 10 Apr 2014, 21:00

I have been fiddeling with quite a number of things and I got it running using the iso I created yesterday (i.e. without the latest fixes!).

1: http_server
It turns out that the http_server parameter was NOT available.
I used the line

Code: Select all

kernel http://172.21.13.124:8765/vmlinuz http_server=172.21.13.124:1234
which means the cmdline was "http_server=172.21.13.124:1234".
In the /init script the 'value' function used to extract the value NEEDS a space before the name of the value it is looking for.
Because http_server was directly at the start of the line it did not match and so eventhough the setting was there the script didn't see it.
So I changed it into

Code: Select all

kernel http://172.21.13.124:8765/vmlinuz foo http_server=172.21.13.124:1234
I consider this to be a commandline parsing bug in the init script.

2: List the directory
I switched to Apache and It turns out that the directory that contains the files must be listable.

3:Permissions
When you simply mount the iso it turns out that the permissions on the iso are like this:

Code: Select all

[root@puppet /opt/porteus]# ls -laF iso/porteus/base/
total 48104
drwxr-xr-x 2 root root     4096 Apr  9 21:08 ./
drwxr-xr-x 5 root root     4096 Dec 13 20:16 ../
-r--r--r-- 1 root root 28983296 Mar  8 20:35 001-core.xzm
-r-------- 1 root root 20230144 Feb 22 22:23 002-firefox.xzm
-r-------- 1 root root    36864 Apr  9 21:08 003-settings.xzm
So the last two files cannot be read via http and this halted the boot procedure.
I copied the content of the iso image into a directory and changed the permissions of the files to become readable to everyone.

The setup that works on a CentOS 6.5 system (maybe someone can make this a Howto?)
Note: You can vary with the ip addresses, port numbers, and directories the way you like it.

Extract the Kiosk ISO file into /opt/porteus/iso

Code: Select all

chmod a+rX -R /opt/porteus/iso
Add this config to Apache httpd (i.e. make an /etc/httpd/conf.d/porteus.conf)

Code: Select all

Listen 1234
<VirtualHost *:1234>
  DocumentRoot /opt/porteus/iso/porteus
</VirtualHost>

<Directory /opt/porteus/iso/porteus>
  Options +Indexes
</Directory>

Listen 8765
<VirtualHost *:8765>
  DocumentRoot /opt/porteus/iso/boot
</VirtualHost>

<Directory /opt/porteus/iso/boot>
  Options +Indexes
</Directory>
and restart the Apache httpd

Code: Select all

service httpd restart
Make sure that iPXE has this script during the startup (I embedded a script in the iPXE ISO that chains this script from The Foreman http://theforeman.org/ ).
The 'foo' is there as a workaround to the bug mentioned above.

Code: Select all

#!ipxe
kernel http://10.10.10.10:8765/vmlinuz foo http_server=10.10.10.10:1234
initrd http://10.10.10.10:8765/initrd.xz 
initrd http://10.10.10.10:8765/pxelinux.cfg/initrdpxe.xz
boot
EDIT:
I just found that in the iPXE script you can use hostnames everywhere.
So you can do something like this

Code: Select all

#!ipxe
kernel http://porteus.example.com:8765/vmlinuz foo http_server=porteus.example.com:1234
initrd http://porteus.example.com:8765/initrd.xz 
initrd http://porteus.example.com:8765/pxelinux.cfg/initrdpxe.xz
boot

User avatar
fanthom
Site Admin
Site Admin
Posts: 4548
Joined: 28 Dec 2010, 02:42
Distribution: Porteus Kiosk
Location: Poland, currently - Cork, IE
Contact:

Re: Trying to boot from iPXE script

Post#6 by fanthom » 10 Apr 2014, 21:15

space at the beginning comes from our desktop edition where users can have many fancy cheatcodes and space indicates where cheatcode starts/ends.
we dont have that many cheats in kiosk so i have removed this requirement (no need for 'foo' anymore).

thanks for sharing.
Please add [Solved] to your thread title if the solution was found.

Post Reply