User Tools

Site Tools


This documentation applies only Turris OS 3.x that is no longer present in newly sold routers. The new documentation is located at https://docs.turris.cz/.

Booting from external and removable storage

This article is for older models of Turris Omnia with black chassis. Does not apply to Turris Omnia 2019 and 2020 with silver case.

For now, there are two ways, what you can do for booting from external storage.

  • The first way is using mSATA SSD, which you need to plug to the right slot, which is close to the heatsink (CPU) as is the only one, which supports also mSATA interface together with mini PCIe.
  • The second way is using the adapter (MPCIE1U-NO1) from mini PCIe to USB 2.0, which has to be plugged to the left mini PCIe slot, where is the SIM card slot. Into this adapter, you'll need to plug slim and short USB flash drive, which will fit there.

For each option, you need to have the serial cable and flash disk with the medkit.

Creating bootable disk

Once you have the removable storage inserted to the Turris Omnia, plug the serial cable and connect the power cord. In the serial console, when powering it up, try to hit enter repeatedly as fast as you can till you manage to interrupt U-Boot bootloader and you get '⇒' prompt. Remember how you did it, we will need it later on again.

In this prompt enter `run rescueboot` and wait for rescue mode to boot up. Once you see the prompt, we can start preparing the disk. At this moment, you probably have two disk devices available - sda and sdb. Most likely your USB/SSD is sda and USB with medkit is sdb. You can check it by entering:

fdisk -l /dev/sda

This will show you the size of the drive and partitions available. You can use fdisk to repartition your drive if you want to have a separate partition dedicated to something else.

If you connect a new SSD you need to create the partition with a tool called fdisk.

Now format the first partition to Btrfs and create there root subvolume using the following commands:

mkfs.btrfs /dev/sda1
mkdir /mnt/ssd
mount /dev/sda1 /mnt/ssd
btrfs subvol create /mnt/ssd/@

Now, you need to mount the flash drive and deploy the medkit.

mkdir /mnt/flash
mount /dev/sdb1 /mnt/flash
cd /mnt/ssd/@
tar -xzvf /mnt/flash/omnia-medkit-*.tar.gz

Now, is the time to clean up everything.

cd
umount /mnt/flash
umount /mnt/ssd

Now, you have a disk that you can boot from, and you can restart your router using these commands.

echo s > /proc/sysrq-trigger
echo b > /proc/sysrq-trigger

Booting from SSD

To boot from SSD prepared in previous step, you need to modify U-Boot environment. To do so you need to get to U-Boot prompt again by hitting enter several times early after powering up till you see '⇒' prompt. Once you get there, enter the following commands:

setenv bootargs 'earlyprintk console=ttyS0,115200 rootfstype=btrfs rootwait root=/dev/sda1 rootflags=subvol=@,commit=5 rw'
setenv bootcmd 'i2c dev 1; i2c read 0x2a 0x9 1 0x00FFFFF0; setexpr.b rescue *0x00FFFFF0; if test $rescue -ge 1; then echo BOOT RESCUE; run rescueboot; else echo BOOT eMMC FS; run scsiboot; fi'
setenv scsiboot 'setenv bootargs "$bootargs cfg80211.freg=$regdomain"; scsi scan; btrload scsi 0:1 0x01000000 boot/zImage @; btrload scsi 0:1 0x02000000 boot/dtb @; bootz 0x01000000 - 0x02000000'
saveenv
boot

These changes changed the boot commands to boot from SSD, saved the settings, and actually boots your router. Next time you reset it, it should boot automatically from SSD.

Booting from USB

To boot from USB flash drive prepared in previous step, you need to modify U-Boot environment. To do so you need to get to U-Boot prompt again by hitting enter several times early after powering up till you see '⇒' prompt. Once you get there, enter the following commands:

setenv usbboot 'setenv bootargs "$bootargs cfg80211.freg=$regdomain"; usb start; btrload usb 0 0x01000000 boot/zImage @; btrload usb 0 0x02000000 boot/dtb @; bootz 0x01000000 - 0x02000000'
setenv bootargs 'earlyprintk console=ttyS0,115200 rootfstype=btrfs rootwait root=/dev/sda1 rootflags=subvol=@,commit=5 rw'
setenv bootcmd 'i2c dev 1; i2c read 0x2a 0x9 1 0x00FFFFF0; setexpr.b rescue *0x00FFFFF0; if test $rescue -ge 1; then echo BOOT RESCUE; run rescueboot; else echo BOOT eMMC FS; run usbboot; fi'
setenv scsiboot 'setenv bootargs "$bootargs cfg80211.freg=$regdomain"; scsi scan; btrload scsi 0:1 0x01000000 boot/zImage @; btrload scsi 0:1 0x02000000 boot/dtb @; bootz 0x01000000 - 0x02000000'
saveenv
boot

These changes changed the boot commands to boot from USB, saved the settings, and actually boots your router. Next time you reset it, it should boot automatically from SSD.

Fixing Schnapps

Schnapps expects that your root device is on eMMC. To convince it otherwise, you need to create configuration file and specify where your rootfs resides:

mkdir /etc/schnapps
echo 'ROOT_DEV="/dev/sda1"' > /etc/schnapps/config

Problems ahead

You should avoid using LuCI mount plugin as it tries to unmount all external drives including your disk and that would break your system till the reset. Also, there is a possibility that at some point we will update U-Boot and it's environment in one of our future releases and this might override your setup and you would need to repeat step Booting from SSD or Booting from USB to get your router booting again. Also, most of the recovery options using the reset button will not work - reverting to the previous snapshot or factory reset. You can still manage your snapshots manually using schnapps if you set it up correctly.