Virtual OpenWrt on rpi with proxmox

Hello,

I have already found some (older) threads here, but they won't fit anymore. I tried to compile my own image but without success, it won't even start.
Any ideas or an guide? I downloaded an overloaded image and this works, but I want a custom one :confused:

thx so long!

edit: I use that "QEMU ARM Virtual Machine" and Cortex-a53

I have noticed that the boot partition is missing, also during the compiling process there is no option for boot loaders... but why? :confused:
thx!

edit: so far I got it that it boots, but after that lines it freezes

EFI stub: Booting Linux Kernel...
EFI stub: Generating empty DTB
EFI stub: Existing boot services and installing

Can't help you with proxmox but if you want a virtualized openwrt you should take a look at docker or lxc

Thx for your answer, but there aren't any containers for arm64? when using armvirt-64 it fails.

Have you tried creating a rootfs tarball from official sources? Creating a container from there is easy
Also I see some prebuilt containers on docker hub like https://hub.docker.com/r/unifreq/openwrt-aarch64

I am afraid no, can you help me to do so?
I have already found that ones: https://us.lxd.images.canonical.com/images/openwrt/22.03/arm64/default/

the machine starts but black screen and no interaction :confused: with lxc

so long

Unfortunately my lxc is armV7 (32bits) so can't really help here.
Maybe you should start a new thread about the lxc issue
@tmomas please move this thread to Installing and using Openwrt

Running OpenWrt on qemu/ kvm is a fully supported solution (just your hypervisor needs to work/ be stable, but that's outside of OpenWrt's realm), running it on lxc/ docker is not (the host kernel needs to support everything OpenWrt needs, but that isn't the case, including in some security sensitive areas, as OpenWrt uses kernel patches and sysctl settings relied upon by firewall and other facilities).

@slh thx! ok no support and not secure doesn't sound nice :wink: are you familiar about qemu and openwrt? my image(s) won't run on my pimox.

thx!

edit: I have already tried that version: Arm64 (or armvirt) with UEFI boot? - #6 by daemonix

I also don't get an output but the vm gets an ip address and I can ping it about 7 times, then it freezes.

1 Like

I am using qemu/ kvm for testing OpenWrt and other stuff, however x86 only (never had an RPi, nor any other ARM based SBC), never played with proxmox and always with recent mainline kernels (v6.0.0 right now) on the host, so I can't offer much help with your proxmox-ARM issues.

In general, I would advise against running a virtualized OpenWrt in production, not because it doesn't work (it does), but because doing so adds considerable complexity (you need to maintain two things in lockstep, the hypervisor and your OpenWrt VM, get them to agree on the networking setup, while also exposing the hypervisor to the internet - in return, you get non-funny layering and chicken-vs-egg issues (you need internet to upgrade the hypervisor, but you only have internet with the VM running, let alone dhcp/ dns)). At least for home uses, there is value in simple setups - WAN-in, LAN-out on dedicated cables, if something breaks, replace the router with another one.

Using a virtual OpenWrt is fine for testing, maybe to provide routing for optional VLANs - or if you're really running an enterprise environment with hot-failover and similar things, but in that case hypervisor administration would be a major component in your day-to-day work. At home, it's just easier and more reliable to run your router on bare iron (be it x86_64, RPi4 or a plastic router), following KISS principles.

I was able to successfully run OpenWrt as a container on Pimox( Rpi 4 Proxmox 7). First I tried running UEFI version that "varoudis" provided at https://github.com/varoudis/openwrt_arm64_uefi. In one of his pull requests, he does share details of his VM at this link https://github.com/varoudis/openwrt_arm64_uefi/issues/1. The key to properly get a working OpenWrt VM is to have BIOS as UEFI and Display output needs to be set for Serial Port.

Even with that working, I was having problem running OPKG UPDATE. Update would never happen and would fail after trying so many times. Which forced me to turn to LXC container for Proxmox. Had to follow the guide from https://virtualizeeverything.com/2022/05/23/setting-openwrt-in-proxmox-lxc/ and the Youtube video from the creator was helpful. OpenWrt container image from https://us.lxd.images.canonical.com/images/openwrt/22.03/arm64/default/20221119_12:02/rootfs.tar.xz was used for the container I created. The script I had to run to create the container was

pct create 100 /mnt/pve/truenasNFS/template/cache/openwrt_22.03_rootfs.tar.xz --arch arm64 --hostname OpenWrt-21.02 --rootfs truenasNFS:202 --memory 1024 --swap 512 --cores 2 --ostype unmanaged --unprivileged 1

The catch is that after creating and running the container no display output works from console. To surpass that I had to open a terminal on server and enter into the container

pct enter "container id"

Then I had some real struggle setting up the network which I finally got sorted. Following is the network config for my Container.

~ # cat /etc/config/network

config interface 'loopback'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
option device 'lo'

config globals 'globals'
option default_ps '0'
option ula_prefix 'fdd3:01f8:6843::/48'

config device
option name 'br-lan'
option type 'bridge'
list ports 'eth0'

config interface 'lan'
option device 'br-lan'
option proto 'static'
option ipaddr '192.168.1.10/24'
option netmask '255.255.255.0'
option gateway '192.168.1.1'
option broadcast '192.168.1.255'
option ip6assign '60'
option device 'eth0'

config interface 'wan'
option proto 'dhcp'
option device 'eth1'

config interface 'wan6'
option proto 'dhcpv6'
option device 'eth1'

2 Likes

Hello,

I am trying to follow your way to launch the OpenWRT 22.03.3 inside (I used the default-root image from here, but using pct enter [container_id] I can run uci command of OpenWRT so I assume OK?)

My setup has 3 dedicated ethernet ports (1 for PiMox, 2 for OpenWRT), assigned 2 NICs to the container but my client computer doesn't get address from it, do I need extra setting?

Edit: I just find that it's the DHCPv4 unable to get by client, reason unknown, if I manual configure v4 address then it can ping OpenWRT container! However opkg won't work....

echo "tty1::askfirst:/usr/libexec/login.sh" >> /etc/inittab
For the default settings (console mode: tty)
You can also bring it up by setting console mode to shell.

Sorry to bump an old thread. But yes, openwrt isn't exactly configured out of the box with proxmox's expectations for a console in mind.

Is your container a privileged one? I found that with a non privileged container by default I have trouble with some DHCPv6 issue as well as clients unable to get IP address from OpenWrt container. Though I already managed to solve the later problem already.