0

I have a situation similar to Oli's Question.

What I have are small Ubuntu hosts that perform like kiosks and they need a complete rebuild. The technician will attach a USB keyboard and USB stick. They will boot the USB stick, a task they've done before, and then four tasks will happen.

  1. A few files from the local SSD will be saved to the USB. Can this simply be a different partition on the USB, mounted rw?
  2. The local drive will be completely overwritten with a new image.

    dd if=generic-image of=local-SSD bs=1M

  3. Restore the saved files.

  4. Reboot. The BIOS/uEFI boot order lists the local SSD first, so it won't boot from the USB.

The kiosks only have one 32 GB SSD, so my image will be around 32 GB in size. Boot order lists the local SSD first. If these devices are connected to a network, it can be unreliable, so Internet downloads aren't an option.

I can make a bootable USB, but where do I go from there? Modify some GRUB line to run a special script? (This seems simplest, but how?) Modify some systemd service to run once? (How?) Force Anaconda to use a simple ks.cfg that only uses %pre and %post without any %package? (How would I setup Anaconda? I've done kickstart files before, but never with no %package section.)

In the MS-DOS days, I'd have a bootable floppy disk and modify autoexec.bat to do tasks 1, 2, and 3. This can't be that hard with all the Linux tools at my disposal.

1 Answer 1

0

A few files from the local SSD will be saved to the USB. Can this simply be a different partition on the USB, mounted rw?

All drives are mount rw by default

You can write a script to do the work, but you need something to kick the script off.

If sda is the USB (mounted as root) sdb is the local drive

rem Make folder to mount the kiosks to
mkdir /kiosks
mount the hdd of the kiosks to said folder
mount /dev/sdb1 /kiosks
save off any files to the save folder on the USB stick
cp /kiosks/save/whatever/* /save
unmount the hdd because were going to image it
umount /kiosks
image the kiosks
dd if=/generic-image of=/dev/sdb bs=1M
remount the kiosks
mount /dev/sdb1 /kiosks
copy the files back
cp /save/* /kiosks
unmount the kiosks again
umount /kiosks
reboot
shutdown -r now
2
  • Yeah, it's the "something to kick the script off" that I'm looking for.
    – iAmJeff
    Aug 30, 2019 at 1:17
  • 1
    Using systemd you can create a fake service which autostarts. In this folder /etc/systemd/system
    – cybernard
    Aug 30, 2019 at 1:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .