Installing MagAO-X on a Raspberry Pi
Image MicroSD card
Go to raspberry pi imager on your computer.
Insert microSD card to your computer.
Select R-Pi device you are using (R-Pi 5), OS (Ubuntu Desktop 24.04.3 LTS for R-Pi 5), and storage (SD card). Do ctrl+shift+X to customize and make sure to enable ssh, and set the pis name and password. Then write.
After it successfully writes, add a blank text file titled “ssh” in “system-boot” drive.
Connect the Raspberry Pi to WiFi
If you are using Ubuntu OS, you will want to edit /etc/netplan/50-cloud-init-yaml
Add another section called “wifis:”:
network:
version: 2
ethernets:
eth0:
match:
macaddress: ""
addresses:
- ???.???.??.?/?? # Set your desired static IP
dhcp4: false #true
#dhcp6: true
set-name: "eth0"
wifis:
wlan0:
dhcp4: true
access-points:
"WIFI NAME HERE":
password: "WIFI PASS HERE"
Once saved, run “sudo netplan apply”
To confirm connection run “ip a show wlan0”, and run “ping -c 3 8.8.8.8”
If this still does not work, you may need to go to settings to type username and password under the wifi you are trying to connect to.
Once connected to WiFi, you should be able to run “ssh username@wifi_ip_address” to connect to the Raspberry Pi.
Install MagAO-X
Install git with “sudo apt install git”.
To get ssh working properly, run “sudo apt update”, then “sudo apt install openssh-server”.
To avoid “Failed to restart sshd.service: Unit sshd.service not found.” error when provisioning, run “sudo systemctl status ssh” (which should have something that says disabled) then run “sudo systemctl enable ssh” (this should change that to enabled).
Clone MagAO-X repo with “git clone https://github.com/magao-x/MagAOX.git”.
Change to the setup directory to run preprovisioning. run “cd ~/MagAOX/setup” and “./pre_provision.sh”.
When prompted for Role, select “workstation”.
For the accelerometer application, you may want to switch role permanently by editing “/etc/profile.d/magaox_role.sh” and adding “export MAGAOX_ROLE=ACC001”
Now you need to logout and login again. This means exit and run “reboot” in terminal.
Open a new terminal, go to the setup directory and run “bash provision.sh”. This should run for ~30 minutes.
Troubleshooting Common Provsioning and Make Errors
- Error: “curl: (56) Recv failure: Connection reset by peer”
You can run “bash -x provision.sh” to see exactly what script caused the error
Go to where the error occured “nano /home/user/MagAOX/setup/steps/install_cfitsio.sh”
In here, you will find a link to a .tar file “https://heasarc.gsfc.nasa.gov/FTP/software/fitsio/c/cfitsio-3.47.tar.gz”
Download the .tar file and put it in “cd /opt/MagAOX/vendor”
Re-run “bash provision.sh” in “~/MagAOX/setup”
- fatal error: rtimv/rtimvInterfaces.hpp: No such file or directory
Your MAGAOX_ROLE is likely ‘workstation’. You need to have a role starting with ACC so that the Makefile recognizes it as an accelerometer Rpi and doesn’t install rtimv.
Temporary fix is to do “export MAGAOX_ROLE=ACC***”
Permenant fix is to do “sudo nano /etc/profile.d/magaox_role.sh” then add the line “export MAGAOX_ROLE=ACC***”. This will set your role to ACC*** automatically on future reboots.o
- mzmqClient.hpp:196:17: error: request for member ‘store’ in ‘milkzmq::milkzmqClient::m_timeToDie’, which is of non-class type ‘bool’
run the following commands:
cd /opt/MagAOX/source/milkzmq
git pull
make -B
sudo make install
- fatal error: lgpio.h: No such file or directory
In “~/source/MagAOX”, run “sudo apt update”
Then run “sudo apt install -y liblgpio-dev”
Check it was installed with “find /usr /usr/local -name lgpio.h 2>/dev/null”. This should return /usr/include/lgpio.h if successful
Installing mxlib
To have MagAO-X on the Rpi, you will also need to install mxlib. This can be done in the ‘source’ folder where you already installed MagAO-X. Below are the commands to do this: 1. cd ~/source/ 2. git clone https://github.com/jaredmales/mxlib.git 3. cd mxlib/ 4. mkdir _build 5. cd _build/ 6. cmake .. 7. make 8. sudo make install
Setting up SSH
Follow the procedure in the handbook under ‘Compute System -> Instrument computer setup guide -> Setup ssh
Adding a Static IP Address
Ensure you have edited /etc/netplan/50-cloud-init-yaml to:
eth0:
addresses:
- ???.???.??.?/?? # Set your desired static IP
dhcp4: false
Also edit /etc/dhcpcd.conf to set your static ip address there to:
interface eth0
static ip_address=???.???.??.?/??
static routers=???.???.??.?