Installing OpenWRT as LXC. How convert LXC template to Proxmox Template?

rkk2025

New Member
Jul 11, 2018
25
1
3
28
Hi,

I'm trying to install OpenWRT as LXC. I have a LXC template file that can be inported with the command "lxc image import template.tar.gz". Source to build the image is here: github com mikma lxd-openwrt
and a binary version can be found here: Google Drive Share: 1qQL4-cqmN3Q6e5xUOV1I0MLH-kYHDkxn

Anybody knows how to create a template that works with Proxmox? From what I could see in the official templates from Proxmox the template files simply have the root file system in the root of the archive, but where and how to add the "Guest Operating System Options" in it? Or is the only way for this to work if Proxmox officialy supports OpenWRT?

PD: Was not able to add the URLs directly as it's blocked by antispam. just paste the github into google and it should show up. For the Google share, create a file on your Google drive, get the share link and replace the ID number with the one I posted here, that should work.
 

Alwin

Proxmox Staff Member
Staff member
Aug 1, 2017
3,297
289
88
but where and how to add the "Guest Operating System Options" in it?
What do you mean by that? If you made a rootfs (x86) and use the naming convention, then a simple creation of the CT on the GUI/CLI should do. There you can select the template then.
Code:
<OS>-<OSVERSION>-<NAME>_<VERSION>_<ARCH>.tar.gz
 

rkk2025

New Member
Jul 11, 2018
25
1
3
28
What do you mean by that? If you made a rootfs (x86) and use the naming convention, then a simple creation of the CT on the GUI/CLI should do. There you can select the template then.
Code:
<OS>-<OSVERSION>-<NAME>_<VERSION>_<ARCH>.tar.gz
So I renamed the rootfs file to "openwrt-18.06.1-openwrt_18.06.1_amd64.tar.gz" following the template filename syntax, and when I'm creating the CT I get an error saying "ERROR: unable to detect OS distribution". That's what I actually meant with my previous post, how can I set the os-distribution when it is not officially supported by proxmox. Is there any way to add support for openwrt? Or is this some kind of core change to proxmox to do so?
 

rkk2025

New Member
Jul 11, 2018
25
1
3
28
Nice! It works!! Thank you very much Alwin. Even defining the Network interfaces from Proxmox works! IPs gets set but when you reboot they are lost, but can be persisted with the proper configuration in the system (I guess that's the unmanaged part). The whole system is working flawlessly so far. Thank you very much for the support.

Any chance that OpenWRT will be officially added to Proxmox as a template? Its really great to setup quickly a virtual router for VPN or other network stuff.
 

Alwin

Proxmox Staff Member
Staff member
Aug 1, 2017
3,297
289
88
Any chance that OpenWRT will be officially added to Proxmox as a template? Its really great to setup quickly a virtual router for VPN or other network stuff.
You may add a feature request and/or send patches for the ostype identification and CT configuration.
https://bugzilla.proxmox.com/
 
  • Like
Reactions: rkk2025

gechu

New Member
Mar 22, 2019
8
1
3
37
Hi @rkk2025, how have things been working out running OpenWRT in a container? Guys over at https://github.com/mikma/lxd-openwrt seems quite active, but i do much prefer to mange things a coherent way through the Proxmox UI.

EDIT: The reason I´m looking into running OpenWRT closer to the host is that I get somewhat crappy bufferbloat scores in dslreport´s test. even though i´m using virtio net drivers.
 
Last edited:

rkk2025

New Member
Jul 11, 2018
25
1
3
28
Hi @rkk2025, how have things been working out running OpenWRT in a container? Guys over at https://github.com/mikma/lxd-openwrt seems quite active, but i do much prefer to mange things a coherent way through the Proxmox UI.

EDIT: The reason I´m looking into running OpenWRT closer to the host is that I get somewhat crappy bufferbloat scores in dslreport´s test. even though i´m using virtio net drivers.
Hi gechu,

I've been running several OpenWRT containers on Proxmox for almost a year now, and they have been running very snappy and stable so far. I have one virtual router setup as VPN client, another that acts as WireGuard VPN server that I use to interconnect my home networks, I have another virtual router acting as NAT for other Proxmox containers (I use it as easy to manage port forwarding UI) and now recently I discovered that it is possible to pass-trough the host WiFi device so I actually use another virtual router as my wireless AP router at home.

Here is the bug report I opened a while ago regarding this and also has details on how to currently spin up an OpenWRT container in Proxmox:
https://bugzilla.proxmox.com/show_bug.cgi?id=2044

I also tried running OpenWRT in KVM in Proxmox, but I also get extremely bad performance with all network drivers (CPU usage seems to go over the roof whenever there is any kind of network transfer or processing happening inside the VM), for me the VM from the Host side is idling at around 10-20% while the OpenWRT VM is doing nothing, and it only gets worse when I create a WiFi AP where the CPU usage can go much higher.

In the LXC containers I don't have those issues, where CPU usage usually stays between 0 to 0.5% while idling. WiFi CPU consumption happens in the Kernel and therefore is not visible in the LXC CPU usage (But is defenitely just a fraction of what the VM consumed), but performance seems rock solid for me.

I do recommend you to try OpenWRT inside LXC, I'm pretty sure you'll get much better performance.

P.D: I actually also contributed to the mikma/lxd-openwrt repo with fixes (You can now reboot the container properly, while before it would just shutdown on reboot).
 

gechu

New Member
Mar 22, 2019
8
1
3
37
Excellent! Thanks for quick and helpful reply! Gotto try this out right away! :)
 

Di.

Member
Aug 20, 2015
3
0
21
Hello!
Can anyone share a lxd container openwrt for proxmox?
I did not understand how to build it yourself =(
 

gechu

New Member
Mar 22, 2019
8
1
3
37
Hi! Here´s a link to OpenWrt 19.07 RC2 that I compiled a week ago. Note: I did run into some "tainted kernel" issues when I enabled SQM in OpenWrt. Not sure why, but I think it was related to the kernel modules mapping between the host and the container was somehow not fully aligned. Will file a bug report at https://github.com/mikma/lxd-openwrt

Also, read that OpenWrt 19.x should be easier to setup than 18.x (no need to run script to create some "dev" folders) using a precompiled image over at http://www.makikiweb.com/Pi/lxc_openwrt.html. I haven´t tried it yet, but I know Mikael over at https://github.com/mikma/lxd-openwrt also applies a reboot patch that I assume you want

Finally, someone has written a page at the official OpenWrt site about running OpenWrt in a LXC container. I don´t know why the author claims s/he needs to map the user ID`s from the host though..

Hope this gets you going forward! For myself, I´m trying to just stick with OpenWrt on my Ubiquiti EdgeRouter X (ER-X) but I just can´t let the thought go of running OpenWrt in a container in my server to be able to make use of the massive CPU power available to push SQM at my 250 mbit internet connection :)

Good luck!
 

Di.

Member
Aug 20, 2015
3
0
21
error when I try to install (

Code:
()
  Using default stripesize 64.00 KiB.
  For thin pool auto extension activation/thin_pool_autoextend_threshold should be below 100.
  Logical volume "vm-117-disk-0" created.
  WARNING: Sum of all thin volume sizes (60.00 GiB) exceeds the size of thin pool pve/data and the amount of free space in volume group (13.87 GiB)!
mke2fs 1.43.4 (31-Jan-2017)
Discarding device blocks:    4096/2097152               done                           
Creating filesystem with 2097152 4k blocks and 524288 inodes
Filesystem UUID: 647bc538-fcdf-4c4a-91b5-277a3e8fa2d5
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables:  0/64     done                           
Writing inode tables:  0/64     done                           
Creating journal (16384 blocks): done
Multiple mount protection is enabled with update interval 5 seconds.
Writing superblocks and filesystem accounting information:  0/64     done

extracting archive '/mnt/wdblue1tb/template/cache/openwrt-19.07.0-rc2-x86-64-plain.tar.gz'
Total bytes read: 11130880 (11MiB, 83MiB/s)
Detected container architecture: amd64
  Logical volume "vm-117-disk-0" successfully removed
TASK ERROR: unable to create CT 117 - unable to detect OS distribution
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE and Proxmox Mail Gateway. We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!