Koozali.org: home of the SME Server

Booting a Windows ISO via PXE

Offline Drifting

  • ****
  • 431
  • +0/-0
Booting a Windows ISO via PXE
« on: March 14, 2022, 05:20:56 PM »
Hi one and all.
Just idly thinking it would be handy to have an image of windows that can be used to restore a windows machine, managed to achive this but with Windows RDS, but that was under a trial. And there is no way I am paying those sort of prices for something I would (Hopefully) only use once in a blue moon at home.
Did look at TFTP as I have that to configure my voip phones round then house. Just wondered if the Thin Client contrib may do the other part for me?

Thanks

Paul..
Infamy, Infamy, they all have it in for me!

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Booting a Windows ISO via PXE
« Reply #1 on: March 14, 2022, 06:46:19 PM »
Used tftp on my voip phones for years, plus PXE emergency boot disks etc.

Just need to understand the inner workings :-)

I'll try & add some sample configs this week.

I think thinclient just adds some server manager options to tftp but I need to check.

Whether you can restore a Windows image direct I'm not sure, but you can probably PXE boot clonezilla.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Drifting

  • ****
  • 431
  • +0/-0
Re: Booting a Windows ISO via PXE
« Reply #2 on: March 15, 2022, 10:40:06 AM »
That would be really useful.
Created the image with the MS MDT kit, and as I say, works fine under windows. Have an initial boot image (LiteTouch WinPE) that then looks to an SMB share for the rest of the install files.
As you rightly assume, no a clue when it comes to PXE on linux.

The part that confused me is the image name in the tftp directory? I just put the boot iso name, win.iso assume I was completely wrong?

Paul.
« Last Edit: March 15, 2022, 10:42:38 AM by Drifting »
Infamy, Infamy, they all have it in for me!

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Booting a Windows ISO via PXE
« Reply #3 on: March 15, 2022, 10:55:45 AM »
Image names can be whatever you like - you just have to reference them correctly from the client, and assume the client knows how to deal with it.

Worth while creating a test file in the /tftp directory and then get a plain tftp client and practice trying to get a test file.

Remember it is essentially a VERY basic ftp client.

Essentially it look like you need this.

https://docs.microsoft.com/en-us/windows/deployment/configure-a-pxe-server-to-load-windows-pe

You use a tftp directory as

/tftp/Boot

(it shows you how to build them into y:\Boot - you can do that and then copy them to your tftp directory /tftp/Boot )

Windows is pretty ugly to PXE boot, and I never tried it as I don't use it.

Gives a nice PXE boot summary there too.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Booting a Windows ISO via PXE
« Reply #4 on: March 15, 2022, 06:42:11 PM »
I've updated notes on PXE booting in general.

You should be able to work from there.

It might be that if you are JUST booting Win PE you can use the thinclient contrib, but if you want more flexibility then use tftp server.

Note there is a bug open on using UEFI. If I ever get a minute I might try and fix it.
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Drifting

  • ****
  • 431
  • +0/-0
Re: Booting a Windows ISO via PXE
« Reply #5 on: March 16, 2022, 10:55:12 AM »
I've updated notes on PXE booting in general.

Erm, ok, and where are they exactly? :-)

Will have a read and go off an tinker. Thank you for the help, appreciated.

Paul.
Infamy, Infamy, they all have it in for me!

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Booting a Windows ISO via PXE
« Reply #6 on: March 16, 2022, 11:29:15 AM »
Where they normally are - wiki :-)

https://wiki.koozali.org/Tftp_server

Please let me know how you get along - I presume you have wiki editing rights so you can test and correct some of that and add your Windows notes for others?

I may try and look at the UEFI situation too at some point but need testers for it. This bug refers:

http://bugs.contribs.org/show_bug.cgi?id=10821
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Drifting

  • ****
  • 431
  • +0/-0
