View previous topic :: View next topic |
Author |
Message |
Kalin Tux's lil' helper
Joined: 22 Dec 2002 Posts: 130 Location: Germany
|
Posted: Tue Sep 07, 2004 3:27 pm Post subject: HOWTO: Use LiveCD in PXE booting environment |
|
|
Hello!
I am proud with myself, because after a few sleepless nights, I could convert the LiveCD 2004.2 so that it can be booted via PXE. I neede this in order to boot my Toshiba SS/S5 (PORTEGE 2001) laptop, as it does not have (bootable) drive, but has Intel PXE built in. (Another way was to boot from USB FDD, but I just hate diskettes (lately)).
After a long search and a lot of reading, I decided to start from here: https://forums.gentoo.org/viewtopic.php?t=151242, but due to some problems like the new format of the LiveCD (squashfs support, etc) I had a hard time. Now that everyhting seems to work, I decided to write this short HOWTO.
I had to patch the linuxrc script found on the LiveCD with two patches. The first is to make it boot from PXE and the second is adding a default parameter for keymap (may be not needed on normal boot). Patches are available separately from ftp://ftp.tar.bz/pub/my_software/LiveCD+PXE/misc/ for review.
First setup the server for DHCP and tftp. On your PXE-to-be server do (as root):
Code: | emerge -av dhcp tftp-hpa |
Then (possibly on another machine) download ftp://ftp.tar.bz/pub/my_software/LiveCD+PXE/LiveCD+PXE-0.0.1.tar.bz2
and do as root:
Code: | tar xjvf LiveCD+PXE-0.0.1.tar.bz2
cd LiveCD+PXE-0.0.1 |
There is a directory called SRV_ROOT with some example files for your PXE-to-be server. Have a look and edit them as appropriate.
Edit the top part of LiveCD+PXE.sh to suit your needs and
Code: | ./LiveCD+PXE.sh smp init
./LiveCD+PXE.sh smp finish |
Start the dhcp and tftp services (on the server):
Code: | /etc/init.d/in.tftpd restart
/etc/init.d/dhcp restart |
If everything went OK, you are ready to boot.
As, always any comments/suggestions/bugfixes are welcome!
TODO list:
0. Fix inevitable bugs.
1. Change the linuxrc script in the original LiveCD and try to boot (i.e. my patches should not harm the original LiveCD).
2. Write some more documentation/links about PXE, GRUB+PXE, etc.
3. Can I use the minimal iso image?
4. Check/fix the "Failed to unmount initrd" error MSG on boot.
5. Add "clean" command to remove temp files. |
|
Back to top |
|
|
LinuxRocks Guru
Joined: 27 Nov 2003 Posts: 397 Location: New Mexico
|
Posted: Wed Sep 08, 2004 12:18 am Post subject: |
|
|
Very nice. I want to try this as soon as I can. I needed something like this this last weekend, but unfortunatly, I didnt know it existed and used a flash rom to install the base system (My mobo has a flash reader builtin and was able to boot from it).
This will be very handy as we plan to migrate several servers and machines over to Linux.
Thanks a million
Joe |
|
Back to top |
|
|
someguy Guru
Joined: 10 Jul 2003 Posts: 433 Location: (-_-) .::OH_WELL::. (-_-)
|
Posted: Wed Sep 08, 2004 10:17 am Post subject: |
|
|
i cant get the file from your server keeps sqaying file doesnt exist or may be moved hope you can get it back up being as id like to use this lol thanks buddy _________________ print pack"C*",split/\D+/,`echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<>
)]}\EsMsKsN0[lN*1lK[d2%Sa2/d0<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<J]dsJxp"|dc`
while [ 1 ] ; do echo "*" | telnet ip.of.print.er 9100 ; done |
|
Back to top |
|
|
troffe n00b
Joined: 22 May 2004 Posts: 3 Location: Greenwich, London
|
Posted: Wed Sep 08, 2004 1:55 pm Post subject: |
|
|
Hi All,
Thanks for the howto, it had some good infomation. i like you had to PXE boot my system to install gentoo. although i did'it using a Knoppix Live CD and the Knoppix Terminal Server (PXE booting my laptop off my deskyop computer) and then used the alternative installation guide
( http://www.gentoo.org/doc/en/altinstall.xml#doc_chap3 ) .
worked a dream, on my IBM Thinkpad X24 and Compaq EN 733. i have also used it on a large amount of different hardware with no problems including H(D)ell's |
|
Back to top |
|
|
Kalin Tux's lil' helper
Joined: 22 Dec 2002 Posts: 130 Location: Germany
|
Posted: Wed Sep 08, 2004 11:24 pm Post subject: |
|
|
Hmm, sorry about my server not responding, it was down for some unknown reason, checking it now.
At the moment it should work.
troffe, the alternative instal guide had some good info as well, I just wanted to use the LiveCD (i.e. not make another system).
someguy, please try to get the files again, sorry :-| |
|
Back to top |
|
|
Lightspeed n00b
Joined: 21 Feb 2003 Posts: 57 Location: UK
|
Posted: Thu Sep 16, 2004 1:14 am Post subject: |
|
|
Hi there, nice to see that my initial effort with the 2004.0 Live CD has proved to be useful
Last week I did actually update my own procedure to work with the slightly changed format of the 2004.2 CD, though I didn't get round to posting the changes here - and I used it to install gentoo on my lovely new Centrino laptop (it does actually have a CD drive, but I find it more fun to use PXE!).
Anyway, by the looks of things your script for modifying the CD etc seems a lot more organised than the poor explanation I gave in my earlier thread, though I haven't got round to trying yours out yet.
Considering that this really doesn't require much alteration to the standard Live CD in order to get it to work, it would be nice if it could eventually become a supported installation option.
Regarding your TODO list... I see no reason why this won't already work with the minimal iso, so I don't think #3 is a problem. |
|
Back to top |
|
|
someguy Guru
Joined: 10 Jul 2003 Posts: 433 Location: (-_-) .::OH_WELL::. (-_-)
|
Posted: Mon Sep 20, 2004 4:05 am Post subject: |
|
|
thanks _________________ print pack"C*",split/\D+/,`echo "16iII*o\U@{$/=$z;[(pop,pop,unpack"H*",<>
)]}\EsMsKsN0[lN*1lK[d2%Sa2/d0<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<J]dsJxp"|dc`
while [ 1 ] ; do echo "*" | telnet ip.of.print.er 9100 ; done |
|
Back to top |
|
|
Dragonlord Guru
Joined: 22 Aug 2004 Posts: 446 Location: Switzerland
|
Posted: Fri Sep 24, 2004 3:03 am Post subject: |
|
|
tried this out on my machine because i need to setup my new server on a machine i've no floppy and cdrom on it.
the old-server hosts the DHCP/TFTP and the new server should boot-install from it.
now i tried everything to no avail. whenever i boot from my new server i either get a kernel panic with something like "root=NULL is not valid" or such a crap or i get some hang with "unsupported fs" or something along that (sorry for the lack of info but it's 5am here and still no solution).
i guess the problem must be in the grub.lst file i need to get the pxegrub bootloader fired up. the loader works and he also fetches the image (i spezified the smp image from the livecd manipulated with your script) but during boot it hangs.
that's my grub.lst... wtf is not correct on this one? i've copied this one together snooping on the livecd but somehow shit works.
Code: | default 0
timeout 30
title=Diskless Gentoo
root (nd)
#kernel /newserver/boot/smp ip=dhcp root=/dev/nfs nfsroot=192.168.1.10:/diskless/newserver
kernel /newserver/boot/smp initrd=/newserver/boot/smp.igz root=/dev/ram0 init=/linuxrc acpi=off looptype=squashfs loop=/newserver/livecd.squashfs cdroot |
if i use the /dev/nfs line i get an error that the device 'nfs' is not found or not working. and if i use the second line i end up with that 'root=NULL' crap.
somebody has a working grub.lst file for me? i need a solution to that one quickly (my first attempt was using a USB-Memstick image but the howto failed due to an invalid script in the portage tree). _________________ DragonDreams: Leader and Head Programmer |
|
Back to top |
|
|
vh1 n00b
Joined: 04 Apr 2006 Posts: 1
|
Posted: Tue Apr 04, 2006 4:32 pm Post subject: |
|
|
hey there
with minor modifications I've gotten your script to run on my ubuntu (breezy) system with the minimal cd. it was very simple, instances of livecd.squashfs had to be changed to image.squashfs and I had to use cpio instead of mounting the "old" kernel image" snf everything builds fine.
using pxelinux I can get the desired computer to boot and download the gentoo.igz file, but then it complains about there being no init found and suggest I put an init option in my boot options. but the problem is, that exists
Code: | label gentoo
kernel gentoo
append root=/dev/ram0 init=/linuxrc ramdisk_size=80000 dokeymap looptype=squashfs loop=/image.squashfs cdroot initrd=gentoo.igz vga=791 splash=silent,theme:livecd-2006.0 CONSOLE=/dev/tty1 quiet |
would anyone happen to know what's going on? |
|
Back to top |
|
|
pentium4borg n00b
Joined: 29 Aug 2006 Posts: 47
|
Posted: Wed Apr 18, 2007 6:10 pm Post subject: |
|
|
I have the same problem as vh1. Can anyone provide insight? Are there other methods for booting a Gentoo LiveCD image over PXE? |
|
Back to top |
|
|
Kalin Tux's lil' helper
Joined: 22 Dec 2002 Posts: 130 Location: Germany
|
Posted: Thu Apr 19, 2007 2:07 pm Post subject: Need info! |
|
|
Well, if you post a bit more info, like more of the MSGs that are shown on the screen, etc. I might be able to help you. |
|
Back to top |
|
|
pentium4borg n00b
Joined: 29 Aug 2006 Posts: 47
|
Posted: Wed Apr 25, 2007 4:11 pm Post subject: |
|
|
I finally figured out how to modify the LiveCD to boot over PXE. I was going to past a few days ago, but I've been in and out.
I did some searching and after some trial and error I got through the problems I was having, thanks in part to the original patch provided by Kalin. gentoo.igz is a multipart cpio archive, which the cpio I had (2.7-r1) didn't like, but I was able to get this to work using cpio-2.6-r5. I extracted and made a patch for the linuxrc file that allows the system to boot from the squashfs when image.squashfs is put inside gentoo.igz.
I wrote a script that does everything for you with the 2006.1 LiveCD. It's attached in a tar file along with the patch. Remember to have cpio-2.6-r5 installed when you run this, for some reason 2.7-r1 doesn't like the multipart archive:
Code: | emerge =app-arch/cpio-2.6-r5 |
Here's the full text of both files:
linuxrc.patch
Code: | --- linuxrc 2007-04-25 12:03:42.000000000 -0400
+++ linuxrc 2007-04-25 12:04:19.000000000 -0400
@@ -51,6 +51,14 @@
CMDLINE="`cat /proc/cmdline`"
# Scan CMDLINE for any specified real_root= or cdroot arguments
REAL_ROOT=''
+
+#Override cdroot if defined after PXE
+if [ "${PXE}" = 1 ]
+then
+ REAL_ROOT="PXE"
+fi
+
+
for x in ${CMDLINE}
do
case "${x}" in
@@ -74,6 +82,10 @@
CDROOT=1
CDROOT_DEV=`parse_opt "${x}"`
;;
+ # PXE
+ PXE)
+ PXE=1
+ ;;
# Start livecd loop and looptype options
loop\=*)
LOOP=`parse_opt "${x}"`
@@ -361,6 +373,10 @@
read REAL_ROOT
got_good_root=0
+ elif [ "${PXE}" = 1 -o -b "${REAL_ROOT}" ]
+ then
+ got_good_root=1
+
# Check for a block device or /dev/nfs
elif [ -b "${REAL_ROOT}" ] || [ "${REAL_ROOT}" = "/dev/nfs" ]
then
@@ -486,7 +502,7 @@
fi
fi
- cache_cd_contents
+ #cache_cd_contents
# Setup the loopback mounts
if [ "${LOOPTYPE}" = 'normal' ]
@@ -500,7 +516,15 @@
elif [ "${LOOPTYPE}" = 'squashfs' ]
then
good_msg 'Mounting squashfs filesystem'
- mount -t squashfs -o loop,ro ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP} ${NEW_ROOT}/mnt/livecd
+ #The image is in different place on the real LiveCD
+ if [ "${PXE}" = 1 ]
+ then
+ squash_prefix=''
+ mount -t squashfs -o loop,ro ${LOOP} ${NEW_ROOT}/mnt/livecd
+ else
+ squash_prefix="${NEW_ROOT}/mnt/cdrom/${LOOPEXT}"
+ mount -t squashfs -o loop,ro ${NEW_ROOT}/mnt/cdrom/${LOOPEXT}${LOOP} ${NEW_ROOT}/mnt/livecd
+ fi
test_success 'Mount filesystem'
FS_LOCATION='mnt/livecd'
|
gentoo-pxe.sh
Code: | #!/bin/bash
this_iso="install-x86-minimal-2006.1.iso";
if [ -d pxe_temp ]; then
echo "!!! Directory pxe_temp already exists."
exit
fi
if [ -d pxe_out ]; then
echo "!!! Directory pxe_out already exists."
exit
fi
mkdir -p pxe_temp/{iso,cpio}
mkdir -p pxe_out
if [ -e $this_iso ]; then
echo "Found LiveCD iso"
else
echo "Downloading LiveCD iso ..."
wget 'http://bouncer.gentoo.org/?product=gentoo-2006.1-minimal&os=x86'
fi
cd pxe_temp
echo "Mounting LiveCD"
mount ../$this_iso iso/ -o loop
cd cpio
echo "Unpacking gentoo.igz"
zcat ../iso/isolinux/gentoo.igz | sed -e 's/TRAILER/notTRAILER/g' | cpio -idv 2>/dev/null
echo "Patching linuxrc"
patch -p0 < ../../linuxrc.patch >/dev/null
echo "Copying files"
cp linuxrc init
cp ../iso/image.squashfs .
echo "Repacking gentoo.igz"
find * | cpio --quiet --dereference -o -H newc 2>/dev/null | gzip -9 > ../gentoo.igz
cd ..
echo "Wrapping up"
cp gentoo.igz ../pxe_out
cp iso/isolinux/gentoo ../pxe_out
echo "Unmounting LiveCD"
umount iso/
cd ../
rm -rf pxe_temp
echo "DONE"
echo
echo "PXE files gentoo and gentoo.igz are in directory pxe_out"
echo "To use, put the following into your PXE configuration:"
echo
echo "LABEL gentoo"
echo " kernel gentoo"
echo " append initrd=gentoo/gentoo.igz root=/dev/ram0 init=linuxrc loop=/image.squashfs looptype=squashfs cdroot=1 vga=791 real_root=/dev/ram0 PXE splash=silent,theme:livecd-2006.1 CONSOLE=/dev/tty1 quiet"
|
To use these, put them both in the same folder and then run gentoo-pxe.sh. If you get error(s) about there not being a linuxrc when the script runs, you have to downgrade your cpio to 2.6-r5. |
|
Back to top |
|
|
|
|
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
|
|