reboot a running linux in pxe with kexec
-
No, I am not rebooting the client if using kexec, just replacing the current kernel with the kernel from the fog server.
It looks like a reboot, but it is not a reboot -
The kernel that’s loaded to with the client is from the FOG Server, is there another kernel you’re referring to?
Can you show a layout and possible flow chart depicting what you’re describing?
-
@Tom-Elliott Basically, I think he wants to configure/change a running machine so that next time it boots, it boots to the network (I assume to access a Linux install ISO)… because he can’t get to it to press the F-whatever key to make it boot from network.
@pga I am assuming you have SSH access?
-
@Wayne-Workman yes I have root ssh access. And you have expressed my request much better than me, thanks a lot.
-
@pga I don’t think you could reinstall from scratch using an ISO… if you SSH’d into a fog host that has network booted, you’d simply get a bash prompt, and not the advanced iPXE menus that you want.
If possible, you’d need to just build an image for the box before hand and then image it with that.
To get it to network boot, you’d have to set up chain loading to the network on the HDD… and that’s going to be interesting to see… and I have no idea how to do it.
Why can’t you go to the machine?
-
You have to remember, when linux loads it boots to an OS layer through a portion, essentially, that tells it how to use the root filesystem, or the initrd=init.xz argument as you described.
The problem is, you’re not loading the system when you’re using kexec. All you’re loading is a new kernel, not a new OS layer. I’m pretty sure you would not be able to do this as you’re thinking.
-
@Wayne-Workman I can go to a single machine, but not 200 of them in a reasonable time
-
can you not set these machines to boot to the network by default?
-
@Junkhacker not every bios supports pxe unfortunately.
I am currently trying with grub and booting to ipxe, I’ll see what result it gives me.
-
you can also use the ipxe boot cd iso (downloadable from the ipxe website) to boot to pxe from a cd
-
@Junkhacker that is equivalent to the grub + ipxe solution I think, and I don’t have to insert a CD in all my machines at least
My absolute restriction is that I don’t have a physical access to each machine, only a root ssh access.Or maybe you know a way to directly reboot to an iso located on a hard drive ?
-
@pga i do, but it would be more efficient to use grub to boot directly to the ipxe network boot file you want to use
-
Ok, it is quite simple with grub.
For instance, with a debian jessie:
- install ipxe with grub
apt-get install ipxe
- Set the next grub boot to use the ipxe menu
grub-reboot 2
- Reboot !
reboot
The number to use is the number of the grub entry (counting the submenu) of the pxe entry, starting from 0.
Thank you for your help, I hope the result could help someone in the future.