Install custom system image from network server

I have a bootable image (ISO) of an Ubuntu system, but it is not an installer in itself.

I'd like to be able to instruct a system to copy the ISO over the network and effectively dd it to internal storage (overwriting anything previously stored there), and then reboot to its local copy.

(I don't want to simply boot from the image over the network.)

What would I need to set up to achieve this? What would need to already be installed on the target system, e.g., GRUB?

My use case is that I'm developing an embedded system and am regenerating these images routinely. I want to be able to easily flash the onboard storage whenever I have a new version of my software. There is nothing that needs to persist.

I'm looking for something fairly turn-key. I don't need a complicated menu of bootable recovery images. Something I can deploy to a local server as a Docker container would be fantastic.

2

3 Answers

Quite sure others can come up with something more elegant but...

-Boot the target system into a ubuntu live cd/usb.
-Assigned an IP address.
-Identify the target drive ex) /dev/sdg
-I believe you need to create a root password on the live system.

On the source machine:
(ensure ssh is installed in the live system)
sudo dd if=/home/source.iso bs=4M status=progress | ssh root@liveCDUSB_IPaddress "dd of=/dev/sdg bs=4M"

Or in the other direction (where adding a root password on the live system would not be necessary)
Instead on the live system pull the iso over from the source
sudo ssh user@source_ipaddress "dd if=/home/source.iso bs=4M" | dd of=/dev/sdg bs=4M status=progress

suggest testing with a small file to ensure all the verbiage is correct first...

4

PXE is your solution since the device is on the network permanently (implied from your responses) sorry can't comment as reputation insufficient until voted...

As other commenters pointed out I should look at PXE booting. I wrote my own project to provide a PXE boot service on my network, and then figured out how to build iPXE, a UEFI bootloader that can run a custom script on boot, which could for instance boot an ISO file over the network, or start up Linux with dd as pid 1, etc.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like