You are not logged in.

#1 2014-09-02 19:25:32

graffitici
Member
Registered: 2014-09-02
Posts: 2

Run command on boot for PXE install

Hi,

I'd like to run a small shell script that will image the disk on a PXE installation. I set up the PXE server, and I can boot into Arch. What I would like to do is to run a custom script right after booting in. What's the right way to do this? I think creating a new systemctl script is probably an overkill?

Thanks!

Offline

#2 2014-09-02 19:48:58

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Run command on boot for PXE install

graffitici wrote:

Hi,

I'd like to run a small shell script that will image the disk on a PXE installation. I set up the PXE server, and I can boot into Arch. What I would like to do is to run a custom script right after booting in. What's the right way to do this? I think creating a new systemctl script is probably an overkill?

Thanks!

Systemd script FTFY. 
You could just enable sshd and do whatever you want remotely. 
Maybe you're wanting a clonezilla?


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#3 2014-09-02 20:14:53

graffitici
Member
Registered: 2014-09-02
Posts: 2

Re: Run command on boot for PXE install

nomorewindows wrote:

You could just enable sshd and do whatever you want remotely. 
Maybe you're wanting a clonezilla?

The reason why I want to automate this is because I need to this on 20 machines. Effectively, all I want is to do something like the following on boot:

curl http://pxeserver/image.iso | dd of=/dev/sda

So that I can pick PXE install at the boot menu, and the computer will automatically be imaged.

I didn't realize CloneZilla also had a PXE environment. I haven't used it at all, but I'll definitely look into it. It still seems easier to run a one-line script as above, if possible

Offline

#4 2014-09-02 23:43:54

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Run command on boot for PXE install

I think clonezilla has multicasting, so you can image multiple machines at once.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#5 2015-02-27 13:02:29

FirefighterBlu3
Member
Registered: 2015-02-27
Posts: 10

Re: Run command on boot for PXE install

@graffitici did you ever find a solution for this?

(clonezilla is not an acceptable answer, it needs to be an automated function runable at boot time)

at present i'm looking at remastering the archlinux ISO and adding a systemd unit file to launch the download and install script :-/

Offline

#6 2016-04-21 15:01:29

stingA0815
Member
From: Löffingen, Germany
Registered: 2016-04-21
Posts: 31

Re: Run command on boot for PXE install

Sorry for bumping this "old" Thread, but that is exactly what I'm looking for.

Have you ever found a solution?

Offline

#7 2016-04-21 16:37:06

stingA0815
Member
From: Löffingen, Germany
Registered: 2016-04-21
Posts: 31

Re: Run command on boot for PXE install

For thoose of interesst, after 2 days of try and fail -> I ended up with my first try/solution.

I've tried using the kernel parameter "script=..." but it didn't run the command on boot. The problem was that I used the archboot image. I thought this param is only SysVinit supported, because it didn't run on the archboot pxe image.

Finally thought I'll give the iso images a try, et voilà it works like a charm.

files:

mount archlinux-2016.04.01-dual.iso /mnt
cp /mnt/arch/boot/i686/archiso.img ${TFTPROOT}/boot/Archlinux-1.0-i386-initrd
cp /mnt/arch/boot/i686/vmlinuz ${TFTPROOT}/boot/Archlinux-1.0-i386-linux

pxe.cfg:

LABEL arch
TEXT HELP
Boot Arch HTTP
ENDTEXT
MENU LABEL Boot Arch HTTP
LINUX boot/Archlinux-1.0-i386-linux
INITRD boot/Archlinux-1.0-i386-initrd
APPEND archisobasedir=arch archiso_http_srv=http://129.143.116.10/pub/Mirrors/archlinux/iso/latest/ script=http://192.168.178.10/unattended/provision
IPAPPEND 3

kind regards

Offline

#8 2016-04-21 16:42:54

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Run command on boot for PXE install

That probably works for an archiso image, but not a permanent pxe install.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#9 2016-04-21 16:54:40

stingA0815
Member
From: Löffingen, Germany
Registered: 2016-04-21
Posts: 31

Re: Run command on boot for PXE install

Sorry for my bad english in advance.
Can't realy follow you.

The "script" param does something like:

curl <url> | bash

the output of

curl <url>

could be

curl http://pxeserver/image.iso | dd of=/dev/sda

Last edited by stingA0815 (2016-04-21 17:07:22)

Offline

#10 2016-04-21 17:54:48

stingA0815
Member
From: Löffingen, Germany
Registered: 2016-04-21
Posts: 31

Re: Run command on boot for PXE install

I think this could be closed and marked as resolved, sorry -> I don't know how.

Last edited by stingA0815 (2016-04-21 18:10:09)

Offline

#11 2016-04-24 14:05:52

nomorewindows
Member
Registered: 2010-04-03
Posts: 3,362

Re: Run command on boot for PXE install

Edit first post and mark solved.


I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.

Offline

#12 2016-04-24 14:13:13

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Run command on boot for PXE install

It's not your thread, it's not really up to you whether it's solved.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB