LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-15-2017, 09:57 PM   #1
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Rep: Reputation: 54
Is there a universal way of booting linux distros and linux based OSes via pxe?


It seems every distro has it's own set of instructions on how to set it up and some are totally different from each other. For gparted you copy a few files to places, add the menu entry, copy a squashfs file to a HTTP server and so on. I got this part to work. That seems to be the easiest one.

For Mint, you need to do a whole bunch of other stuff, and instead of HTTP, it's NFS, and you have to copy the contents of the entire ISO instead of a single file.

Reading on other distros and they all seem to have their own way of doing it.

Basically I'm setting up a PXE server with a menu and I want to be able to pick various utilities and boot them.

Rather than having to follow individual instructions is there a more standardized way that will work with all distros without every one being a "one of"?

I already have the pxe server environment setup, and a boot menu, and gparted works. But I want to add more entries in the menu too. For Mint I got to the point of having the splash screen but then it just locks up half way through booting.
 
Old 06-16-2017, 07:06 AM   #2
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
I really like PXE and have, in the past, spent a lot of time working with it.

The basic idea I've come down to is, you look at isolinux boot options and work out what needs to be done to get things to boot with pxelinux. Isolinux and pxelinux come from the same guy/source, so it's not impossible to work these things out.

What you seem to be talking about is how to deliver the boot image once the tftpboot server starts delivering files.

AFAIK, there are several ways to deliver a boot image, TFTP or HTTP or FTP or even over Samba.

Once the boot image has been loaded, you boot. Then, you need to connect to the rest of the root filesystem and finally, once everything is loaded and running, you need to connect to your user filesystem and start working.

There are, of course (since this is Linux) several ways of doing this. It can get disgustingly complex in a short space of time. I've got several "recipes" developed over the years to do this.

How much time do you have?

So, the basic idea is

1. your PC boots off the network card, which searches for a DHCP server and gets an IP address
2. DHCP says "Hey, your IP address stanza says that your PC has to load TFTP to get a boot image"
3. TFTP delivers a boot image to the PC
4. PC loads the boot image, which can include a menu with more boot options, one of which may be Mint
5. Kernel boots, looking for initial ramdisk and gets to the point of looking for its filesystem
6. Filesystem is supplied by one of several methods, basically anything that supports providing a filesystem over a network and I mean ANYTHING. Which is where your complexity is probably coming from.

You can boot over PXE and then load your filesystem from a floppy, a CD, A DVD, a hard drive or over the network using any blessed protocol that supports file sharing including NFS, HTTP, FTP, Samba and probably a few that I haven't tried.

Some old notes on Mint specifically from my wiki
Quote:
I mounted the Mint iso.

mount -o loop ~rhamel/iso/linuxmint-9-gnome-cd-i386.iso /tftpboot/mint/x

I copied the pxelinux bits from my /tftpboot/slackware folder (see Slackware install DVD on using PXE to install Slackware) into /tftpboot/mint folder.

I copied the isolinux.cfg from the iso into /tftpboot/mint/pxelinux.cfg/default. Then, I edited it to add this stanza which was the most important thing.

The key to this install is the line in pxelinux.cfg/default which invokes the kernel. I tried several combinations but the following is the one which worked for me.
Code:
label rhs
kernel x/casper/vmlinuz
append ip=192.168.0.10:192.168.0.5 nfsroot=192.168.0.5:/tftpboot/mint/x ramdisk_size=1048576 initrd=x/casper/initrd.lz boot=casper netboot=nfs
Had to copy some other bits as well.
Code:
cp x/isolinux/vesamenu.c32 x/isolinux/splash.jpg x/isolinux/boot.cat /tftpboot/mint
Oh, and I edited /etc/dhcpd.conf on my server to point to /tftpboot/mint/pxelinux.0 and re-started dhcpd there.

This configuration REQUIRES nfs to be installed and running.

http://wiki.contribs.org/NFS

/etc/exports on NFS server
Code:
/home/e-smith/files    192.168.0.*(rw,sync,no_wdelay,nohide,no_root_squash)
/tftpboot/mint/x    *(rw,sync,no_wdelay,nohide,no_root_squash,no_subtree_check)
/tftpboot/peppermint/x    *(rw,sync,no_wdelay,nohide,no_root_squash,no_subtree_check)
 
