Jump to content











Photo

PXE Booting in VirtualBox


  • Please log in to reply
3 replies to this topic

#1 allanf

allanf

    Gold Member

  • .script developer
  • 1256 posts

Posted 03 December 2009 - 08:42 PM

Firstly, I haven't had a lot of success, so here are some pointers for others who may wish to try things out.

1. The PXE boot process in VirtualBox is significantly slower than real booting.
2. For real booting, I use tftpd32 as the DHCP and TFTP Server on an XP Pro machine.
3. VirtualBox is also installed on the real Server machine, and it shares the real TFTP Root directory.
4. VirtualBox does not require separate DHCP or TFTP software. tftpd32 is only required for real PXE booting.
5. When a Virtual Machine is created, there should be no need to create or attach a Virtual Hard Drive.
6. In VirtualBox > Settings > System > Motherboard Tab - tick Network and move it to the top of the Boot Order.
7. In VirtualBox > Settings > Network - Select a Virtual Network Adapter Type. Note whether it is an Intel PRO/1000 card or a PCNet card.
8. By default, VirtualBox requires a TFTP Root directory "in the directory where the user's VirtualBox.xml file is kept". In XP, this would usually be "C:\Documents and Settings\<username>\.VirtualBox\TFTP"
9. By default, VirtualBox requires a file in the TFTP Root directory by the name of VMName.pxe (where VMName is the name of the Virtual Machine being PXE booted. That file is a Bootfile provided by the user and renamed accordingly.
10. I don't use the defaults because I wondered if the spaces and dot in the path might be the source of my problems. To change the defaults, do the following.

*NOTE 1*: "e1000" is used in the commands when the Virtual Network Adapter Type is an Intel PRO/1000 card. For PCNet cards, use "pcnet".
*NOTE 2*: Values should only be set for the Virtual Network Adaptor Type being used. Values for the other Adapter Type should be empty; otherwise an error obtaining "MAC" will occur.
*NOTE 3*: The commands are case-sensitive - "BootFile", not "Bootfile". If the command is wrong, an invalid key may be created, and an error will occur. The log should reveal any invalid keys.

a. Open a command prompt. (Oh. Dear!)

b. Enter:
cd %VBOX_INSTALL_PATH%
(Nice of VirtualBox to set an environment variable for its path.)

c. Enter:
VBoxManage getextradata &#34;<VM Name>&#34; &#34;VBoxInternal/Devices/e1000/0/LUN#0/Config/TFTPPrefix&#34;
"VM Name" should be replaced by the name of the Virtual Machine to be PXE booted.
The command should return "No value set!" (unless you've done this before), and the default value would be used.

To re-set a value to its default value of empty, enter a "setextradata" command (rather than a "getextradata") with the final setextradata parameter empty:
VBoxManage setextradata &#34;<VM Name>&#34; &#34;VBoxInternal/Devices/e1000/0/LUN#0/Config/TFTPPrefix&#34;

d. Enter:
VBoxManage getextradata &#34;<VM Name>&#34; &#34;VBoxInternal/Devices/e1000/0/LUN#0/Config/BootFile&#34;
This should also return "No value set!", and the default value would be used.

e. Now change the values to something more useful. Enter:
VBoxManage setextradata &#34;<VM Name>&#34; &#34;VBoxInternal/Devices/e1000/0/LUN#0/Config/TFTPPrefix&#34; &#34;C&#58;\TFTP&#34;
and:
VBoxManage setextradata &#34;<VM Name>&#34; &#34;VBoxInternal/Devices/e1000/0/LUN#0/Config/BootFile&#34; &#34;pxelinux.0&#34;
This sets the path for Virtual Machine to PXE boot "C:\TFTP\pxelinux.0". ("0" is a zero.)
If using a different path, change the TFTP Prefix and BootFile values to suit.

DON'T close the command prompt. Keep it open and use the up/down arrows to shuffle between previously entered commands - adjusting the commands as required.
Try out a different BootFile, or re-set the values to the default of empty.

f. REMEMBER to match the commands with the Virtual Network Adapter Type being used - "e1000" for Intel PRO/1000 cards, and "pcnet" for PCNet cards.
To be safe, enter four commands - two to set the values for the Virtual Network Adapter Type being used; and two to set the values for the other to empty strings.

g. Create the TFTP Root directory and put some stuff in it. I use "C:\TFTP".


Well. Where did that "pxelinux.0" thing come from? As said, I haven't had much luck with PXE booting in VirtualBox. However, I can load up a nice boot menu courtesy of PXELINUX.

Download the SYSLINUX PROJECT from http://syslinux.zyto...ex.php/Download, and unpack the files.

From the SYSLINUX folder, copy the file "\core\pxelinux.0" to the TFTP Root directory.

From the SYSLINUX folder, copy the file "\com32\menu.c32" to the TFTP Root directory.

In the TFTP Root directory, create a new folder named "pxelinux.cfg" (a folder, not a file).

Open the "pxelinux,cfg" folder and create a new text document in it.

Copy and paste the following into the document.

DEFAULT MENU.C32
PROMPT 0

LABEL pmagic_RAM
MENU LABEL ^Q) Boot Parted Magic in RAM
LINUX /PMAGIC/BZIMAGE
INITRD /PMAGIC/INITRAMFS
APPEND edd=off noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=0 loglevel=0 keymap=us

LABEL pmagic_LiveMedia
MENU LABEL ^R) Boot Parted Magic with LIVE MEDIA
LINUX /PMAGIC/BZIMAGE
INITRD /PMAGIC/INITRAMFS
APPEND edd=off noapic load_ramdisk=1 prompt_ramdisk=0 rw vga=791 sleep=0 loglevel=0 keymap=us livemedia

LABEL pmagic.iso
MENU LABEL ^S) Boot Parted Magic ISO using memdisk
LINUX /MEMDISK
APPEND iso
INITRD /PMAGIC-4.6.ISO

LABEL hdt
MENU LABEL ^T) Boot Hardware Detection Tool (hdt.c32)
KERNEL HDT.C32

LABEL hdt.iso
MENU LABEL ^U) Boot Hardware Detection Tool ISO using memdisk
LINUX /MEMDISK
APPEND iso
INITRD /HDT-0.3.5.ISO

Close and save the document with the name "default" (no file extension).

The directory structure should look like this:
C&#58;\TFTP

¦   menu.c32

¦   pxelinux.0

¦

+---pxelinux.cfg

		default
So, everything right? TFTP directory set up, VirtualBox pointing at the TFTP directory and the BootFile? Got the right Virtual Network Adapter Type? Network on top of the Boot Order?

Fire up VirtualBox and start the Virtual Machine.

In a second or two, there should be a nice blue menu with five labels. Use up/down arrows to select one of the labels. Press "enter" and voila! What? Nothing? Well, I did say that I hadn't had much luck.


OK. So... What's all that "Parted Magic" stuff about? Try it! But do remember that I can't get it to work in VirtualBox. Good luck!

For the first two menu-label entries, download Parted Magic PXE (pmagic-pxe-4.6.1.zip) by following the links from http://partedmagic.com/download.html

Unpack the folders and files from Parted Magic PXE. Copy the "\boot\" and "\pmagic\" folders to the TFTP root directory.

For the third menu-label entry, download Parted Magic (pmagic-4.6.iso.zip) by following the links from http://partedmagic.com/download.html

Unpack the ISO file from Parted Magic, and copy the ISO to the TFTP root directory.

Also required is the very latest "memdisk", which can be downloaded in the "memdisk.zip" attached to the following post:
http://www.boot-land...?...ost&p=70059 ("ISO mapping with MEMDISK is possible now")

Unpack the "memdisk" file (no file extension), and copy it to the TFTP root directory.

The directory structure should now look like this:
C&#58;\TFTP

¦   memdisk

¦   menu.c32

¦   pmagic-4.6.iso

¦   pxelinux.0

¦

+---boot

¦   +---syslinux

¦		   chain.c32

¦		   hdt.c32

¦		   mbr.bin

¦		   memdisk

¦		   memtest

¦		   message.txt

¦		   message2.txt

¦		   message3.txt

¦		   message4.txt

¦		   message5.txt

¦		   modules.alias

¦		   modules.pcimap

¦		   pci.ids

¦		   reboot.c32

¦		   splashpm.png

¦		   syslinux

¦		   syslinux.cfg

¦		   syslinux.exe

¦		   vesamenu.c32

¦

+---pmagic

¦	   bzImage

¦	   initramfs

¦

+---pxelinux.cfg

		default

OK! Fire up VirtualBox and start the Virtual Machine. In a second or two, the menu will appear. Use the up/down arrows to select a menu label and press "enter".

What happened? ... :clap: ... For the first two menu-label entries:
"Loading /PMAGIC/BZIMAGE......" OK
"Loading /PMAGIC/INITRAMFS......" After 524 dots, network activity ceases and the cursor sits there for a few moments (minute or so).
"Boot failed: Press a key to retry, or wait for reset......"

For the third menu-label entry the end result is the same: "Loading /MEMDISK..", "Loading /PMAGIC-4.6.ISO...", "Boot failed...".


Oh! Well! What about the "Hardware Detection Tool" - the fourth and fifth menu-label entries? ... :cheers: ...

From the unpacked SYSLINUX PROJECT folder, copy the file "\com32\hdt\hdt.c32" to the TFTP root directory.

Download the "Bootable ISO Image" (hdt-0.3.5.iso) from http://hdt-project.o...#Currentrelease and save it to the TFTP root directory.

The final directory structure should look like this:
C&#58;\TFTP

¦   hdt-0.3.5.iso

¦   hdt.c32

¦   memdisk

¦   menu.c32

¦   pmagic-4.6.iso

¦   pxelinux.0

¦

+---boot

¦   +---syslinux

¦		   chain.c32

¦		   hdt.c32

¦		   mbr.bin

¦		   memdisk

¦		   memtest

¦		   message.txt

¦		   message2.txt

¦		   message3.txt

¦		   message4.txt

¦		   message5.txt

¦		   modules.alias

¦		   modules.pcimap

¦		   pci.ids

¦		   reboot.c32

¦		   splashpm.png

¦		   syslinux

¦		   syslinux.cfg

¦		   syslinux.exe

¦		   vesamenu.c32

¦

+---pmagic

¦	   bzImage

¦	   initramfs

¦

+---pxelinux.cfg

		default

Give the Virtual Machine one last go. What happens when either the fourth or fifth menu entries are selected?

Finally something works! ... :) ... Thank you very much. ... :cheers: ...


I s'pose that the really good news is that everything, apart from the pmagic.iso, works in a real (non-virtual) PXE-boot environment.

But for that to work, tftpd32 or another TFTPD/DHCP server needs to be properly configured and running on the server machine. Another story...

Regards :)

#2 hackware

hackware
  • Members
  • 6 posts
  • Interests:hard/firm/soft/wet-wares - from chips 2 robots 2 mainframes
  •  
    United States

Posted 21 December 2009 - 02:55 AM

if ya talk real slow, perhaps i'll keep up...

i've built a few systems, just lately found this site...

pxe has always been a tool i've failed to configure within my security requirements...

a virtual method is interesting...

ever worked with bsd (FreeBSD)...?

william...

#3 allanf

allanf

    Gold Member

  • .script developer
  • 1256 posts

Posted 21 December 2009 - 07:20 AM

Thanks for the interest. The tutorial was just a place to keep some undocumented notes discovered through tria-and-error.
I've tried three different PXE-capable bootloaders: PXELINUX, GRUB4DOS (a bit slower) and Windows BOOTMGR/PXEBOOT.N12 (doesn't work in VirtualBox).

With the working bootloaders, I've tried to boot Parted Magic (doesn't work in VirtualBox), Hardware Detection Tool (works), and PING (Partimage Is Not Ghost; works).

All work in a real PXE environment (except when trying to boot Parted Magic from its ISO). The real machine's RAM is the same as the Virtual Machine's - 512MB.

Therefore I put the failures in VirtualBox down to the actual size of the files being TFTPed.

PXELINUX (in conjunction with MEMDISK) and GRUB4DOS are able to map (load) an ISO into memory, then open the file system from the ISO into memory too. This requires extra RAM, and is probably the reason that the Parted Magic ISO also fails in a real PXE environment.

The good thing is that the developers of both Parted Magic and PING have provided special editions for PXE booting. These are the filesystem files alone - not contained in an ISO. So these editions can be easily downloaded and comfortable PXE booted without the need for extra work (extracting from ISOs) or extra resources.

ever worked with bsd (FreeBSD)...?


I'm having a look at ReactOS LiveCD and Frenzy (FreeBSD) at the moment.

By the look of the size of Frenzy (only available by ISO), it's not going to PXE boot in VirtualBox, and probably not in my real PXE environment either.

So, if your looking for requests for a FreeBSD project for PXE booting - small and just the file system!

Regards ;)

#4 psyartem

psyartem
  • Members
  • 1 posts

Posted 04 May 2012 - 04:15 PM

Hi ppl. I tried this tutorial with some changes from me, like using gui menu for pxelinux and putting there windows pxe-ready install. I changed the bootmgr.exe to 003tmgr.exe and rechecked the checksum like needed. All going ok VMBox gets the pxelinux.0 i can see the menu but after that i got this message - "The boot selction failed because a required device is inaccesible. Please help me with this issue.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users