2

I have a remotely managed RapsBerry Pi 2 B on the same LAN (different room and floor) without screen, mouse nor keyboard but RJ45 ethernet connected.
I would like to install multiple operating systems, for example Ubuntu Linux and Kali Linux would be enough.

But I can not go to the RapsBerry room when wanting to change operating system, so I would need any method to remotely order boot changing to another one.

In Desktop computers this is easily solved by installing GRUB and issuing the grub reboot command. Something like:

$ sudo grub-reboot 2

... to boot the third (the first one is the 0) operating system in the GRUB's list.

Is there any not-too-complex equivalent method?

Scriptable solutions (command-line) preferred instead of GUI methods.
Manual file-renaming, moving, editing or equivalent accepted.

1 Answers1

2

Yes,

but first did you know that both Kali Linux and Ubuntu are debian with some stuff pre installed/configured? You may be able to just use one OS by installing whatever you need on the other one.

The raspberrypi did not initially have a boot loader (outside of the GPU BLOB) but you could still edit the text file to tell it which partition to boot. Now there are more options like berryboot and NOOBS. I would stick with a light weight script like this:

#!/bin/bash

if [[ ! $(id) =~ uid=0\(root\) ]] ; then
    echo "must be root" >&2;
    exit 1;
fi
if [ "$1" != "kali" -a "$1" != "ubuntu" ] ; then
    echo "invalid option" >&2;
    exit 2;
fi
cp /opt/$1/* /boot/
shutdown -r now

Depending on what you need you might just be updating the cmdline.txt to point to the 2nd or 3rd partition but likely you will also want to replace kernel.img (as device tree overlays may not be in use yet) (config.txt if you want a different memory split, etc)

user1133275
  • 2,167
  • 12
  • 30
  • Indeed, it is possible to install packages from one into the other O.S, but Kali Linux has some kernel and drivers patching & optimizations that make it more valuable for auditing networks (and management of some devices like WiFi ones), and Ubuntu uses to have a greater stability and compatibility with more devices (webcams, for example). – Sopalajo de Arrierez May 03 '15 at 10:19
  • I did not know Kali was unstable, anyway let us know if one of those 3 milti boot options work for you. – user1133275 May 03 '15 at 14:08