1 members found this post helpful.
Old 06-16-2017, 07:46 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Is there a universal way of doing anything under Linux ?. Choice is generally seen as an attribute.
The few times I've used PXE, I've had to set it up in-toto. Didn't think it unusual.
 
Old 06-16-2017, 09:47 AM   #4
dave@burn-it.co.uk
Member
 
Registered: Sep 2011
Distribution: Puppy
Posts: 601

Rep: Reputation: 172Reputation: 172
Here's one??

Follow the insructions on the install media!!
 
Old 06-16-2017, 01:49 PM   #5
Red Squirrel
Senior Member
 
Registered: Dec 2003
Distribution: Mint 20.1 on workstation, Debian 11 on servers
Posts: 1,336

Original Poster
Rep: Reputation: 54
Quote:
Originally Posted by dave@burn-it.co.uk View Post
Here's one??

Follow the insructions on the install media!!
That's what I've been doing but problem with that is one set of instructions from one distro will be so different from another one that I can't get them to work properly together as they want you to do it a completely different way. I need a more universal way of doing it so that I can simply add a new menu entry and have it be an option. Idealy I also want to use only one protocol for the second image (http - the initial boot one always will use tftp that's fine), some instructions say to use NFS, some say to use HTTP etc and they only show one way of doing it.

So what I'm asking is if there is a more universal way.

This is what I got so far in testing:



Gparted option works, mint starts to load then craps out. (just freezes half way through loading)

My tftpboot/pxelinux.cfg/default file is as follows:

Code:
default menu.c32
prompt 0
timeout 0
ONTIMEOUT local

MENU TITLE PXE Menu



LABEL Mint18cin
        MENU LABEL Linux Mint 18 Cinnamon
        kernel bootdata/mint/18cin/vmlinuz
        append initrd=bootdata/mint/18cin/initrd.lz root=/dev/nfs boot=casper netboot=nfs nfsroot=10.8.8.5/localdata/www/pxedata/mint/18cin quiet splash



LABEL GPARTED_0.28.1-1-i686
            MENU LABEL GParted Live (0.28.1-1-i686)
            kernel bootdata/gparted/vmlinuz
            append initrd=bootdata/gparted/initrd.img boot=live config components union=overlay username=user noswap noeject ip= vga=788 fetch=http://10.8.8.5/pxedata/gparted/0.28.1-1-i686/filesystem.squashfs

Some of those options are probably wrong, as I was messing around with it until I could get it to work.

The entire ISO has been copied to the 18cin folder specified (I mounted the ISO, then copied all the files). Gparted on the other hand was easy, they gave me the code for the menu entry and told me to just take a few specific files such as the squashfs file and put it somewhere and link to it. Is that method something that might work for any distro? What if the distro does not ship with a squashfs file?


Basically my goal is to have a couple distros and utilities on there so I can boot off them without needing any CDs. My original idea was to have a menu with a huge ISO repository but that does not seem easy at all to do. So I'm looking for perhaps a set of instructions that will work for any or at least most distros, rather than having to "relearn" it each time since they all do it differently. I also want to avoid having to run NFS as it's just an extra attack surface on that machine. This is going to be running on an untrusted vlan. tftp is probably really my biggest threat though... I really need to find more documentation on that, it seems to be fairly undocumented. Just need to make sure that it's read only at very least.

Last edited by Red Squirrel; 06-16-2017 at 01:53 PM.
 
Old 06-16-2017, 02:17 PM   #6
dave@burn-it.co.uk
Member
 
Registered: Sep 2011
Distribution: Puppy
Posts: 601

Rep: Reputation: 172Reputation: 172
The problem is that you have two "problems" not one.
Each and every distribution will need to be installed in its own way, preferably in its own partition.
Then you want just one boot selection menu for all of them.
I suggest you use a partition manager to allow each install to see just one partition (and possibly a common work partition)
and not allow them to create grub entries.
Then you can unhide the all the partitions and install GRUB4DOS to create the menu selection.

There are other ways that will allow many OSs, but they involve knowledge of powerful partition tools and are not easily explained on a forum.
 
Old 06-16-2017, 03:18 PM   #7
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
There is no standard way. I don't believe that two web articles are exactly the same.


A distro needs to be pxe supported. I remember playing with gparted or some distro like that and I had to rebuild it.

Don't forget to look at gpxe/ipxe.

I think the most easy for me was to use Knoppix terminal server. A few clicks and you are running a pxe server. Also in there you can use (I forget name) remote desktop.
 
Old 06-17-2017, 03:26 AM   #8
rhamel
Member
 
Registered: Sep 2009
Location: Caribbean
Distribution: Slackware 15.0, Proxmox 7.4-17, FreeBSD 13.2
Posts: 70

Rep: Reputation: Disabled
The point of squashfs is to compress files. Once it is loaded, it behaves like any other filesystem, AFAIK.

You can do what you want. It just takes work. At one time, I had a boot menu that worked exactly like you are describing. It booted about 6 different distros including one that connected via rdesktop to a Windows server in the office at work.

The thing is that different distros package their files differently. So, if you want one standard way of writing the menu options for the boot menu, you need to get real familiar with how to "un-roll" the isos (I'm assuming you're downloading iso files from each distro) and organise the files using which ever method you choose of delivering them to the boot loaded kernel.

Also, each distro will have a kernel set up differently. They may leave things out, add things in, generally do it any old way they want. So, your kernel boot options (the APPEND command line) may require different options.

So, prepare to get very familiar with setting up initrd files as well.

I would say, "work on one distro at a time". Get that distro to boot off PXE, understand the parameters it needs and then try to merge it into your boot menu.

I do remember getting Linux Mint, CrunchBang, Clonezilla, Slax and Thinstation to boot of my PXE menu.

There is also the Fog Project which is a way of managing machines based on PXE (as far as I recall). You might want to look at that. They basically create boot images and deliver them on demand over PXE. Really advanced stuff. Far ahead of "roll your own' solutions. Those guys have thought deeply about maximizing the use of PXE/gPXE to manage PCs/servers.

https://github.com/FOGProject/fogproject
https://fogproject.org/

My basic technique was to set up a folder for each distro, mount the iso on the folder, duplicate the isolinux command line in a pxelinux cfg file, get it working off DHCP/PXE with NFS/HTTP/ whatever and add that to my boot menu.

I would use a VirtualBox VM as the boot PC to test the options. Slowly, slowly, I'd get the thing to work, then add another option to my boot menu.

But definitely check out the Fog Project. Worth a look even if you don't use it.

As for why people use either NFS or HTTP/S, NFS is easier to set up, IMO but HTTP/S provides the possibility of booting from a server over the internet, on a different subnet, etc, and having the image coming across the wire in a secure fashion. I'm not sure but I think TFTP does not work across different subnets. Could be wrong on that point.

I did do one installation one memorable afternoon, which booted Slackware off a hard drive on one PC in a lab and delivered a bootable image to all the other PCs in the lab from that one machine. The bootable image then connected via rdesktop to a Windows server in the capital. Then, I cloned that hard drive onto 3 more coz the client had 4 similar labs in different parts of the country.

Slackware, BTW, comes with detailed instructions on setting up PXE on the install DVD and also http://slackware.uk/slackware/slackw...README_PXE.TXT. Pretty detailed explanation of everything you need to know to get PXE working in a general sense.

Knoppix, in the amazingly efficient way that Germans seem to produce software, comes with a PXE server already set up and ready to go off the live boot CD. You can unroll their options as well for more insight.

Another useful distro you might want to look at is Thinstation. This has REALLY evolved over the years. Nowadays, you can download an environment that basically "compiles" your own distro, either stripped down to the bare basics or as fully loaded as you want. Thinstation allows you to tailor the boot image to the characteristics of the hardware you are booting from, eg specific NICs, video card, video resolution, modules to be loaded into the initrd, services to be set up and run from the PXE image, etc. Lots of fun and sometimes time consuming to get right. But, it's all an education, right?

It might also be worth your while to read up on this website http://www.syslinux.org/wiki/index.p...slinux_Project

Syslinux, and its brothers, basically cover the entire range of options available for booting Linux (and other OSes). You'd end up here eventually anyhow. They've got screenshots http://www.syslinux.org/wiki/index.p...le=Screenshots of menus, etc. All the detail you want.

I've also found it useful to look at multiboot USB solutions.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Booting Linux .iso from PXE mihah Linux - General 5 10-20-2011 01:41 AM
LXer: Network booting with Linux - PXE LXer Syndicated Linux News 0 10-05-2011 05:50 AM
Swap on Linux-based PXE image cccc Linux - Networking 3 07-29-2011 07:55 PM
LXer: Dell: Chrome is one of many Linux-based OSes LXer Syndicated Linux News 0 07-17-2009 05:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration