Automated install script for OpenWrt in a Container on Proxmox!

jaminmc

Member
Aug 1, 2022
70
65
23
I have created an automated install script for ProxMox to install OpenWrt in a container. The beauty is that it downloads the rootfs directly from Openwrt, and not the Linux containers site.

The script detects bridges, and network devices that can be used for the WAN or LAN, and even has the option to set the subnet of the LAN, with a defaule value of 10.23.45.1/24. If you do not select any network devices, it will still configure the container for eth0 being the WAN, and eth1 being the LAN for manually adding network devices later.

Tested using 2 bridges. One for WAN, and the other for LAN. and had a VM connect through the LAN bridge. It detects the latest stable version, and installes that by default, but you can specify a version manually. I have tested it on 23.05.5 and the current 24.10.0.

If you have multiple Container storage locations, it will prompt you for which one you want to use!


https://gist.github.com/jaminmc/7e786a8947746439f7b8a8e2726e629d

edit: Added support for Snapshot, and auto install prompt for LiCi web interface for snapshot. I couldn't test wireguard, as the repo is missing the ip package right now.
 
Last edited:
Thank you. I did spend a bunch of time creating it.

All the other instructions were based on the LXD Linuxcontainer site. This pulls directly from the OpenWrt server, and modifies the configuration in the container automatically.

I did a diff between the root filesystems of the one from linuxcontainers, and OpenWrt, and that helped me in making the script.

Plus other instructions were hard to follow, and even opened security issues by opening the firewall on the wan port.

I tried to have the script prompt for what most people would want to set it up.
 
I've tried reinstalling PERL, but I keep getting this error when I try to use this script. Setup.pm is missing. Do I need to reinstall Proxmox?

extracting archive '/var/lib/vz/template/cache/openwrt-25.12.0-rc4-x86_64.tar.gz'
Total bytes read: 12625920 (13MiB, 132MiB/s)
Logical volume "vm-101-disk-0" successfully removed.
unable to create CT 101 - Can't locate object method "check_systemd_nesting" via package "PVE::LXC::Setup::Unmanaged" at /usr/share/perl5/PVE/LXC/Setup.pm line 304.
Error: Failed to create container

I have used OpenWRT for a long time, new to Proxmox trying to setup x86 N150 as my router.
 
I've tried reinstalling PERL, but I keep getting this error when I try to use this script. Setup.pm is missing. Do I need to reinstall Proxmox?

extracting archive '/var/lib/vz/template/cache/openwrt-25.12.0-rc4-x86_64.tar.gz'
Total bytes read: 12625920 (13MiB, 132MiB/s)
Logical volume "vm-101-disk-0" successfully removed.
unable to create CT 101 - Can't locate object method "check_systemd_nesting" via package "PVE::LXC::Setup::Unmanaged" at /usr/share/perl5/PVE/LXC/Setup.pm line 304.
Error: Failed to create container

I have used OpenWRT for a long time, new to Proxmox trying to setup x86 N150 as my router.
I’ve just updated the script for Release Candidate versions. Now, it’ll ask if you’d like to reuse the template if it’s already there. If you say no, it’ll download it again. This way, if you had a bad download before, it’ll download a fresh one.

I’m only using the latest Proxmox, so I’m not sure if it will work on Proxmox 8.