I wanted Octoprint (a 3D-printer management software) to start up fast without the bloatness of using Raspbian. I also regularly forgot to shutdown the Raspberry Pi hosting Octoprint properly leading to file system corruption and unbootable SD card.
This set of instructions should provide all that is needed to use Octoprint without fear of improper shutdown with Arch Linux ARM by using a read-only file system.
This instructions does not have the webcam setup as I didn't intend to use it. If you wish to use the webcam, please consult and try to port the official Raspbian FAQ.
##Instructions
-
Convert the Arch Linux ARM file system to read-only. Please follow the instructions from my previous gist. The following instructions assume you are logged into with the root account.
-
Install dependencies and download Octoprint
./writeenable.sh
pacman -Syu python2 python2-setuptools python2-pip python2-virtualenv git gcc libyaml
git clone https://github.com/foosel/OctoPrint.git
cd OctoPrint
virtualenv2 --system-site-packages venv
./venv/bin/python2 setup.py install
mkdir ~/.octoprint
- Setup config.yaml
To prevent writes to the file system, all these directories including the uploaded gcode files have been shifted to the /tmp which is in the RAM disk. This means you will lose those files on reboot. There is a price to pay for using a read-only file system eh...
nano ~/.octoprint/config.yaml
#Enter the following into the file up to before #end
folder:
logs: /tmp
timelapse: /tmp
timelapse_tmp: /tmp
uploads: /tmp
system:
actions:
- name: Shutdown
command: poweroff
action: shutdown
confirm: You are about to shutdown the system.
- name: Reboot
command: reboot
action: reboot
confirm: You are about to reboot the system
- name: Enable FS Write
command: ~/writeenable.sh
action: writeenable
confirm: You are about to enable writes to the file system. You must reboot properly or enable read-only before unsafe poweroff if not file system corruption may happen.
- name: Enable read-only FS
command: ~/readonly.sh
action: readonly
confirm: You are about to relock the file system to read-only. Subsequent changes will be lost on reboot.
devel:
webassets:
bundle: false
minify: false
#end
- Run Octoprint to check if everything as been installed correctly
/root/OctoPrint/venv/bin/octoprint --port=80 --iknowwhatimdoing
Open your web browser and navigate to the IP address of your Raspberry Pi. It is your choice whether to configure access control. Connect to your printer. Save your printer's serial port settings.
Once you reboot, the file system will be set to readonly. However, you can use the system buttons "Enable FS Write" and "Enable read-only FS" to adjust the file system status temporarily.
- Start Octoprint on boot
We use a systemd service file
nano /etc/systemd/system/octo.service
#Enter the following up to before the #end
[Unit]
Description=To start Octoprint on startup
After=network-online.target
[Install]
WantedBy=multi-user.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/root/OctoPrint/venv/bin/octoprint --port=80 --iknowwhatimdoing
#end
systemctl enable octo.service
- Wifi setup with static IP address (Optional)
I prefer to set a static IP so I can easily navigate back to the webpage
pacman -S wpa_supplicant
cp /etc/netctl/examples/wireless-wpa-static /etc/netctl/wlan0-ssid
nano /etc/netctl/wlan0-ssid
#Configure this file with your wifi settings
netctl enable wlan0-ssid
- Reboot the system and test
reboot
Anytime you wish to change the Octoprint settings, you will have to unlock the file system first. If you have followed my read-only gist, you can use the writeenable.sh
and readonly.sh
shell scripts to accomplish this task. Remember to relock back once you are done.
@yeokm1 thanks for this simple guide. Works almost flawlessly.. Only problem I found was that I needed to set in
~/.octoprint/config.yaml
:In order for Octoprint to not try and build compiled web assets to
.octoprint/.build
which can't happen with a ro filesystem.