Wednesday, 10 August 2016

Linux Kiosk computer with Chrome Browser [3]

So having built our image and got it going pretty much as we please, the next thing you will want is to be able to clone from one computer to another.

The default Linux install can be a single partition for the OS. and a swap partition. Since the OS is all in one partition, you can just copy that partition to each computer you want to install on. The main issue is that you aren't copying the Master Boot Record, so the computer won't just be able to boot directly after installing the partition. You also need to create a swap partition.

After looking at a few different tools that I could use to do the cloning, for a manual clone in which I copy the OS partition, set up a swap partition and set up the bootloader, the Gparted Live CD is the one to go for in this case. Gparted is a partitioning tool, but you can also use it to copy partitions between disks. You can write the iso image they supply to a pen drive and boot from that pen drive, then you can copy the partition from your source machine to another pen drive. Then using the same two pen drives, you can restore the image to another machine.

The two additional things you need to do, which can be done from the same Gparted live CD session:
  • Create a swap partition. Make sure you turn swapon in the right click menu for this partition after creating it. I used 1-2 GB as a swap partition (my computers generally have 256 MB of RAM)
  • Reinstall the boot loader (GRUB). The steps for this are as follows
    • Find out in the Gparted main window where the bootable (OS) partition you copied to the disk is e.g. /dev/sda1
    • Go back to the main menu of the Gparted live CD and select Terminal
    • Type in the following commands:
    • sudo mount /dev/sda1 /mnt
    • sudo mount --bind /dev /mnt/dev
    • sudo mount --bind /proc /mnt/proc
    • sudo mount --bind /sys /mnt/sys
    • sudo chroot /mnt
    • grub-install /dev/sda
  • Then reboot and away you go.

I guess the Grub install steps could be scripted.

The one thing possibly I may do with these computers is to test Ofris (a deep freeze tool) to see if they can be made completely bombproof. And I have made a simple website that will come up as the default in the web browser when you start them up. So there we have it, they just have to be good for 3 months of use. 

For remote maintenance you can just use SSH to log into them and check anything or maintain anything on them.

The last issue that I needed to resolve when  cloning was to address that the clones would have the network card coming up as eth1 instead of eth0, and as the settings which enable the network card would refer to eth0, which didn't exist in the computer, it would have no networking. With the help of the Ubuntu community I discovered that a file called /etc/udev/rules.d/70-persistent-net.rules will contain an entry that effectively locks the network card (eth0) to the MAC address of the original machine. The entries relating to this should be deleted before cloning the computer, but they are regenerated each time the computer boots, so you have to be sure that when you do your clone you have removed them before booting to the clone environment, or else directly edit this file on the source partition while in your cloning environment.