Results 1 to 5 of 5

Thread: Bootable USB PXE Server

  1. #1
    Junior Member
    Join Date
    Feb 2011
    Posts
    2

    Question Bootable USB PXE Server

    Greetings all. I've searched a lot on have to turn a USB drive into a PXE server and come across a PXE stuff and a lot of USB stuff, but nothing that I need. My apologies for the long message!

    First, the short version.
    I want:
    A bootable USB memory that, with the click of script or automatic start-up, will configure and start the machine it's attached to as a PXE server with a minimum of fuss.
    My problem:
    I haven't succeeded yet and have started hitting my head against the wall.
    My request:
    How can I achieve what I want?

    The long version.
    At work we often boot a Knoppix CD from a USB-CDROM drive on any old system laying around, manually input the Knoppix Terminal Server settings, start it, test our client machine(s), then shut down and pack away the USB-CDROM. We don't want a dedicated PXE server taking up space in our lab.

    I want to forgo the USB-CDROM and constant setup by running a bootable USB memory that can turn pretty much any system into a PXE server. I once installed Ubuntu to USB with persistency but, upon connecting and booting it on a different machine, the network settings became corrupt. I can't remember the specifics, but a new network card was detected and assigned, and the PXE settings that were attached to the previous system's network card were lost.

    By installing Knoppix on USB through Pen Drive Linux's "Universal USB Installer"
    (http://www.pendrivelinux.com/univers...easy-as-1-2-3/ ) I get a read only Knoppix system which won't confuse the last server machine's settings with the current machine's. This is awesome; I don't want any persistency that might corrupt things later down the line.

    However, that still leaves having to manually configure and start the Knoppix Terminal Server (and most workers in my company either don't know how or forget how to do it). I can save anything in the same USB memory without effecting the Knoppix boot, so I'm thinking to store pre-configured files and a scrip there that the co-workers can click and forget about.

    But what files need to be modified?

    To attempt to find which files are modified I booted the system, waited a few minutes, then setup and started the Knoppix Terminal Server. From there I was able to search for the most recently modified files (in the hopes of finding and backing up the files which were automatically configured by the Knoppix Terminal Server). Later I can copy these configured files back into their respective places on a fresh boot. For interest's sake, I ran:

    # find / -mmin -1

    that showed all the changed files within the past minute).

    Here is my script labeled pxe.sh

    #!/bin/bash
    # Copy setup files
    sudo mkdir /tmp/tftpboot
    sudo cp -p -r /mnt-system/pxe/etc/network/* /UNIONFS/etc/network
    sudo cp -p -r /mnt-system/pxe/etc/dhcp3/* /UNIONFS/etc/dhcp3
    sudo cp -p -r /mnt-system/pxe/etc/sysconfig/* /UNIONFS/etc/sysconfig
    sudo cp -p -r /mnt-system/pxe/etc/default/* /UNIONFS/etc/default
    sudo cp -p /mnt-system/pxe/tftpboot/pxelinux.cfg/* /tmp/tftpboot
    sudo cp -p -r /mnt-system/pxe/var/run/* /var/run

    # Starting PXE server...
    sudo /etc/init.d/knoppix-terminalserver start

    As you can see, I've retained the file and folder structure in my copy source (/mnt-system/pxe ) and can copy back to the files' respective places.

    The problem with this is that there were far too many files modified or created by setting and starting the Knoppix Terminal Server for me to sort through to find every file I needed to back up (the above script is a work-in-progress). I guess I didn't back them all up because, after rebooting and executing the script, the Knoppix Terminal Server appeared and it had to be configured; there was no IP address or Gate Way or any other settings preserved.

    Apologies for the essay; I hate to make you read so much. I really want to show I'm not asking for someone to do all the work for me; I have been at this for while now, but with limited success. Any help (a solution to my technique, a better method, a recommendation for something other than
    Knoppix) to get a PXE-ready USB bootable memory would be a-w-e-s-o-m-e.

  2. #2
    Senior Member
    Join Date
    Jan 2011
    Posts
    242

    Sanity Check

    Hello har31n6er, welcome to the Knoppix forums.

    Can we do a quick sanity check here .....

    ... you've Knoppix but you haven't told us which ...

    ... you've installed it to USB using some fancy bit of Windows software from the Pendrive site rather than do it the Knoppix way ...

    ... you're not using a Knoppix persistent store because you had a bad experience with Ubuntu ...

    ... you're doing the terminal server stuff that, well, might well be classed as a minority sport ...

    ... you want to save your configuration for later use so you don't have to set every thing up manually ...

    ... that is you want your configuration to persist but without using persistent storage ...

    ... you're trying to figure out what has changed without using the neat features of the unionfs that make this dead easy ,,,

    ... you've got lost ...

    You've done very well but the prize for the post that is least likely to get a reply still goes to the fella who posted http://www.knoppix.net/forum/threads...ti-Echos-P100D.

    The trick with helping people on support forums (or support in general) is to put yourself in the other guy's boots and see it from his point of view. This is made all the more difficult when the person asking for help has gone off piste somewhere you've never been before.

    You my friend took a left when you got off the lift and are skiing down the wrong side of the mountain.

    Unable to understand where you are coming from, someone may, in desperation tell you what little they do know in the hope that it may help:

    I don't know what colour a PXE is but I learnt last week on this forum that a Leprechaun is a green gnome.
    Not very helpful, I know. The best I can do is:

    I know what you mean. I had a falling out with Ubuntu once. I don't remember the specifics either as it was a long time ago when I knew a lot less than I do know. Anyway, I got over it. Perhaps you should do the same.
    A valid point but, again, not very helpful.

    The helpful point I am trying to make is that if you were to start again and try to do things the Knoppix way then folks on this forum might feel they understand your questions enough to try to answer them.

    So you ready ?

    Go to the Knoppix site (http://www.knoppix.net), not the Pendrive site, to get your Knoppix. I've nothing against Pendrive. I've used it myself. The installer you've used is bang up to date. Two months ago the Pendrive site's Knoppix pages carried age warnings as they were 3 or 4 years out of date.

    Download the CD (iso file). I recommend using bit-torrent. Burn a CD (I know, its a pain but the bootiso= cheat code has been withdrawn). Use the Knoppix install to USB, which you will find under LXDE Main Menu > Preferences > Install KNOPPIX to flash disk.

    Boot the USB stick. The first time around it will ask you if you want to create a persistent store. Create one. If, when you've got everything working, you still don't trust it, then would the time to get rid of it.

    Once the desktop has come up, before you try to do any terminal server stuff, open a terminal console. Type in df -h. You'll get something like this:

    Code:
    knoppix@Microknoppix:~$ df -h 
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/sdb3             6.9G  4.1G  2.5G  63% /mnt-system
    tmpfs                 2.0G     0  2.0G   0% /ramdisk
    /dev/loop0            3.6G  3.6G     0 100% /KNOPPIX
    /dev/loop1           1008M  329M  680M  33% /KNOPPIX-DATA
    unionfs              1008M  329M  680M  33% /UNIONFS
    unionfs              1008M  329M  680M  33% /home
    tmpfs                  10M   56K   10M   1% /UNIONFS/var/run
    tmpfs                  10M     0   10M   0% /UNIONFS/var/lock
    tmpfs                 100M   52K  100M   1% /UNIONFS/var/log
    tmpfs                 2.0G   20K  2.0G   1% /tmp
    udev                   20M  444K   20M   3% /dev
    tmpfs                 2.0G  4.0K  2.0G   1% /dev/shm
    The first entry (/mnt-system) is the file system you booted from (probably /dev/sdb1). The third entry (/KNOPPIX) is the 'read-only' Knoppix system you are running from. The next entry (/KNOPPIX-DATA) is where any files go that you (or Knoppix) add or change as you configure your terminal server. The entry after that is the UNIONFS that superposes KNOPPIX-DATA over KNOPPIX so you get the illusion of one large read/write file system.

    So, no need for the find command. Just look at what's under /KNOPPIX-DATA.

    If you have a look now, before you try configuring your terminal server you'll find that Knoppix has already changed some files under there. All the system configuration files are under /etc. You can ignore changes under /var (which change all the time anyway) and /home.

    You'll find some files changed already under /etc. That's because Knoppix works around the world. If you were Hungarian, you would type:

    Code:
    knoppix lang=hu
    in at the initial boot prompt. The lang=hu is what knoppix calls a cheat code. Knoppix would use this to set the keyboard (and a few other things) up the way a Hungarian would expect them. That's why files in /etc/default, /etc/sysconfig and a few others are changed and changed every time you boot knoppix. These are not relevant to your terminal sever configuration.

    BTW, if you are tempted to try lang=uk as your cheat code (your use of the awful word awesome suggests not), make sure you also use the cheat code xkeyboard=gb.

    Now, if you created a persistent store, then the file /mnt-system/KNOPPIX/knoppix-data.img is the backing store for /KNOPPIX-DATA. If you don't create a persistent store, then the backing store for /KNOPPIX-DATA is /ramdisk, the second entry above and you loose your configuration when you reboot. Try using the persistent store and if that doesn't work, come back with another question. If you, however, want to pass your eyes over the discussion in the thread http://www.knoppix.net/forum/threads...update*.tar.gz.

    On your list of directories is /etc/network, but I notice that the file /etc/resolv.conf isn't. I'm beginning to stray into areas that I don't know so well, and I'll be burnt at the stack in cyber space for suggesting this, but the Network Manger may not be your friend. You find /etc/network/interface is basically empty. Any interface defined in there will not be touched by the Network Manager but the Network Manager will handle any interface that is not defined in there. You'll also find that /etc/resolv.conf is generated by the NetworkManger and not directly by your DHCP client. I seem to remember a PXE server is also the DHCP server for PXE clients so you may need greater control here.

    The final scary bit is udev. This is a Linux thing, so don't go blaming Ubuntu or Knoppix but this may be what shafted you all those years ago.

    When you plug in a USB stick, it is udev that configures it. When you boot a machine, it is also udev that configures the disk and the CD drive and the network. card It is udev that ensures that, if you have two CD drives, one is always /dev/cdrom0 and the other is always /dev/cdrom1 rather than tossing a coin as to which is which.

    Same goes for network cards. You've got one, it will be eth0. Plug in a second, it will be eth1. Remove the first and the second will still be eth1. The same would have if instead of swapping network cards you move your Linux to another machine. I know, I did this. I screwed up the file system on one desktop so I simply copied the file system from the hard drive of another machine, Everything worked fine except the network - I had to run dhclient by hand for months before I figured out what was wrong. You plugging Ubuntu on a USB into different machine is very much the same thing. Nothing was corrupt. It just that udev moves in mysterious ways.

    I've checked my (Debian, from which Knoppix is derived) desktop. The udev files in question are named 70-persistent-cd.rules and 70-persistent-net.rules. If checked my Knoppix. There are no such files so you should be OK. Knoppix Live is designed to be portable. Ubuntu Live is designed to demo Ubuntu before you install to hard drive. There is a world of difference.

    Quote Originally Posted by har31n6er
    Apologies for the essay
    Accepted. Remember KISS: Knoppix Is Simply Superb.

  3. #3
    Junior Member
    Join Date
    Feb 2011
    Posts
    2
    Thanks Forester for your quick reply, and sorry about my slow response.

    I used Knoppix 6.4.4 to create a bootable USB through live-booting the CD as you recommended. Being a side project at work I hadn't had time to do much before the earthquake, tsunami and rolling blackouts came (my keyboard is JP, for your reference) but I had setup the terminal server on one machine, shut down, moved the USB stick to another machine and booted up without any warnings. Obviously simply starting the terminal server didn't work; at that level all I'd done was configure it for a different machine but I wanted to check how easy it was during the next configuration. It turned out all I had to do was again select configure the knoppix terminal server from the menu and click through the pop-up windows without inputting any new values. This worked as the second system to boot the USB stick was then a PXE server working as expected. This is pretty sloppy, and as soon as things calm down I'll try to make a more decent system.

    In the meantime would you have any warnings against simply clicking through the terminal server setup as I have done?

  4. #4
    Senior Member
    Join Date
    Jan 2011
    Posts
    242
    A JP keyboard eh ? I have never seen one of those. You live in interesting times. I hope everyone you know and care about is OK. I can't imagine what it is like. Over here in the land of the setting sun the media have focused so much on Fukushima Daiichi that one gets the impression that is the only problem. Now a new war is turning their attention.

    Anyway, you have the terminal server up and running. Well done. It's kind of like a live tutorial. You go "Wow, how did he do that" and you can actually go and look and then change it the way you want it.

    On the client, df -h shows /mnt-system (and therefore the KNOPPIX cloop) is mounted over NFS from the terminal server. Response might be a bit sluggish but possibly no worse than using a CD or a USB 1.1. There's no KNOPPIX-DATA loop device on the client so there is no persistent data on the client. Is that OK for you ?

    On the server, I did:

    Code:
    dpkg-query -L knoppix-terminalserver
    to find out what extra files KK used to implement his terminal server. There are not very many and most are some part of a miniroot template. There is no extra kernel or anything big like that. It seems just two scripts do it all.

    One is:

    Code:
    /etc/init.d/knoppix-terminalserver
    You should be able to use this to start/stop the terminal server without using the 'expermental' GUI applet. You ought to be able to change /etc/rc.local to start the terminal server automatically for you but there's something you need to check first.

    Make a small change to /etc/rc.local on your terminal server. I suggest adding a comment. Reboot. Have a look at /etc/rc.local on your PXE client. Can you see the change ? I would guess not because the /etc/rc.local you see on the server comes from persistent store on the server and I (hope) the client can't see that. If you wanted to make changes the client would see I think you'd have to remaster and/or alter the miniroot template.

    On the server I had a look at the files under /KNOPPIX-DATA:

    Code:
    find /KNOPPIX-DATA/ -type f
    I counted twenty one files, not all of which are to do with the terminal server. It seems four configuration files are backed up and modified (*-knoppix-terminalserver-orig). Presumably these flip-flip as you start and stop the terminal server. Only two files contain the IP address of the laptop I used for my trials:

    Code:
    /etc/dhcp3/dhcpd.conf
    /etc/sysconfig/knoppix-terminalserver
    I would guess the IP address is the only thing that need change when you move your USB stick to another PC. You should be able to hack these two files in /etc/rc.local before you start the terminal server.

    If you type in:

    Code:
    cat /proc/cmdline
    you can see the 'cheat codes' with which Knoppix was booted. On the client BOOT_IMAGE appears twice. The first is the normal Knoppix one, the second is the normal Linux one. Oops. My understanding is the second one should be used but /boot/vmlinuz is a symbolic link to nowhere because the kernel version has been bumped. The two kernels that are there are the same size but don't have the same check-sum. That's may just be a consequence of them being built on different days but if you get weird kernel crashes get in contact with KK.

    The other odd thing I've noticed so far is my PXE client thinks it is in New York. Very strange.

  5. #5
    Senior Member registered user
    Join Date
    May 2006
    Location
    Columbia, Maryland USA
    Posts
    1,631
    America/New_York is a timezone.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Lenovo IdeaPad S300 13.3” Laptop. 4Gb RAM. 500Gb HDD. Win10 Pro. NEW Battery
$93.0
Lenovo IdeaPad S300 13.3” Laptop. 4Gb RAM. 500Gb HDD. Win10 Pro. NEW Battery pictureLENOVO IDEAPAD S940-14IWL | CORE I7-8565U 1.80GHZ | 512GB | 16GB RAM | NO OS
$19.99
LENOVO IDEAPAD S940-14IWL | CORE I7-8565U 1.80GHZ | 512GB | 16GB RAM | NO OS picture$2k+ Lenovo ThinkPad 7th Gen X1 Carbon i7 16GB RAM 256GB W10 Pro UNDER WARRANTY
$1399.0
$2k+ Lenovo ThinkPad 7th Gen X1 Carbon i7 16GB RAM 256GB W10 Pro UNDER WARRANTY pictureLenovo ThinkPad T420 250GB HDD 4GB RAM Core i5 2520M 2.5GHz WIN10 PRO 1366x768
$210.0
Lenovo ThinkPad T420 250GB HDD 4GB RAM Core i5 2520M 2.5GHz WIN10 PRO 1366x768 pictureLenovo IdeaPad Flex 15 Laptop 15.6" ST7 LCD Cover and Hinges. LCD Cable 90203942
$18.54
Lenovo IdeaPad Flex 15 Laptop 15.6