Booting via PXE.. The how-to 2

All other questions
ParsEmAll
Posts: 7
Joined: 05 Jun 2006, 14:16

Booting via PXE.. The how-to 2

Post by ParsEmAll » 05 Jun 2006, 15:26

Hi @ all

This how to is similar to http://www.sysresccd.org/forums/viewtopic.php?t=897.

This how to does not need a NFS Server. It boots the SystemRescueCD from a initrd image.

What do you need:
A working dhcp-server, a tftp-server, about 500MB free space on the server.

Your Clients need to have at least 256MB of Ram.

I use Ubuntu Dapper and my tftproot is /tftproot.

1. making a working directory:

Code: Select all

cd /tftproot
mkdir sysresccd
cd sysresccd
2. getting a SystemRescueCD and mounting it
please use a mirror close you!

Code: Select all

wget http://switch.dl.sourceforge.net/sourceforge/systemrescuecd/systemrescuecd-x86-0.2.19.iso
mkdir iso
mount -t iso9660 -o loop systemrescuecd-x86-0.2.19.iso iso
3. kernel and initrd

Code: Select all

cp iso/isolinux/vmlinuz1 .
cp iso/isolinux/initrd1 .
4. mounting the old initrd

Code: Select all

mkdir init
cp initrd1 initrd1_old.gz
gunzip initrd1_old.gz
mount -t ext2 -o loop initrd1_old /tftproot/sysresccd/init
5. making a new initrd
This initrd will be about 130MB.

Code: Select all

mkdir rd
dd if=/dev/zero of=/tftproot/sysresccd/initrd.img bs=1k count=133120
mke2fs /tftproot/sysresccd/initrd.img
mke2fs 1.38 (30-Jun-2005)
/tftproot/sysresccd/initrd.img is not a block special device.
Proceed anyway? (y,n)
Here you can answer "y".

6. mounting the new initrd

Code: Select all

mount -t ext2 -o loop initrd.img /tftproot/sysresccd/rd
7. copying the needed files an the new initrd

Code: Select all

cp -a init/* rd/
cp iso/sysrcd.dat rd/
8. optional: copying the memdisk images
My dosdisks are stored on "/tftproot/dosdisks".

Code: Select all

mkdir /tftproot/dosdisks/sys
cp -a iso/bootdisk/* /tftproot/dosdisks/sys
9. edit linuxrc

Code: Select all

cp rd/linuxrc rd/linuxrcmy
nano -w rd/linuxrcmy
this will be really a hack, but for me it works. You have to modify linuxrcmy like this:

Code: Select all

# diff init/linuxrc rd/linuxrcmy
135a136,137
>
>     mknod -m 660 /newroot/dev/ram0 b 1 0  2>/dev/null
356a359,365
>   initmsg "---- Mounting RAM as CD"
>   mount -o bind / /newroot/mnt/cdrom
>   mounted=/newroot/dev/ram0
>   CLOOPPATH=/newroot/mnt/cdrom/sysrcd.dat
>   echo -e "${HILITE}---- RAM medium found on $devname${NORMAL}"
>   alias l='ls -lha'
>
373a383
>
the line with the alias is option. It helped me do debug my linuxrcmy.

10. unmounting files an gzip the initrd

Code: Select all

umount /tftproot/sysresccd/init
umount /tftproot/sysresccd/rd
umount /tftproot/sysresccd/iso
gzip -9 -c initrd.img > initrd.gz
11. making a tftp menu and modifying default
this menu will show up, wenn you boot via pxe:

Code: Select all

nano -w /tftproot/menu.txt
add this in menu.txt:

Code: Select all

===== Linux Live Systems ===========
type: sys-----------> sysrescuecd
this is optional, but needed if you followed step 8:

Code: Select all

nano -w /tftproot/menu.txt
add this in menu.txt:

Code: Select all

===== DOS DISKS ====================
type: aida----------> aida 4 freedos
type: dban         -> wipes out all disks
type: freedos-------> free dos clone
type: gag          -> gag boot manager
type: ntpass--------> recover nt passwords
type: ranish       -> Partition manager
and now pxelinux.cfg/default:

Code: Select all

nano -w /tftproot/pxelinux.cfg/default
add this in default:

Code: Select all

LABEL sys
        KERNEL sysresccd/vmlinuz1
        APPEND initrd=sysresccd/initrd.gz root=/dev/ram0 init=/linuxrcmy ramdisk_size=130000 vga=791
this is optional, but needed if you followed step 8:

Code: Select all

LABEL dban
        KERNEL memdisk
        APPEND initrd=dosdisks/sys/dban.img
LABEL freedos
        KERNEL memdisk
        APPEND initrd=dosdisks/sys/freedos.img
LABEL gag
        KERNEL memdisk
        APPEND initrd=dosdisks/sys/gag.img
LABEL ntpass
        KERNEL memdisk
        APPEND initrd=dosdisks/sys/ntpass.img
LABEL ranish
        KERNEL memdisk
        APPEND initrd=dosdisks/sys/ranish.img
So now resart your Client an boot it via PXE. On my Thinkpad I have to press F12 on Startup.

My Server has also samba running. I can mount samba shares and bake my windows installation to them.

So I hope this how to is usefull to you.

Greetings from Switzerland.

oneill
Posts: 3
Joined: 04 Jun 2006, 13:20

Post by oneill » 06 Jun 2006, 13:24

Hello!

Which tftpd u used?

I tried with atftpd but it cant load that big image and I set −−option blksize 1428 size to many different value but no luck.

Greetings from Darnassus.

ParsEmAll
Posts: 7
Joined: 05 Jun 2006, 14:16

Post by ParsEmAll » 08 Jun 2006, 17:16

Hi oneill

I didn't touch blksize options! I use the tftpd-hpa.

My configuration of the tftpd-hpa is the following:

Code: Select all

# cat /etc/default/tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -s /tftproot -u nobody -p -v"
It runs as a standalone daemon, its root is "/tftproot", it leaves out additional permission checks and runs as "nobody". Logging is verbosed.
Files under and root of "/tftproot" must be world readable.

With this I can boot also a gentoo whitch rootfs (initrd) image is uncompressed 500MB (112MB compressed). The limitation (afaik) is the amount of ram the client has. The image must fit uncompressed into the client ram.

Greetings

ParsEmAll
Posts: 7
Joined: 05 Jun 2006, 14:16

Chapter 8 modifikation

Post by ParsEmAll » 11 Jun 2006, 18:55

In order to use Chapter 8 from the manual, you have to use a modifikation:


5. making a new initrd
we need a bigger initrd image:

Code: Select all

...
dd if=/dev/zero of=/tftproot/sysresccd/initrd.img bs=1k count=150000
...
7. copying the needed files an the new initrd
we need all content from the original iso:

Code: Select all

...
cp -a iso/* rd/ 

11. making a tftp menu and modifying default
reflect changes to the "/tftproot/pxelinux.cfg/default":

Code: Select all

...
LABEL sys
        KERNEL sysresccd/vmlinuz1
        APPEND initrd=sysresccd/initrd.gz root=/dev/ram0 init=/linuxrcmy ramdisk_size=150000 vga=791
...
hope this one will be helpfull.

ParsEmAll

oneill
Posts: 3
Joined: 04 Jun 2006, 13:20

Post by oneill » 16 Jun 2006, 16:12

Hi!

This TFTPD-HPA works fine so i can advice to any1 who follow this howto, step 0. change tftpd to this. You can't make it work with a usual tftpd or aftpd or default tftpd in bsd,aix etc.

But i still have problems with booting, it would be nice if you link your complete linuxmyrc here.

THX

Oneill

ParsEmAll
Posts: 7
Joined: 05 Jun 2006, 14:16

complete linuxmyrc

Post by ParsEmAll » 18 Jun 2006, 13:04

here is my complete linuxmyrc:

Code: Select all

#!/bin/sh
#
# Script to boot up a system with autodetection of CD location
#
# Original version written by Daniel Robbins <[email protected]>
# Copyright 2002 Gentoo Technologies, Inc.
# Distributed under the GPL

PATH=/usr/sbin:/usr/bin:/sbin:/bin
BACK_UP="\033[1K\033[0G"
HILITE="\033[1m"
NORMAL="\033[0m"
BOOTFROM="" # device for option such as bootfrom=/dev/hda1
CLOOPPATH="" # patch for the cloop file (sysrcd.dat)
mount -oremount,rw /
mount -t proc /proc /proc
# Disable kernel messages to console:
echo "0" > /proc/sys/kernel/printk
SCSI="yes"
USBSTICK="no"
CDCACHE="no"
IDEBUG="no"
ASKKEYMAP="yes"
CMDLINE="`cat /proc/cmdline`"
for x in $CMDLINE
do
        if [ "$x" = "noscsi" ]
        then
                SCSI="no"
        elif [ "$x" = "usbstick" ]
        then
                USBSTICK="yes"
        elif [ "$x" = "cdcache" ]
        then
                CDCACHE="yes"
        elif [ "$x" = "nokeymap" ]
        then
                ASKKEYMAP="no"
        elif [ "$x" = "idebug" ]
        then
                IDEBUG="yes"
        fi
done

# ---- Debugging: use system from hard disk instead of cloop ----
#SETROOT_VALUE=""
#SETROOT_ENABLED="no"
if [ -r /proc/cmdline ]; then
  for parm in `cat /proc/cmdline`; do
    parm=`echo $parm | sed -e 's/^ *//' | tr [A-Z] [a-z]`
    name=`echo $parm | cut -f1 -d=`
    value=`echo $parm | cut -f2 -d=`
    case $name in
      setroot)
        SETROOT_VALUE="$value"
        SETROOT_ENABLED="yes"
        ;;
      bootfrom)
        BOOTFROM="$value"
        ;;
    esac
  done
fi

makenodes()
{
    mknod /dev/cloop b 240 0 2>/dev/null
    mknod /dev/cloop1 b 240 0 2>/dev/null

    mknod -m 660 /newroot/dev/uba  b 180 0 2>/dev/null
    mknod -m 660 /newroot/dev/uba1 b 180 1 2>/dev/null
    mknod -m 660 /newroot/dev/uba2 b 180 2 2>/dev/null
    mknod -m 660 /newroot/dev/uba3 b 180 3 2>/dev/null
    mknod -m 660 /newroot/dev/uba4 b 180 4 2>/dev/null
    mknod -m 660 /newroot/dev/ubb  b 180 8 2>/dev/null
    mknod -m 660 /newroot/dev/ubb1 b 180 9 2>/dev/null
    mknod -m 660 /newroot/dev/ubb2 b 180 10 2>/dev/null
    mknod -m 660 /newroot/dev/ubb3 b 180 11 2>/dev/null
    mknod -m 660 /newroot/dev/ubb4 b 180 12 2>/dev/null
    mknod -m 660 /newroot/dev/ubc  b 180 16 2>/dev/null
    mknod -m 660 /newroot/dev/ubc1 b 180 17 2>/dev/null
    mknod -m 660 /newroot/dev/ubc2 b 180 18 2>/dev/null
    mknod -m 660 /newroot/dev/ubc3 b 180 19 2>/dev/null
    mknod -m 660 /newroot/dev/ubc4 b 180 20 2>/dev/null
    mknod -m 660 /newroot/dev/ubd  b 180 24 2>/dev/null
    mknod -m 660 /newroot/dev/ubd1 b 180 25 2>/dev/null
    mknod -m 660 /newroot/dev/ubd2 b 180 26 2>/dev/null
    mknod -m 660 /newroot/dev/ubd3 b 180 27 2>/dev/null
    mknod -m 660 /newroot/dev/ubd4 b 180 28 2>/dev/null

    mknod -m 660 /newroot/dev/sda  b 8 0 2>/dev/null
    mknod -m 660 /newroot/dev/sda1 b 8 1 2>/dev/null
    mknod -m 660 /newroot/dev/sda2 b 8 2 2>/dev/null
    mknod -m 660 /newroot/dev/sda3 b 8 3 2>/dev/null
    mknod -m 660 /newroot/dev/sda4 b 8 4 2>/dev/null
    mknod -m 660 /newroot/dev/sdb  b 8 16 2>/dev/null
    mknod -m 660 /newroot/dev/sdb1 b 8 17 2>/dev/null
    mknod -m 660 /newroot/dev/sdb2 b 8 18 2>/dev/null
    mknod -m 660 /newroot/dev/sdb3 b 8 19 2>/dev/null
    mknod -m 660 /newroot/dev/sdb4 b 8 20 2>/dev/null
    mknod -m 660 /newroot/dev/sdc  b 8 32 2>/dev/null
    mknod -m 660 /newroot/dev/sdc1 b 8 32 2>/dev/null
    mknod -m 660 /newroot/dev/sdc2 b 8 33 2>/dev/null
    mknod -m 660 /newroot/dev/sdc3 b 8 34 2>/dev/null
    mknod -m 660 /newroot/dev/sdc4 b 8 35 2>/dev/null
    mknod -m 660 /newroot/dev/sdd  b 8 48 2>/dev/null
    mknod -m 660 /newroot/dev/sdd1 b 8 49 2>/dev/null
    mknod -m 660 /newroot/dev/sdd2 b 8 50 2>/dev/null
    mknod -m 660 /newroot/dev/sdd3 b 8 51 2>/dev/null
    mknod -m 660 /newroot/dev/sdd4 b 8 52 2>/dev/null
    mknod -m 660 /newroot/dev/sde  b 8 64 2>/dev/null
    mknod -m 660 /newroot/dev/sde1 b 8 65 2>/dev/null
    mknod -m 660 /newroot/dev/sde2 b 8 66 2>/dev/null
    mknod -m 660 /newroot/dev/sde3 b 8 67 2>/dev/null
    mknod -m 660 /newroot/dev/sde4 b 8 68 2>/dev/null
    mknod -m 660 /newroot/dev/sdf  b 8 80 2>/dev/null
    mknod -m 660 /newroot/dev/sdf1 b 8 81 2>/dev/null
    mknod -m 660 /newroot/dev/sdf2 b 8 82 2>/dev/null
    mknod -m 660 /newroot/dev/sdf3 b 8 83 2>/dev/null
    mknod -m 660 /newroot/dev/sdf4 b 8 84 2>/dev/null
    mknod -m 660 /newroot/dev/sdg  b 8 96 2>/dev/null
    mknod -m 660 /newroot/dev/sdg1 b 8 97 2>/dev/null
    mknod -m 660 /newroot/dev/sdg2 b 8 98 2>/dev/null
    mknod -m 660 /newroot/dev/sdg3 b 8 99 2>/dev/null
    mknod -m 660 /newroot/dev/sdg4 b 8 100 2>/dev/null
    mknod -m 660 /newroot/dev/sdh  b 8 112 2>/dev/null
    mknod -m 660 /newroot/dev/sdh1 b 8 113 2>/dev/null
    mknod -m 660 /newroot/dev/sdh2 b 8 114 2>/dev/null
    mknod -m 660 /newroot/dev/sdh3 b 8 115 2>/dev/null
    mknod -m 660 /newroot/dev/sdh4 b 8 116 2>/dev/null

    mknod -m 660 /newroot/dev/scd0 b 11 0  2>/dev/null
    mknod -m 660 /newroot/dev/scd1 b 11 1  2>/dev/null
    mknod -m 660 /newroot/dev/scd2 b 11 2  2>/dev/null
    mknod -m 660 /newroot/dev/scd3 b 11 3  2>/dev/null
}

# ----
dropshell()
{
    export PS1
    echo "6" > /proc/sys/kernel/printk
    # Allow signals
    #trap 1 2 3 15
    exec /bin/ash
}

blurb()
{
    echo -ne ${HILITE}${1}
}

backup()
{
    echo -ne "\033[0G\033[0K"
}

# Create the new root FS
mkdir newroot
mount -t tmpfs tmpfs /newroot
cd /newroot
mkdir dev mnt mnt/cdrom mnt/cloop mnt/.init.d mnt/gentoo
mkdir mnt/custom mnt/temp1 mnt/temp2 mnt/temp3 mnt/temp4
mkdir mnt/part mnt/images

if [ ! -e /newroot/dev/.devfsd ]
then
        #mount devfs
        #mount -t devfs devfs /newroot/dev
        #Starting udev
        mount -t sysfs /sys /sys >/dev/null 2>&1
        mount -t tmpfs udev /newroot/dev
        mkdir /newroot/dev/pts
        mkdir /newroot/dev/shm
        echo "Creating initial device nodes..."
        echo /sbin/udevsend > /proc/sys/kernel/hotplug
        /sbin/udevstart
        ln -snf /proc/self/fd /dev/fd
        ln -snf /proc/self/fd/0 /dev/stdin
        ln -snf /proc/self/fd/1 /dev/stdout
        ln -snf /proc/self/fd/2 /dev/stderr
        ln -snf /proc/kcore /dev/core
        mount -t devpts devpts /newroot/dev/pts
        mount -o bind /newroot/dev /dev
        ##### End

fi

mounted=""

initmsg()
{
        echo -e "${HILITE}${*}${NORMAL}"
}

nocd()
{
        echo -e "${HILITE}---- CD not found${NORMAL}"
        umount /newroot
        ash
        umount /proc
        exec /linuxrc
}

getkeymap()
{
        local mykeymap
        echo -ne ${HILITE}
        cat /keymaps/key.lst
        echo -ne ${NORMAL}
        read -p "Keymap selection: " mykeymap
        if [ -e /keymaps/${mykeymap}.map ]
        then
                instkeymap ${mykeymap}
        elif [ "$mykeymap" = "" ]
        then
                #default keymap is "speakup"
                echo -e "${HILITE}---- Loading default (speakup) keymap${NORMAL}"
                instkeymap "speakup"
        else
                getkeymap
        fi
}

instkeymap()
{
        echo -e "${HILITE}---- Loading ${1} keymap${NORMAL}"
        loadkmap < /keymaps/${1}.map
}

modules_scan()
{
        local type
        type=${1}; shift
        for x in "[email protected]"
        do
                if [ ! -e /modules/${type}/${x}.ko ]
                then
                        echo -e "${HILITE}---- Module ${x}.ko not found; skipping...${NORMAL}"
                        continue
                fi
                blurb "---- Scanning for ${x}..."
                insmod -f /modules/${type}/${x}.ko > /dev/null 2>&1
                if [ $? -eq 0 ]
                then
                        backup
                        echo -e "---- Detecting ${x} hardware/software${NORMAL}"
                else
                        backup
                        echo -ne "${NORMAL}"
                fi
        done
}

findmount()
{
        if [ "$*" = "" ]
        then
                nocd
        fi
        while ! mount -t iso9660 -r $1 /newroot/mnt/cdrom
        do
                shift
                if [ "$1" = "" ]; then
                        nocd
                fi
        done
        if [ ! -e /newroot/mnt/cdrom/sysrcd.dat ]; then
                echo -e "${HILITE}---- $1 is not a LiveCD; skipping...${NORMAL}"
                umount /newroot/mnt/cdrom
                shift
                findmount $*
        fi
        mounted=$1
        CLOOPPATH=/newroot/mnt/cdrom/sysrcd.dat
        echo -e "${HILITE}---- CD medium found on $1${NORMAL}"
}

findusbmount()
{
    for i in uba ubb ubc ubd sda sdb sdc sdd sde sdf sdg sdh
    do
        for j in 1 2 3 4 ""
        do
            devname="/newroot/dev/$i$j"
            if mount -t vfat -r $devname /newroot/mnt/cdrom 2>/dev/null
            then
                    if [ ! -e /newroot/mnt/cdrom/sysrcd.dat ]; then
                            #echo -e "${HILITE}---- $devname is not a Live-USB Stick; skipping...${NORMAL}"
                            umount /newroot/mnt/cdrom
                    else
                            mounted=$devname
                            CLOOPPATH=/newroot/mnt/cdrom/sysrcd.dat
                            echo -e "${HILITE}---- USB medium found on $devname${NORMAL}"
                            return 1;
                    fi
            fi
         done
    done
    return 0;
}

# Get the keymap (setkmap=xx)
setkmap()
{
  if [ -r /proc/cmdline ]; then
    for parm in `cat /proc/cmdline`; do
      parm=`echo $parm | sed -e 's/^ *//' | tr [A-Z] [a-z]`
      name=`echo $parm | cut -f1 -d=`
      value=`echo $parm | cut -f2 -d=`
      case $name in
        setkmap)
          forced_kmap=$value
          ;;
      esac
    done
  fi

  if [ "$forced_kmap" = "" ]; then
       if [ "$ASKKEYMAP" = "yes" ]; then
           getkeymap
       fi
  else
       echo "Keymap by cmdline = $forced_kmap"
       instkeymap "$forced_kmap"
  fi
}

# Set the keymap
setkmap

# Create devices nodes
makenodes

# Sleep 7 seconds for hardware
# If we do not sleep, the hardaware (cdrom, usb stick) is not found

initmsg "---- Mounting the device with SysRescCd..."
sleep 7

# Mount the device

if [ "$BOOTFROM" ]
then
   initmsg "---- Mounting the hard disk drive $BOOTFROM"
   mount -o ro "/newroot/$BOOTFROM" /newroot/mnt/cdrom
   if [ ! -e /newroot/mnt/cdrom/sysrcd/sysrcd.dat ]; then
     echo -e "${HILITE}---- cannot find /sysrcd/sysrcd.dat on $BOOTFROM, skipping...${NORMAL}"
     umount /newroot/mnt/cdrom
   else
     mounted=$BOOTFROM
     CLOOPPATH=/newroot/mnt/cdrom/sysrcd/sysrcd.dat
     echo -e "${HILITE}---- System found on $BOOTFROM${NORMAL}"
   fi
fi

   initmsg "---- Mounting RAM as CD"
   mount -o bind / /newroot/mnt/cdrom
   mounted=/newroot/dev/ram0
   CLOOPPATH=/newroot/mnt/cdrom/sysrcd.dat
   echo -e "${HILITE}---- RAM medium found on $devname${NORMAL}"
   alias l='ls -lha'