Re: Booting a Windows ISO via PXE
« Reply #7 on: March 16, 2022, 02:53:18 PM »
Hi
I am relaly having difficulty understanding a few points. First, if I use the thinclient iso, and set it as default, should that not boot? Or do I have to go through adding all the syslinux? And again, as my knowledge is vary sparse, the part that I do not understand is the following :-and any kernel or initrd images that you want to boot. [5.00+] Might just as well said that in upper Mongolian!
However I did copy of the "pxelinux.0" and create the cfg folder. After much searching on the downloaded syslinux. Also did not find "will need this from the syslinux ISO:

/tftpboot/com32/vesamenu.c32 "

I know its me, sorry need more hand holding, old, half blind, but not a linux guru, but a failry proficeint dabbler. :-)

Thanks

Paul.
Infamy, Infamy, they all have it in for me!

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Booting a Windows ISO via PXE
« Reply #8 on: March 16, 2022, 06:50:32 PM »
No, just 'loading' an iso will not work. It is much more complex than that and you really need to educate yourself on OS boot processes. There is truck loads on the interwebs. There is no shortcut to reading a lot.

Any system actually extracts the information from the ISO and runs it. it doesn't just 'load an iso'.

I suggest you start with the basic tftpserver contrib so you really understand what is happening, start with a text file and use a tftp client to get it, and then set up a simple linux system to boot. I have amended the wiki a little - you need to extract the correct files from the chosen distro ISO into the correct directories as per the config files. There is no shortcut to understanding this stuff.

Remember The contrib has set up your basic PXE environment with DHCP etc. You need to organise the configuration menus and the boot files.

The boot loader has to be smart enough to be able to load a kernel and other stuff over a network connection. Some of it can directly via tftp. Some of it has to be over say nfs. See the various configs that I pasted for examples.

For a linux boot you need syslinux with the pxelinux loader (or a.n.other network system eg gpxe)

For a lot of distros you will need NFS support - I have added a few notes on the wiki. Have a look at say Clonezilla for testing as it need no NFS. Rough guide from vague memory as follows:

Get the syslinux zip or tar.gz and copy these to the right places in /tftpboot

Copy the c32 files to /tftpboot/com32

bios\com32\elflink\ldlinux.c32
bios\com32\libutil\libutil.c32
bios\com32\modules\linux.c32
bios\com32\menu\menu.c32

I actually put memdisk in /tftpboot/images

bios\memdisk\memdisk

I put pxelinux.0 in the /tftpboot directory

bios\core\pxelinux.0

Get the Clonezilla ISO.

Open the Clonezilla ISO and extract vmlinuz, initrd.img and filesystem.squashfs from /live to /tftpboot/images/clonezilla

(you can see the syslinux dir it uses to boot on the ISO - have look in /syslinux/syslinux.cfg for more)

Make a pxelinux.cfg directory

Create a file called /tftpboot/pxelinux.cfg/default containing this and setting your server IP:

Code: [Select]
UI menu.c32
MENU TITLE Network Boot
TIMEOUT    50
default com32/vesamenu.c32

LABEL CloneZilla
    MENU LABEL CloneZilla
    KERNEL images/clonezilla/vmlinuz
    APPEND initrd=images/clonezilla/initrd.img boot=live config noswap nolocales edd=on nomodeset ocs_live_run="ocs-live-general" ocs_live_extra_param="" ocs_live_keymap="" ocs_live_batch="no" ocs_lang="" vga=788 nosplash noprompt fetch=tftp://YourServeriP/images/clonezilla/filesystem.squashfs

Checks logs to make sure first the client gets an IP and then that it requests and servers the correct files. This is all pretty low level so there is not a lot of logging. Check /var/log/messages & /var/log/tftpd/current (or journactl)

Once you have got a basic linux system to boot then think about tackling Windows.

You will really need to go and read the Microsoft page first and really understand it.

https://docs.microsoft.com/en-us/windows/deployment/configure-a-pxe-server-to-load-windows-pe#pxe-boot-process-summary

For Windows you can ignore the pxelinux stuff because.... it is for linux booting. You can see the Windows boot process above.

They talk about mapping the tftp boot directory to a local drive but don't do that.

Put all the correct files into a directory such as C:\local_dir\tftpboot_tmp and then SCP the lot to /tftpboot on the server.


