beta-tester / RPi-PXE-Server

setup a Raspberry Pi as an PXE-Server
307 stars 63 forks source link

How to use $src_iso and $file_iso #13

Closed Bigjohn4 closed 5 years ago

Bigjohn4 commented 5 years ago

I am trying to get any Linux running on old laptop. Laptop will not boot DVD or USB drive. your PXE server worked well for many of the built in URLs and also several I added. But, several I want to try will not download, although I can download them from Firefox. They have lots of redirects, which could be the issue. I looking at pass2.sh, I found $src_iso and $file_iso. I put the ISOs I want to use on memory stick, but have been unable to get it to work. Do you have documentation on using these options? [using file name.txt]()

I tried above file, but it is not readable. Do I need a translation? I am including my configs and screen capture for my last try. I am using Raspberry Pi for PXE server.

beta-tester commented 5 years ago

hello, i am not able to open/see the content of the linked "using file name.txt" file... it seems to be a zip file with no useful content. this file isn't from me. maybe an attachement from somebody who wrote an issue or so. from where did you got that link?

what ISO did you tried? then i maybe can make an example.

to download, mount and export an ISO, you have to add: to p2-include-url.sh:

MY_ISO=<uniqe_name_without_blanks>
MY_ISO_URL=<url_to_iso_file>

to p2-include-handle.sh:

handle_iso $MY_ISO $MY_ISO_URL;

and to get it listed in the menu, add to p2-include-menu.sh:

#========== BEGIN ==========
if [ -f "$FILE_MENU" ] \
&& [ -f "$DST_NFS_ETH0/$MY_ISO/<path to kernel file e.g. vmlinuz>" ]; then
    echo  -e "\e[36m    add $MY_ISO\e[0m";
    sudo sh -c "cat << EOF  >> $FILE_MENU
    ########################################
    LABEL $MY_ISO
        MENU LABEL <name of iso live system>
        KERNEL $FILE_BASE$NFS_ETH0/$MY_ISO/<path to kernel file e.g. vmlinuz>
        INITRD $FILE_BASE$NFS_ETH0/$MY_ISO/<path to initrd file, e.g. initrd.img>
        APPEND nfsroot=$IP_ETH0:$DST_NFS_ETH0/$MY_ISO ro <boot options of your iso live system>
EOF";
fi
#=========== END ===========

you have to replace all MY_ISO & MY_ISO_URL to your preffered variable name. and everything in between <...> to the correct what ever is needed.

PS.: if you don't have an earlier version of RPi-PXE-Server cloned, then you don't have the stuff in seperated files. then you have to put those stuff in the install-pxe-server_pass2.sh file to the right spots/places. (maybe the variablenames do not fit, because the manes were changed in the meantime)

for the kernel and initrd file locations/names, you have to look into the iso to see where they are and what name they have.

for boot options you have to read the documentation of the used system and or watch into severan .cfg file in the iso. when the system is based of an other system that already is included in the project, you maybe can recyckle those boot options.

EDIT: when you already have downloaded an ISO and want to get it "detected" by the script, your ISO file have to be in the folder where $SRC_ISO variable is pointing to and the iso file itself has to have the name that the variable $MY_ISO contains with file extension ".iso", and a file with the same name but with extension ".url" must be at the same spot. then you also need to have a menu where all names will fit, otherwise you don'T get an menu entry. and at last also a handle $MY_ISO $MY_ISO_URL; command.

to prevent trying downloading/overriding the iso again, keep the ".url" file empty and also $MY_ISO_URL= should be empty in the script.

so more or less you have to do all the same steps above of the top part.

Bigjohn4 commented 5 years ago

When I was typing the issue, the text file name popped up. Thanks, I'll give the above a try and let you know. below is one that would not fetch, although I got the URL to work in Netscape. LINUX_LITE_URL=http://pumath.dl.osdn.jp/linux-lite-3.0-32bit.iso

beta-tester commented 5 years ago

in firefox with yout link, i get only 404 Not Found. but this is working for me at my location (germany): https://downloads.sourceforge.net/project/linuxlite/3.0/linux-lite-3.0-32bit.iso (the last available 32bit version is https://downloads.sourceforge.net/project/linuxlite/3.8/linux-lite-3.8-32bit.iso) the webpage of linux-lite tells linux-lite is based on ubuntu lts. so you can take a look to the boot menu for UBUNTU_LTS_X86, maybe they will fit.

EDIT: but you have to use /casper/initrd.gz instead of /casper/initrd in the menu for INITRD i downloaded both isos and watched the iso content.

Bigjohn4 commented 5 years ago

I downloaded the zip of latest scripts, and started with just one ISO. Still no luck. What am I missing? Attached file has changes I made to scripts.

JM

p2-include-handle.sh

handle_iso  $LINUX_LITE $LINUX_LITE_URL $LINUX_LITE_SRC_ISO $LINUX_LITE_FILE_ISO;
#handle_iso  $LINUX_LITE $LINUX_LITE_URL;

p2-include-menu.sh

#========== BEGIN ==========
if [ -f "$FILE_MENU" ] \
&& [ -f "$DST_NFS_ETH0/$LUNUX_LITE/casper/vmlinuz" ]; then
    echo  -e "\e[36m    add $LINUX_LITE\e[0m";
    sudo sh -c "cat << EOF  >> $FILE_MENU
    ########################################
    LABEL $LINUX_LITE
        MENU LABEL LINUX LITE
        KERNEL $FILE_BASE$NFS_ETH0/$LINUX_LITE/casper/vmlinuz
        INITRD $FILE_BASE$NFS_ETH0/$LINUX_LITE/casper/initrd.gz
        APPEND nfsroot=$IP_ETH0:$DST_NFS_ETH0/$LINUX_LITE ro netboot=nfs boot=live config  username=linux --
 locales=$CUSTOM_LANG_LONG.UTF-8 keyboard-layouts=$CUSTOM_LANG utc=no timezone=$CUSTOM_TIMEZONE
        TEXT HELP
            Boot to Linux Lite
            User:linux , Password:
        ENDTEXT
EOF";
fi
#=========== END ===========

p2-include-url.sh

#
LINUX_LITE=linux_lite
#LINUX_LITE_URL=http://pumath.dl.osdn.jp/linux-lite-3.0-32bit.iso
LINUX_LITE_URL=
LINUX_LITE_SRC_ISO=/media/pi/3032-6134         <<== tried both ways
#LINUX_LITE_SRC_ISO=/media/pi/3032-6134/      <<==
LINUX_LITE_FILE_ISO=linux-lite-3.8-32bit.iso
#

p2-include-var.sh

CUSTOM_LANG=en
CUSTOM_LANG_LONG=en_EN
CUSTOM_LANG_UPPER=EN
CUSTOM_LANG_WRITTEN=English
CUSTOM_LANG_EXT=us-english-nodeadkeys
CUSTOM_TIMEZONE=US/central
RPI_SN0=81c915c7
INTERFACE_ETH0=eth0

/dev/sda1 on /media/pi/3032-6134 type vfat .....

pi@raspberrypi:~/PXE $ ls -l /media/pi/3032-6134
total 2626080
-rw-r--r-- 1 pi pi     138145 Mar  8 14:39 bhodi.iso
-rw-r--r-- 1 pi pi          0 Mar  8 14:46 bhodi.url
-rw-r--r-- 1 pi pi  165675008 Mar  5 10:52 geexbox-3.1-i386.iso
-rw-r--r-- 1 pi pi          0 Mar  8 13:46 geexbox-3.1-i386.url
drwxr-xr-x 2 pi pi      32768 Feb 26 09:26 iso
-rw-r--r-- 1 pi pi 1091567616 Mar  5 11:05 linux-lite-3.8-32bit.iso
-rw-r--r-- 1 pi pi          0 Mar  8 13:46 linux-lite-3.8-32bit.url

This is what I get with: LINUX_LITE_SRC_ISO=/media/pi/3032-6134

handle_iso(win-pe-x86)
handle_iso(linux_lite)
handle_kernel(arch-netboot-x64)
handle_pxe()

This is what I get with: LINUX_LITE_SRC_ISO=/media/pi/3032-6134/

handle_iso(linux_lite)
    download iso image
/media/pi/3032-6134/: Scheme missing.
    create nfs folder
beta-tester commented 5 years ago

first, that handle_iso $LINUX_LITE $LINUX_LITE_URL $LINUX_LITE_SRC_ISO $LINUX_LITE_FILE_ISO; is not making sense, unless you did modified the handle_iso() { ... } part in the ...pass2.sh file to that specific purpose. maybe those extra $LINUX_LITE_SRC_ISO $LINUX_LITE_FILE_ISO parameters you added were added to the /etc/fstab file, what may cause that error message. the fstab entry should look like: /srv/iso/linux_lite.iso /srv/nfs/linux_lite auto ro,nofail,auto,loop 0 10

if the /etc/fstab entry for the iso is already wrong, then everything behind is not working... no NFS for that iso, nor TFTP, nor HTTP, not SMB and no menu entry will be generated, because it can't see the content of the iso and the expected files.

the .iso and .url file MUST be at $SRC_ISO or at $DST_ISO location with the correct nameing according the given $LINUX_LITE variable (in your case linux_lite.iso and linux_lite.url). otherwise the script screws up. (when at $SRC_ISO, then it will be copied to $DST_ISO. $DST_ISO is the final destination, where everything relies on. try SRC_ISO=/media/pi/3032-6134/ to make /media/pi/3032-6134/ as source for all ISO files.)

second, did you tried just to use the "normal" way with downloading the iso from the url? (this is the url that worked for me to download with wget)

p2-include-url.sh:

LINUX_LITE=linux_lite
LINUX_LITE_URL=https://downloads.sourceforge.net/project/linuxlite/3.8/linux-lite-3.8-32bit.iso

BODHI=bodhi
BODHI_URL=https://downloads.sourceforge.net/project/bodhilinux/5.0.0/bodhi-5.0.0-legacy.iso

GEEXBOX=geexbox
GEEXBOX_URL=https://www.geexbox.org/download/12493/

p2-include-menu.sh:

#========== BEGIN ==========
if [ -f "$FILE_MENU" ] \
&& [ -f "$DST_NFS_ETH0/$LINUX_LITE/casper/vmlinuz" ]; then
    echo  -e "\e[36m    add $LINUX_LITE\e[0m";
    sudo sh -c "cat << EOF  >> $FILE_MENU
    ########################################
    LABEL $LINUX_LITE
        MENU LABEL Linux Lite (32bit)
        KERNEL $FILE_BASE$NFS_ETH0/$LINUX_LITE/casper/vmlinuz
        INITRD $FILE_BASE$NFS_ETH0/$LINUX_LITE/casper/initrd.gz
        APPEND nfsroot=$IP_ETH0:$DST_NFS_ETH0/$LINUX_LITE ro netboot=nfs file=/cdrom/preseed/custom.seed boot=casper --
        TEXT HELP
            Boot to Linux Lite x86 Live
            User: linux
        ENDTEXT
EOF";
fi
#=========== END ===========

# missing stuff for $BODHI. add your menu here

# missing stuff for $GEEXBOX, add your menu here

p2-include-var.sh:

SRC_ISO=/media/pi/3032-6134/

p2-include-handle.sh:

handle_iso $LINUX_LITE  $LINUX_LITE_URL;

handle_iso $BODHI  $BODHI_URL;
handle_iso $GEEXBOX  $GEEXBOX_URL;