Recipe for booting Venus OS on RasPi4 from USB/SSD

When I started with Venus OS on a Raspberry 4 two years ago, I soon experienced a lot of trouble with write errors on the SD card (even if this was a “high quality” device). I figured out how to boot from an SSD attached via USB to work around this issue, but never got the time to write down all the required steps. But now’s the time. Here we go, short version first:

  • Copy the kernel image from /boot to /u-boot
  • Adjust /u-boot/config.txt
  • Adjust /u-boot/cmdline.txt
  • Adjust /etc/fstab

And now for the loooong version:

The following works for RasPi4 only (afaik)!
And please note all software updates from the GUI do not work any more.
You should thus disable automatic updates!

  • Copy a Venus OS image to an SD card and boot the RasPi from it
  • Enable ssh on LAN
  • Set a root password
  • Login via ssh
  • Attach an empty (!) SSD via USB
  • Create partitions on the SSD:

parted /dev/sda -ms mklabel msdos mkpart primary fat16 2048s 50MB set 1 boot on \
set 1 lba on mkpart primary ext4 50MB 33% mkpart primary ext4 33% 66% mkpart primary ext4 66% 100%

  • Create file systems on the partitions:

mkfs.ext4 -F /dev/sda2
mkfs.ext4 -F /dev/sda3
mkfs.ext4 -F /dev/sda4

  • Unmount the U-Boot partition:

umount /u-boot/

  • Repeat the command above until an error occurs to make sure the device is actually unmounted
  • Copy the U-Boot partition to the SSD:

dd bs=32M if=/dev/mmcblk0p1 of=/dev/sda1; sync

  • Mount the U-Boot partition from the SSD:

mount /dev/sda1 /mnt

  • Copy the kernel to the U-Boot partition (adjust the file name if required):

cp /boot/zImage-5.10.110 /mnt

  • Change the image booted by U-Boot to the kernel copied above

sed -i.bak -e ‘s/=u-boot.bin/=zImage-5.10.110/’ /mnt/config.txt

  • Enable boot from USB:

echo -e ‘\n# turn on boot from USB\nprogram_usb_boot_mode=1’ >> /mnt/config.txt

  • Get the partition UUID of the SSD root partition (write down the output of the following):

ls -l /dev/disk/by-partuuid | fgrep sda | egrep -o ‘[0-9a-f]±02’

  • Change the kernel command line (replace YOURUUID by what you got above):

echo ‘dwc_otg.lpm_enable=0 console=serial0,115200 root=PARTUUID=YOURUUID rootfstype=ext4 fsck.repair=yes rootwait’ > /mnt/cmdline.txt

  • Unmount the U-Boot partition:

umount /mnt

  • Copy the root and data partitions (the SSD partitions get
    mounted automatically by Venus OS; may take some minutes):

tar cfC - / --one-file-system . | tar xfC - /run/media/sda2
tar cfC - /data . | tar xfC - /run/media/sda4

  • Adjust /etc/fstab:

sed -i.bak -e ‘s/mmcblk0p/sda/’ /run/media/sda2/etc/fstab

  • Unmount the SSD partititions:

umount /dev/sda2
umount /dev/sda3
umount -l /dev/sda4

  • Power down the RasPi:

poweroff

  • Disconnect power from the RasPi and remove the SD card
  • Reconnect power

Et voilà!

1 Like

Hi.

Looks promising, but if the updates will not work anymore, this procedure is somehow “useless”. We need updates, making this procedure for each update is unpleasant.

Maybe you’ll find a way to allow updates on the device. I found it, and it is working .. even if it is manual, but at least I don’t lose data. :blush:

Cheers