SensorsIot / IOTstack

Docker stack for getting started on IOT on the Raspberry PI
GNU General Public License v3.0
1.44k stars 304 forks source link

WireGuard stops working #610

Open Paraphraser opened 1 year ago

Paraphraser commented 1 year ago

If your remote clients have trouble connecting, try running:

$ docker logs wireguard

If you see the following messages being repeated endlessly:

s6-supervise custom-svc-README.txt (child): fatal: unable to exec run: Exec format error
s6-supervise custom-svc-README.txt: warning: unable to spawn ./run - waiting 10 seconds

then help is at hand. This problem appears to be an unintended side-effect of WireGuard's maintainers deciding to adopt a different directory structure inside the container.

IOTstack Pull Request #607 adopts the new directory structure but that will only help IOTstack users who implement WireGuard for the first time after that Pull Request has been applied.

If you use WireGuard and your remote clients can still connect then you need do nothing until Pull Request #607 is applied. The PR provides a script to assist with the migration, and also adds a section to the IOTstack Wiki explaining how to use it. Even then, the timing will be up to you.

However, if you are having problems now, you can proceed like this:

  1. Download the migration script:

    $ cd ~/IOTstack
    $ curl https://raw.githubusercontent.com/SensorsIot/IOTstack/24b6917e0b0809b3f551b2c46dc372eef01cba62/scripts/2022-10-01-wireguard-restructure.sh >2022-10-01-wireguard-restructure.sh
  2. Stop WireGuard:

    $ docker-compose rm --force --stop -v wireguard
  3. Run the migration script:

    $ ./2022-10-01-wireguard-restructure.sh

    If successful, the script explains how to edit your docker-compose.yml to update WireGuard's service definition.

  4. Start WireGuard:

    $ docker-compose up -d
    $ docker logs wireguard
  5. Test that your remote clients can connect.

  6. Clean up:

    $ sudo rm -rf ./volumes/wireguard.bak
    $ rm 2022-10-01-wireguard-restructure.sh

    The usual "double-check before hitting return when using sudo" applies!!

  7. Be aware that, until Pull Request #607 is applied, the IOTstack menu and/or override processes may revert your WireGuard service definition to its pre-migration form. If that happens, you will have a mess to sort out. As a precaution, it would be a good idea to make sure you have a backup of a known-good post-migration configuration. At the very least you should snapshot:

    ~/IOTstack/docker-compose.yml
    ~/IOTstack/volumes/wireguard