if [ ! "$mounted" ]
then
  if [ "$USBSTICK" = "yes" ]
  then
    initmsg "---- Mounting the USB stick or CDRom drive"
    findusbmount
    if [ ! "$mounted" ]; then
      findmount /newroot/dev/cdroms/* /newroot/dev/scd*
    fi
  else
    if [ ! "$SETROOT_ENABLED" = "yes" ]; then
      initmsg "---- Mounting the CD"
      findmount /newroot/dev/cdroms/* /newroot/dev/scd*
    fi
  fi
fi

if [ "$IDEBUG" = "yes" ]
then
   exec /bin/sh
fi
if [ -e "$CLOOPPATH" ]
then
        if [ "$CDCACHE" = "yes" ]
        then
                initmsg "---- Attempting to cache CD image to tmpfs"

                # Cache autorun files too
                autoruns="$(ls -d /newroot/mnt/cdrom/autorun{,[0-9]} 2>/dev/null)"
                ar_copy=/newroot/var/autorun/cdrom
                [ "$autoruns" != "" ] && mkdir -p $ar_copy && cp $autoruns $ar_copy

                cp "$CLOOPPATH" /newroot/mnt/
                expectedsize=$(stat -c %s $CLOOPPATH)
                newfilesize=$(stat -c %s /newroot/mnt/sysrcd.dat)
                #echo "expected size=$expectedsize"
                #echo "newfile size =$newfilesize"
                if [ $newfilesize -ne $expectedsize ] # Was the copy completed successfully ?
                then # cdcache failed
                        initmsg "---- Caching failed (likely due to lack of memory)"
                        CDCACHE="no"
                        rm -f /newroot/mnt/sysrcd.dat
                        sleep 5
                else # cdcache successful
                        initmsg "---- Caching successful"
                        CLOOPPATH="/newroot/mnt/sysrcd.dat"
                fi
        fi
        initmsg "---- Mounting compressed loopback filesystem"
        #insmod /modules/cloop.ko file=$CLOOPPATH
        losetup2 /dev/cloop "$CLOOPPATH"
        mount -o ro -t ext2 /dev/cloop /newroot/mnt/cloop
        #dropshell
else
        if [ "$SETROOT_ENABLED" = "yes" ]
        then
                initmsg "---- debug: using HardDisk instead of Cloop image ($SETROOT_VALUE)"
                mount -o ro $SETROOT_VALUE /newroot/mnt/part
#
# root is now in $SETROOT_VALUE/ instead of $SETROOT_VALUE/sysresccd/cdroot/
# so bind to /newroot/mnt/part/
#
                mount -o bind /newroot/mnt/part/ /newroot/mnt/cloop
        else
                initmsg "---- Mounting loopback filesystem"
                losetup2 /dev/cloop /newroot/mnt/cdrom/sysrcd.dat
                mount -o ro -t ext2 /dev/cloop /newroot/mnt/cloop
        fi
fi
# Now the CD is mounted on /newroot/cdrom
initmsg "---- Copying and symlinking files from CD to populate /"

cd /newroot/
for x in bin sbin lib boot usr opt
do
        ln -s mnt/cloop/${x} ${x}
done
mkdir initrd proc tmp sys
#####End

chmod 1777 tmp
(cd /newroot/mnt/cloop; cp -a etc root home var /newroot)
#store name of mounted CD so we can add it to mtab.... (/etc/init.d/local will take it
#from here...
echo $mounted > tmp/mycd

initmsg "---- Switching to tmpfs root filesystem"
echo "6" > /proc/sys/kernel/printk
umount /proc
pivot_root . initrd
#chmod -t for CaptiveNtfs

mount -t tmpfs tmpfs /lib/firmware

chmod -t /
chmod 770 /
exec chroot . /sbin/init </dev/console >/dev/console 2>&1


ParsEmAll
Posts: 7
Joined: 05 Jun 2006, 14:16

similar howto for the GNAP

Post by ParsEmAll » 18 Jun 2006, 21:05

I hacked a similar howto for GNAP on the gentoo forums:
http://forums.gentoo.org/viewtopic-p-3390114.html

daffy
Posts: 5
Joined: 26 Jun 2006, 21:53

Same solution possible with less ram?

Post by daffy » 29 Jul 2006, 20:51

Hello,
Is it possible to make this solution work with just a small amount of ram installed in the client? (For example 128Mb)

orion
Posts: 1
Joined: 21 Feb 2007, 15:52

Post by orion » 21 Feb 2007, 16:04

I've just tried this how to but it doesn't work for me !
I've got this message just after it had loaded vmlinuz1 : could not find ramdisk image initrd.gz

If someone can explain me ?
I have exactly done the same things (same directories, same files ...) but no way.

Thanks

jcampbell
Posts: 1
Joined: 27 Jul 2007, 15:39

Update?

Post by jcampbell » 27 Jul 2007, 18:07

This guide is clear and easy to follow. I'm not new to PXE or LiveCD environments, but I'm far from a seasoned expert of modifying bootstrap processes.

The latest version of SystemRescueCD has some differences from the version this guide was designed (0.2.19) for and I'm wondering if somebody can help modify this guide to be applicable to the latest version (0.3.7).

Namely, there is no vmlinuz1 or initrd1 in the /isolinux folder, I've found a thread that says vmlinuz1 files are renamed 'rescuecd' but I don't know where to find initrd1 on the CD's filesystem.

If somebody can bring this article up to speed, it would help greatly, as this specific implementation is exactly what I'm looking for. I'm looking to boot SystemRescueCD into memory via PXE (NFS-root will not work) to perform disk cloning on large numbers of computers.

Additionally - why not have an official, updated guide about modifying SystemRescueCD to boot over PXE? Better yet, why not have a PXE-bootable distribution available for download?

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Post by admin » 27 Jul 2007, 21:42


namit
Posts: 12
Joined: 11 Jul 2007, 23:31

Post by namit » 29 Jul 2007, 20:58

I am getting the following error.

-- Copying and symlink files from CD to populate /
cd 463: cant cd to /newroot/
ln: bin/bin File exists
ln: sbin/sbin: File exists
ln: lib/lib....
ln: boot: ....
ln: usr/usr ....
ln: opt: ....
mkdir: Cannot create directory initrd File exists
mkdir: Cannot create directory proc File exists
mkdir: Cannot create directory tmp File exists
cd: 445 cant cd to /netwroot/mnt/cloop
cp: unable to stat /newroot/etc...
...
...

-- Switching to tmpfs root filesystem
pivot_root: pivot_root: Device or resources busy
mount: Mounting tmpfs on /lib/firmware no such file
chroot: cannot execute /sbin/init
Lernel panic - not sysncing: Attempted to kill init!

Anyone know what wrong here?

namit
Posts: 12
Joined: 11 Jul 2007, 23:31

Post by namit » 09 Aug 2007, 00:25

on step 6 i get the following

mount -t ext2 -o loop initrd.img /tftproot/sysresccd/rd
mount: wrong fs type, bad option, bad superblock on /dev/loop2,
missing codepage or other error
In some cases useful info is found in syslog - try
dmesg | tail or so


dmesg | tail
VFS: Can't find an ext2 filesystem on dev loop2.
VFS: Can't find an ext2 filesystem on dev loop2.
VFS: Can't find an ext2 filesystem on dev loop2.

Joelapache
Posts: 3
Joined: 26 Jun 2008, 12:03

Post by Joelapache » 26 Jun 2008, 12:17

I've followed this guide and this one:
http://usefulthings.org.uk/systemrescuecd-network-boot in non-NFS installation.
Booting, loading and:
invalid or corrupt kernel image
I'm trying severals solutions since 3 days now, I'm completely stuck and I have no more idea :/

PXE, TFTP and DHCP is working well.

Code: Select all

/tftpboot/
--- pxelinux.cfg/
------------default
--- sysreccd/
------------initrd.gz
------------sysrcd.dat
------------vmlinuz1
------------sysresccd
pxelinux.0
sysrrcd.dat
Content of my default:

Code: Select all

default sysresccd

label sysresccd
kernel sysresccd/vmlinuz1
append initrd=sysresccd/initrd.gz root=/dev/ram0 init=/linuxrcmy ramdisk_size=130000
Thanks in advance if you got the tip

admin
Site Admin
Posts: 2715
Joined: 17 Jul 2003, 09:44

Post by admin » 26 Jun 2008, 13:02

It seems this tutorial is based on an old version, and now PXE is supported in the official version without NFS. So please, follow this tutorial:
http://www.sysresccd.org/Sysresccd-manu ... rk_booting

If it says the image is corrupt, you should download the iso image again and check it's ok using md5sum.

Post Reply