bluerobotics / bluerobotics/BlueOS

not a bug - attempt to document notes on running the entire BlueOS stack as a VIRTUAL Raspberry Pi

Open
#1,629 9 comments 4 reactions 0 assignees View on GitHub
documentation enhancement
Dominant language
Vue
Stars
453
Forks
151
Avg merge
1d 3h
Merged PRs (30d)
174

Description

### Bug description

host OS is ubuntu laptop 64bit

goal:
to make a VM that runs BlueOS in its entirely good enough that it doesn't know its running on a VM...

```
mkdir ~/BlueOS
cd BlueOS
wget https://github.com/bluerobotics/BlueOS-docker/releases/download/1.0.1/BlueOS-raspberry.zip
unzip BlueOS-raspberry.zip
ls -l blueos.img
# we'll re-size it larger , so keep the original incase that doesn't work.
cp blueos.imb blueos2.img
qemu-img resize blueos2.img +16G
```

# we need these..
```
sudo apt install -y qemu-system-arm
sudo apt install -y virt-manager
```

`sudo virsh --connect=qemu:///system net-start default`

# start qemu/kvm gui with root privs or it didnt work for me..
`sudo virt-manager`

# get qemu-ready kernel and dtb - see url at bottom..
`git clone https://github.com/dhruvvyas90/qemu-rpi-kernel`

# look at the current 'default' network..
`sudo virsh net-dumpxml default`

make a new file netdump.xml containing tweaks[so the VM boots as 192.168.2.2 later]:
```

default
0b43d6e7-26b8-4547-a6f5-1eb1ec2bc3bf











```

#destroy stock network:
`sudo virsh net-destroy default`

# re-create from xml file:
`sudo virsh net-create netdump.xml`

# make a new VM from the command-line [ close-and-re-open virt-manager afterwards to see it in gui]
`sudo virt-install --name rpios --arch armv6l --machine versatilepb --cpu arm1176 --vcpus 1 --memory 256 --import --disk blueos2.img,format=raw,bus=virtio --network bridge,source=virbr0,model=virtio --video vga --graphics spice --boot 'dtb=qemu-rpi-kernel/versatile-pb-buster.dtb,kernel=qemu-rpi-kernel/kernel-qemu-4.19.50-buster,kernel_args=root=/dev/vda2 panic=1' --events on_reboot=destroy --osinfo detect=on,require=off`

#re-start gui and hope it worked..
`sudo virt-manager`

use GUI to start the VM labeled 'rpios' we made above.
did your VM boot, mine did.

in the GUI, if you 'click' the VM's console and get your keystrokes locked into it, press left-ctrl and left-alt together.

[in the VM, you can login as user 'pi' and password 'raspberry'], and you'll see its hostname is 'blueos']

# resize VM's filesystem to match the enlarged disk..
```
sudo raspi-config
-> advanced options -> expand filesystem -> enter -> .... ->ok -> finish. reboot now ? -> yes.
```

use GUI to re-start the VM labeled 'rpios' we made above.
did your VM boot, mine did.

at this point it *might* be pingable at 192.168.2.2 if the above xml worked... if it didn't, then login to console again [pi/raspberry], then type
sudo ifconfig
to get the VM's current ip address.

You can now *hopefully* ping its IP address from another terminal window on your host computer... if you CAN ping it, then you can also 'ssh pi@192.168.2.2' and ssh into it that way.. so now you have a console AND ssh access working. SSH access is better because u can cut-n-base into it more easily.

into your 'ssh' window that goes to the VM cut-n-paste these one at a time.. and hope they work...
pi@blueos:~ $ ls

```
# get blueos install script...
wget https://github.com/bluerobotics/BlueOS-docker/blob/master/install/install.sh
chmod 755 ./install.sh

#since this VM is 'armv6l' architecture, but the install script doesn't list that as supported, we need to edit line 63 of the install.sh that we just downloaded before we use it... [ change "armv7l" to "armv6l" ]
vim ./install.sh

# this file is expected by rfkill, which the above script runs.
sudo touch /dev/rfkill
# this allows docker to work..
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy

# install latest dockerOS -
sudo ./install.sh --skip-board-config
```

if it doesn't complete, try rebooting and running it a second time.
```
sudo touch /dev/rfkill
sudo ./install.sh --skip-board-config
```

```
... sometime later here's the last bit of the log u should see from the above command....
...
Configure hostname to blueos
Installation finished successfully.
You can access after the reboot:
- The computer webpage: http://blueos.local
- The ssh client: pi@blueos.local
System will reboot in 10 seconds.
Connection to 192.168.2.2 closed by remote host.
```

waitf or it to reboot, again, and be pingable... and then try visit..
http://192.168.2.2/

references:
https://linuxconfig.org/how-to-run-the-raspberry-pi-os-in-a-virtual-machine-with-qemu-and-kvm

### Steps to reproduce

see above.

### Primary pain point(s)

_No response_

### Prerequisites

- [X] I have checked to make sure that a similar request has not already been filed or fixed.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.