OpenVPN plugin is faulty after modification

  • Hi,
    The latest version of the OpenVPN plugin (4.0.2) cannot be enabled.
    The following error always stops enabling:




    Code
    Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C.UTF-8; omv-mkconf openvpn setup 2>&1' with exit code '1': mkdir: cannot create directory ‘/etc/openvpn/pki’: No such file or directory

    Please, fix it. The previous version (4.0.1) had no such problem.
    Thanks.

    • Official Post

    Please, fix it. The previous version (4.0.1) had no such problem.

    You can rollback to 4.0.1 (apt-get install openmediavault-openvpn=4.0.1) until it is fixed but 4.0.2 fixed other people's problems. Since there is no maintainer of this plugin, I don't know what the right answer is.

    omv 7.4.0-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.1 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • The change in the plugin has nothing to do with your error, the change itself is just one more line of text inside the config file, unless something else changed that is not the issue.


    From that log you posted


    'mkdir: cannot create directory ‘/etc/openvpn/pki’: No such file or directory'


    This sound more like a permission problem, are you on a raspberry pi, I see a lot of google results of people having write problems on them when it comes to openvpn?


    Does the parent /etc/openvpn folder present on your server.


    Configuring and pressing save multiple times, I tested the new version both on test server and my live server no issues.



    • Official Post

    What you suggested I made the command. The error message is the same.
    How do I remove the installed version completely? (4.0.2)

    If you executed the command I suggested, you don't have 4.0.2 installed anymore.

    omv 7.4.0-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.1 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • I've made some OMV installations and now I know what's wrong with the plugin. (Normal PC based computer (HP Micro server), not a single board computer.)
    The plugin creates /etc/openvpn folder at the first installation and creates the /pki folder at enabling.
    Once the plugin is removed, will not create the /etc/openvpn folder next time when you reinstall it.
    If the folder is missing, plugin does not warn you and in this way it is not able to create the pki folder at enabling.
    Then we get that error message. This is not caused by version 4.0.2, indeed.


    The previous version is the same and this is why installing did not help.


    If I manually create /etc/openvpn folder, the plugin can be installed again without any problems.


  • Hmm, interesting, I will try to see if I can replicate this, If I can I may be able to make a fix for it, no promises.

  • You can easily replace this if after uninstalled plugin delete /etc/openvpn folder.

    Took me a while to understand what is going on but no it is not that.


    So after thinking quite a bit on this one I realised one thing that if you install the plugin for the first time everything will be fine, and if you delete the folder /etc/openvpn it will create problems, no matter how many times you uninstall and reinstall the plugin, and the reason behind all of this is quite simple.


    In the control file of the package you can see



    Code
    Depends: openmediavault (>= 4.0.12),
             openvpn,

    So on your first install it tells the system to install openvpn which in terms creates the /etc/openvpn folder


    When you uninstall the plugin the openvpn service will still be installed on your server so when you reinstall the plugin it skips the reinstall so if you delete that folder manually or some other way than you will get the error you got.


    Easy to replicate:
    - clean omv install
    - install plugin openvpn
    - uninstall plugin
    - remove /etc/openvpn
    - reinstall plugin openvpn
    - try to make and save a config
    - error thrown when you click apply "mkdir: cannot create directory ‘/etc/openvpn/pki"



    Fix:
    Add apt-get remove openvpn on postrm script when you remove the plugin you also remove openvpn service.


    @ryecoaaron I created a PR for this.

    • Official Post

    When you uninstall the plugin the openvpn service will still be installed on your server

    Not quite. If package A installs package B because it is a dependency in the control file, package B will be uninstall when package A is uninstalled UNLESS package B is a dependency of another package installed since package A was installed. Hope that makes sense.

    Add apt-get remove openvpn on postrm script when you remove the plugin you also remove openvpn service.


    @ryecoaaron I created a PR for this.

    You can't do this. I commented on the PR.

    omv 7.4.0-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.1 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Not quite. If package A installs package B because it is a dependency in the control file, package B will be uninstall when package A is uninstalled UNLESS package B is a dependency of another package installed since package A was installed. Hope that makes sense.

    You can't do this. I commented on the PR.

    Noted, cancelled the PR.


    I get the logic but still does not explain on a clean install of omv, removing the plugin keeps the openvpn service installed and running

    • Official Post

    I get the logic but still does not explain on a clean install of omv, removing the plugin keeps the openvpn service installed and running

    Unfortunately, this is a small problem with apt/dpkg. collectd-core is installed with omv. If you look at the dependencies of collectd-core, it "suggests' openvpn. So, this is enough for it to not be removed when the plugin is removed. I don't know of a way to fix this in the plugin.

    omv 7.4.0-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.1 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • Symptom:
    - clean omv install
    - install plugin openvpn first time
    - plugin creats /etc/openvpn folder
    - enable plugin
    - creates /openvpn/pki subfolder to store settings
    - uninstall plugin
    - remove /etc/openvpn (by user or other program)
    - reinstall plugin openvpn
    - plugin does not create /etc/openvpn folder
    - does not notify user - no message
    - enable plugin
    - error thrown when you click apply "mkdir: cannot create directory ‘/etc/openvpn/pki"
    - tries to create the pki subfolder, but it is unable to (openvpn folder is missing)


    Solution I think:
    - to create /etc/openvpn folder by user -> I did this and Openvpn works fine again. But this is not a real solution.
    - to delete info that shows for plugin this is not the first installation.
    So plugin creates the folder again if it is missing.

    • Official Post

    Change this line to a mkdir -p would fix the directory creation issue.

    omv 7.4.0-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.1 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Official Post

    But I think you need to fix the plugin in a new version.

    Just a warning... I will add it but I am definitely not the maintainer of this plugin (there is no one). So, it will go away with OMV 5. Personally, I think people should start moving toward using wireguard in a docker...



    Edit - 4.0.3 is in the repo now

    omv 7.4.0-1 sandworm | 64 bit | 6.8 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.14 | compose 7.2.1 | k8s 7.2.0-1 | cputemp 7.0.2 | mergerfs 7.0.5 | scripts 7.0.8


    omv-extras.org plugins source code and issue tracker - github - changelogs


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    Edited once, last by ryecoaaron ().

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!