OpenVPN Server failing to create config

Hi All,

First time posted, so sorry if I miss anything I should add.

I have a GL-MT2500 running kernel 5.4.211

I have been having problems with OpenVPN on it, and after poking around on the forum discovered I needed to regenerate the certs. I tried, end ended up here :

Did this is SSH : rm -rf /etc/openvpn/cert/*

Now when I click “generate configuration” in the OpenVPN Server section I get an error “-21,generate cert failed” and I can’t get any further.

I have google the error, but I am not seeing anyone else quoting it.

I am not seeing anything in the LUCI sys log relating to it, so no clues there.

I thought before I go off trying to fix it myself, it would be wise to ask here first.

Any help appreciated.


Could you please execute:
ls -lah /etc/openvpn?

This is what I got:

root@GL-MT2500:~# ls -lha /etc/openvpn
drwxr-xr-x 1 root root 3.4K Jan
1 1970 .
drwxr-xr-x 1 root root 3.4K Apr 26 01:11 …
drwxr-xr-x 1 root root 3.4K Apr 28 20:41 cert
drwxr-xr-x 2 root root 3.4K Apr 28 20:35 ovpn
drwxr-xr-x 4 root root 3.4K Jan
1 1970 profiles
drwxr-xr-x 1 root root 3.4K Apr 26 01:11 scripts
-rw-r–r-- 1 root root 986 Dec
9 2022 update-resolv-conf

OK, so lucky me, I have more than one gl-inet product. So I took a look at one that didn’t have a openvpn server setup on it yet, specifically the etc/openvpn/cert directory.

I noted the only file in there before setting up was dh1024.pem, then once the server was setup shockingly :grinning: a load of certs and keys appeared.

I check my faulty router, and the dh1024.pem was missing. Copied it across, and hey presto the setup now works. Don’t know if it has fixed the other problem yet, but at least it configures it’s self now.

Lesson reminded (not learned, I really should know better) always backup before you delete.

Hope this helps, let me know if there is anything more/different I should have done.