Here is how I got it to work:
Step 1: Create a new partition. You can use any number of utilities to do this, I used cfdisk since it was available
Step 2: Image that new partition with a live distro that has SSH enabled and default username and password. In my case the old OS was on /dev/sda1 and the new one was on /dev/sda2. The new OS must be able to accept an SSH connection from boot without any prompts, or you will lose contact with your remote computer. It must also have the network properly configured. Either set a proper static IP, subnet mask, gateway, etc; or use DHCP and use your remote router to find the computer's new IP address.
Step 3: Run update-grub to add it to the boot options.
Step 4: View the file /boot/grub/grub.cfg and find the
menuentry for the new OS image. It should look something like this:
menuentry "KUbuntu 16.04 amd64 desktop (live)" --class windows --class os. What you need is the label in the quotes, in this case:
KUbuntu 16.04 amd64 destop (live)
Step 5: Open /etc/default/grub in any editor and look for
GRUB_DEFAULT=. Make sure it is set to
Step 6: Run grub-reboot followed by your chosen menu entry in quotes. In this case grub-reboot "KUbuntu 16.04 amd64 desktop (live)"
Step 7: Run sudo reboot to get your remote computer to reboot. If you have done everything right you should be able to SSH into the new system once it boots.
Step 8: From your new operating system, overwrite the image of the original OS. In my case it was on /dev/sda1. This will also overwrite the grub settings on the boot partition causing you to boot into the updated OS on the original partition next time you boot. Again, what ever OS you put on that partition must have SSH enabled, default username and password, and network settings configured already.
Step 9: Reboot and you should be in your newly imaged operating system.