...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Drifting

  • ****
  • 431
  • +0/-0
Re: Booting a Windows ISO via PXE
« Reply #9 on: March 17, 2022, 03:50:42 PM »
No, just 'loading' an iso will not work. It is much more complex than that and you really need to educate yourself on OS boot processes. There is truck loads on the interwebs. There is no shortcut to reading a lot.
There is the problem for me, take me 5 times longer than most as I have quite bad eyes. But thank you for all the write up, I will try and work my way through it. But to be honest, I thought it was going to be simple. That is one this I detest with Linux and its add on's. That you have a complete understanding of life the universe and everything to do what should be a simple task <Grins>

Paul.
Infamy, Infamy, they all have it in for me!

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Booting a Windows ISO via PXE
« Reply #10 on: March 17, 2022, 04:04:44 PM »
There is the problem for me, take me 5 times longer than most as I have quite bad eyes.
But thank you for all the write up, I will try and work my way through it.

Yes it must be very difficult. Work through it a bit at a time. Start with a simple setup. Get that running. It took me a little while to understand it (e.g. understanding the linux boot process, and understanding that an ISO has the boot process built inside it which needs to be extracted into parts for network booting)

Quote
But to be honest, I thought it was going to be simple.

LOL. It is a wise man that has second thoughts first.

It isn't massively difficult - it just needs some understanding.

Quote
That is one this I detest with Linux and its add on's. That you have a complete understanding of life the universe and everything to do what should be a simple task <Grins>

Actually Linux is pretty simple for PXE booting. The tftp server is very basic. Just needs a bit of understanding of other topics.

Some distros can be trickier than others, but generally they are fine. Once you get the idea with with one, the rest follow a pattern.

The Windows boot looks a total nightmare (not impossible, but difficult). But then M$ is not in the business of making things easy for you. There way, or the highway....... That isn't the fault of Linux (and actually, thanks to Linux you can do it at all!!)
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline Drifting

  • ****
  • 431
  • +0/-0
Re: Booting a Windows ISO via PXE
« Reply #11 on: March 31, 2022, 04:57:36 PM »
Well I am getting nowhere fast.

Removed the thinclient contrib, and now back to just tftp-server. However for the life of me it does not seem to be running, and the command in the contrib notes to restart it fails.
Also I have run the following command:- netstat -anp | grep 69 and nothing on port 69 is there? So then tried :-
config setprop tftpd status enabled
signal-event tftpd-conf
And finally:- service tftpd restart came with "tftpd is not a valid service name"
Considering wipeing this machine and trying again. Any ideas?

Paul.
Infamy, Infamy, they all have it in for me!

Offline Jean-Philippe Pialasse

  • *
  • 2,743
  • +11/-0
  • aka Unnilennium
    • http://smeserver.pialasse.com
Re: Booting a Windows ISO via PXE
« Reply #12 on: March 31, 2022, 05:50:29 PM »
sme10?

need to use systemctl not service. 

check your logs

Offline ReetP

  • *
  • 3,722
  • +5/-0
Re: Booting a Windows ISO via PXE
« Reply #13 on: April 04, 2022, 12:15:35 PM »
Hmmm - I think there might be a bug.

Code: [Select]
yum --enablerepo=smecontribs smeserver-tftp-server
config setprop tftpd status enabled
signal-event smeserver-tftp-server-update

We should be able to see this:
Code: [Select]
netstat -tulpn | grep 69udp        0      0 0.0.0.0:69              0.0.0.0:*                           1/systemd

But we can't and the service is dead.

When I run the signal-event I can see this:

Quote
No conf db entry for service tftp

I suspect that is because the config entry is called tftpd and not tftp.

So to get it running you can do this:

Code: [Select]
config set tftp service UDPPort 69 access private directory /tftpboot log normal privilege ro status enabled timeout default user nobody
signal-event smeserver-tftp-server-update
systemctl status tftp


I'll open a bug.

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline ReetP

  • *
  • 3,722
  • +5/-0
...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation