Forum archive
TKL 16.x - Webmin not working in LXC containers
I'm setting up a small Proxmox cluster, and had intended to deploy several TKL appliances on it, however I've run into an issue with Webmin.
I've done some troubleshooting, and narrowed the issue down to systemd, presumably the unit file.
If launched by systemd, it'll run for a few seconds before dying, then relaunch, then rinse and repeat.
If executed manually (/usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf), it'll run just fine and continue to work.
Almost all of my testing was with TKL Core, but I did also test the LAMP template to make sure it wasn't isolated to Core.
I fired up a full VM running Core, and Webmin worked perfectly there, so it appears to be specific to LXC containers.
I'm using unprivileged containers - I quickly tested it in a privileged container, and it was broken there as well (albeit in a different manner), but from what I gather, v16 appliances shouldn't work properly in privileged containers anyway.
Unfortunately there was zero helpful information in either the webmin logs or syslog, however it is trivial to replicate, so you shouldn't have much trouble gathering further info if needed.
root@lamptest ~# ps aux | grep miniserv
root 4110 0.0 0.1 3080 664 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4116 0.0 2.4 22508 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4118 0.0 0.1 3212 736 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4116 0.0 2.4 22508 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4125 0.0 0.1 3212 680 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4116 0.0 2.4 22508 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4132 0.0 0.1 3212 740 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4116 0.0 2.4 22508 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4139 0.0 0.1 3212 732 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4116 0.0 2.4 22508 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4146 0.0 0.1 3212 700 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4116 0.0 2.4 22508 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4153 0.0 0.1 3212 736 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4161 0.0 0.1 3080 728 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4168 0.0 0.1 3080 732 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4175 0.0 0.1 3080 732 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4181 0.0 1.4 14572 7408 ? Rs 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4183 0.0 0.1 3080 740 pts/0 R+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4181 0.0 2.4 22516 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4190 0.0 0.1 3212 736 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4181 0.0 2.4 22516 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4197 0.0 0.1 3212 700 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4181 0.0 2.4 22516 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4204 0.0 0.1 3212 664 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4181 0.0 2.4 22516 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4211 0.0 0.1 3212 700 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4181 0.0 2.4 22516 12788 ? Ss 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4218 0.0 0.1 3212 664 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4181 0.0 4.1 28940 21792 ? Rs 01:24 0:00 /usr/bin/perl /usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf
root 4225 0.0 0.1 3080 664 pts/0 R+ 01:24 0:00 grep --color=auto miniserv
root@lamptest ~# ps aux | grep miniserv
root 4233 0.0 0.1 3080 664 pts/0 S+ 01:24 0:00 grep --color=auto miniserv
Thanks for your report. I use LXC lots myself, but I don't use Webmin. I did the Webmin service development and testing on a Core VM. Although, I did test on my local Proxmox too. I just tested it again on my Proxmox server and Core at least seemed to work ok?!
However, I'm still using Proxmox v5.4.x (I know I need to upgrade...). I assume that you are on v6.x? So perhaps the differences in the host have an impact?
Also, after your prompting, I looked at webmin entries from the journal (i.e. 'journalctl -u webmin'). I notice, that whilst it seems to be running fine now (I just logged in and browsed around), it did restart numerous times (5 to be precise), which I have no explanation for?! See here:
It shoudl restart at least once (when the SSL certs are generated) and it's not unreasonable for it to restart a second time, but 5 seems excessive. But it's weird that it eventually settles down... I'm not sure if it is a factor, but FTR my container has 2 cores (@2.4Ghz) and 2GB RAM allocated.
We supply the systemd service file for Webmin in v16.0. Previously we provided an old style SysVInit script (i.e. a /etc/init.d/ script). systemd has a backwards compatible generator mode which will generate a service file from an init.d script on the fly. That works fine, but I thought it'd be neater to actually provide a proper service file.
Part of my rational was that I split the stunnel config up so the webmin stunnel service is now completely separate to the webshell (aka shellinabox) stunnel service. In theory it should work fine with the dynamically generated service file, but my experience was that wasn't the case. FWIW the rational behind splitting the stunnel services is that it would make it easier to disable one, without affecting the other. I haven't got there yet, but I hope to add a confconsole plugin to disable/enable these. But I digress...
Anyway, at some point during development, I did notice that at times, Webmin wouldn't be running at boot (TBH, I'm still not sure why that was/is) but restarting it worked fine. I did put a little time into trying to work out why it wasn't always running at boot, but couldn't see why, hence why I added the auto restart bit to the service file. That seemed to resolve it ok, but it seems not under LXC?!
I wonder why the behaviours is so different under LXC? FWIW, you can see that the service calls "/usr/share/webmin/miniserv.pl /etc/webmin/miniserv.conf" - the same command that you note works fine outside of a service?!
I don't recall exactly why I changed it, but the service file I initially created (last year) was quite different to what we have now. So perhaps that's worth trying? Another option would be to delete the current webmin.service file altogether and let it revert to the old behaviour of generating one. Although I'm not sure how that might impact the stunnel service?
Actually, another thought is that perhaps the stunnel service is a factor in all this. IIRC there is some dependency relationship between the stunnel service (stunnel4@webmin.service) and Webmin (and webshell too, with it's associated stunnel service).
I'd be really interested to hear how you go with your investigations and would warmly welcome a better set up. I'd be more than happy to include it in the package, or if it's only relevant ot LXC, then just implement it for LXC builds.
Also FWIW, the systemd docs are pretty reasonable (although things don't always seem ot work as I expected and I did lots of trial and error). StackExchange sites are also pretty good IMO.
You can find the webmin.service file here: /usr/lib/systemd/system/webmin.service and if you modify it, before you can test it, you need to run daemon-reload. E.g..: