I'm not able to flash an image to this containerized install. Even if I force the process, the new image is not written, the container seems to reboot but none of the packages I compiled into the image are present suggesting that the image is not actually getting written. What am I missing?
# sysupgrade -i -F openwrt-x86-64-generic-ext4-combined-efi.img.gz
Wed Jan 29 18:17:06 GMT 2025 upgrade: Image not in /tmp, copying...
Wed Jan 29 18:17:06 GMT 2025 upgrade: Image metadata not present
Wed Jan 29 18:17:06 GMT 2025 upgrade: Unable to determine upgrade device
Image check failed but --force given - will update anyway!
Keep config files over reflash (Y/n): y
Edit config file list (y/N): n
Wed Jan 29 18:17:12 GMT 2025 upgrade: Saving config files...
Wed Jan 29 18:17:12 GMT 2025 upgrade: Commencing upgrade. Closing all shell sessions.
So it seems you have to extract the image manually for a containerized install.
# unzip and mount the image
gunzip -c openwrt-x86-64-generic-ext4-combined-efi.img.gz > here.img
fdisk -l here.img
GPT PMBR size mismatch (1114655 != 1114686) will be corrected by write.
The backup GPT table is corrupt, but the primary appears OK, so that will be used.
The backup GPT table is not on the end of the device.
Disk here.img: 544.28 MiB, 570719744 bytes, 1114687 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: CDDD8B3C-8804-E3FA-EBCB-397FAABEC900
Device Start End Sectors Size Type
here.img1 512 66047 65536 32M Linux filesystem
here.img2 66048 1114623 1048576 512M Linux filesystem
here.img128 34 511 478 239K BIOS boot
Partition table entries are not in disk order.
mkdir ok
mount -o loop,offset=$((512 * 66048)) here.img ok
# backup configs
cp -a /var/lib/lxc/openwrt/rootfs/etc/config ./backup
cp -a /var/lib/lxc/openwrt/rootfs/root ./backup-root
# wipe old image and replace with new and restore configs
rm -rf /var/lib/lxc/openwrt/rootfs/*
cp -a ./ok/* /var/lib/lxc/openwrt/rootfs/
cp backup/* /var/lib/lxc/openwrt/rootfs/etc/config
cp backup-root/* /var/lib/lxc/openwrt/rootfs/root
cp backup-root/.* /var/lib/lxc/openwrt/rootfs/root
OpenWrt interacts heavily with the kernel and containers use the host kernel. Modules cannot be added to it, and even if the functionality you need is in the host kernel, it is likely to have a version incompatibiltiy. One really should not even try to run OpenWrt in a container. Use a full VM or a bare-metal installation.