Re: Octoprint (3D print server) on Omega2+
I installed Octoprint 1.5.2 on an Omega2+ with the Mini Dock for USB and power. There are other ways to do this, like a few different Docks that would work, or you can do it with pins. But USB seems the simplest to me at least for my use.
The post I'm replying to explains how to do this with Octoprint 1.3.9 on an older Omega2+ firmware, I don't know which version. I wanted to do it with the latest version (1.5.2) and firmware (Ω-ware: 0.3.2 b233), and I was able to do it with a few tweaks. For completeness I'll post the whole procedure. I'm writing this from memory, I didn't take notes on the specific things I did differently so let me know if you have problems.
I made changes to config files using the Code Editor app through the web interface. The previous instructions use vi, which to me seems more difficult. Ok, here goes.
This assumes you have gone through the initial setup wizard, have a microSD card in the slot on the Omega (I think 2GB is enough but I'm not positive), and have a way to connect your 3D printer to the Omega (USB is simplest).
1. Change the package repository
In the file /etc/opkg/distfeeds.conf, uncomment these two lines (probably lines 2 and 5):
src/gz openwrt_base http://downloads.openwrt.org/releases/18.06-SNAPSHOT/packages/mipsel_24kc/base
src/gz openwrt_packages http://downloads.openwrt.org/releases/18.06-SNAPSHOT/packages/mipsel_24kc/packages
run
opkg update
2. Format and mount SD card
opkg install fdisk e2fsprogs block-mount
umount /dev/mmcblk0p1
mkfs.ext4 /dev/mmcblk0p1
umount /dev/mmcblk0p1
mkdir /mnt/SD
mount /dev/mmcblk0p1 /mnt/SD
(will get some error like can’t umount, just ignore it)
3. Copy OS to SD card
tar -C /overlay -cvf - . | tar -C /mnt/SD/ -xf -
umount /mnt/SD
block detect > /etc/config/fstab
4. Auto mount SD card on system boot
In the file /etc/config/fstab,
change the option: target '/mnt/mmcblk0p1' to option: target '/overlay'
change the option: enabled '0' to option enabled ‘1'
reboot
after rebooting you can verify if /overlay is mounted properly by running
df -h
You should see something like
Filesystem Size Used Available Use% Mounted on
/dev/root 7.8M 7.8M 0 100% /rom
tmpfs 60.9M 124.0K 60.8M 0% /tmp
/dev/mmcblk0p1 14.5G 1.3G 12.4G 10% /rom/overlay
overlayfs:/overlay 14.5G 1.3G 12.4G 10% /
tmpfs 512.0K 0 512.0K 0% /dev
Except your used and free space will be different.
5. Set up swap space and expand /tmp
opkg install swap-utils
create swap file on SD card
dd if=/dev/zero of=/rom/overlay/swap.page bs=1M count=512
This will take a few minutes
mkswap /rom/overlay/swap.page
swapon /rom/overlay/swap.page
To check
free
should look like
total used free shared buffers cached
Mem: 124808 96724 28084 132 5444 15564
-/+ buffers/cache: 75716 49092
Swap: 1048572 0 1048572
expand /tmp
mount -o remount,size=200M /tmp
5. Install C++ and Python (I chose Python 3 because Python 2 is being phased out)
opkg update
opkg install gcc make
opkg install python3 python3-pip unzip
opkg install python3-dev --force-overwrite
pip3 install --upgrade pip
pip3 install --upgrade setuptools
7. Download and install Octoprint
cd /root
wget https://github.com/foosel/OctoPrint/archive/1.5.2.zip
unzip 1.5.2.zip
cd OctoPrint-1.5.2
ln -s /usr/bin/gcc /usr/bin/ccache_cc
Install (this will take a while)
pip install -r requirements.txt
Fix some file/folder names for compatibility
sed -i 's/Häußge/H\./g' /root/OctoPrint-1.5.2/src/octoprint/util/comm.py
sed -i 's/Häußge/H\./g' /root/OctoPrint-1.5.2/src/octoprint/util/virtual.py
sed -i 's/Häußge/H\./g' /root/OctoPrint-1.5.2/src/octoprint/plugins/virtual_printer/virtual.py
sed -i 's/exit("You should not run OctoPrint as root!")/pass/g' /root/OctoPrint-1.5.2/src/octoprint/server/__init__.py
8. Run Octoprint Server
octoprint serve --iknowwhatimdoing &
Wait several minutes for server to start
Use browser to connect
http://omega-[your id].local:5000
Go through the setup wizard and change settings as needed for your printer
You might want to update Octoprint and/or install some plug-ins. Future updates might not work, so you risk messing up your Octoprint install, do so at your own risk. Same goes for plug-ins, some of them might not install on the Omega2 or break something, but the ones I tried worked fine.
9. Set to automatically start Octoprint on boot
In the file /etc/rc.local, add this right above the exit line
octoprint serve --iknowwhatimdoing
or, for debugging purposes, to log Octoprint's console output, instead add
octoprint serve --iknowwhatimdoing >> /tmp/output.txt 2>&1 &
If you want to be able to update, or possibly to install certain plugins, you might want to use the swap file and expand /tmp. I don't know if this has any performance implications or if there's some reason not to, I'm still a beginner with Linux, but I have some experience. If you want to do this, in the same file /etc/rc.local, add the following above the Octoprint line
### activate the swap file on the SD card
swapon /rom/overlay/swap.page
### expand /tmp space
mount -o remount,size=200M /tmp
And that's it! Happy printing!
Let me know if you have any problems or questions or comments.