SWAG Docker certbot: command not found

  • I just noticed the SSL certificate for my duckdns domain is expiring tomorrow.

    I'm using SWAG, previously installed in Portainer but reinstalled as per the guide with the new Compose plugin. Currently everything works as expected, 3 subdomains get proxied to the correct containers. However after tomorrow I will lose access to Nextcloud, Homeassistant and Motioneye from the outside world.

    OMV6 and all my dockers are updated. I've been searching EVERYWHERE all day to find a solution but can not find a hint to make it work!


    How can I renew the certificate?! Any ideas what the issue might be? Above is the Swag container log output


    I opened a new thread because the other one I've been posting this issue on is marked as solved....

    • Official Post

    If you're using swag... In theory, restarting the container should also make it check your cert credentials.


    bash into your swag container. As root or sudo execute the following comand:


    Code
    docker exec -it swag bash

    you'll see the prompt change, then issue the command


    Code
    certbot-renew

    I believe as long as you are within 4 days, that will pull a new cert.


  • Code
    root@raspberrypi:/home/udo# docker exec -it swag bash
    root@2e4515103cf0:/#certbot-renew
    bash: certbot-renew: command not found
    root@2e4515103cf0:/#certbot renew
    bash: certbot: command not found
    root@2e4515103cf0:/#

    It does not know the command certbot. Above is the response I get...

    Seems to me as if the certbot portion of that container doesn't exist...

    nginx portion works fine

    • Official Post
    Code
    root@raspberrypi:/home/udo# docker exec -it swag bash
    root@2e4515103cf0:/#certbot-renew
    bash: certbot-renew: command not found
    root@2e4515103cf0:/#certbot renew
    bash: certbot: command not found
    root@2e4515103cf0:/#

    It does not know the command certbot. Above is the response I get...

    Seems to me as if the certbot portion of that container doesn't exist...

    nginx portion works fine

    Weird. Obviously it clearly works on my machine. I assume that is some difference between the Pi and 64bit versions.


    Only other thing I can suggest... If you've restarted the container (docker restart swag) and it still hasn't pulled a new cert...


    This seems a backwards way to go about this but...


    Go to your swag file.

    Change your domain to something that is intentionally wrong (like instead of your-domain.duckdns.org , change it to something-else.duckdns.org) and redeploy swag.


    Obviously, swag is going to try and pull a new cert, and it will fail and if I'm not mistaken, it will delete old certs in the process.


    Once it fails, change your domain back to it's proper name, and redeploy, that should force it to pull a new cert.


    Here, I changed my domain to "something-crazy.my-domain.xyz" (mine is routed through cloudflare, but duckdns should do the same). As you can see, it deleted my cert and tried to pull a new one... but it couldn't because I don't have that domain in my cloudflare account.



    I then went back, changed swag back to my proper domain and got a cert...



    I know it doesn't work for you, but if I bash into swag again and run certbot renew.. it shows my cert now expires in November, as if you look at last time I ran this command, it expired in October.


  • Code
    root@2e4515103cf0:/#certbot renew
    bash: certbot: command not found

    Yeah, I did that... It's the exact same response and the log shows the same thing.


    Certbot doesn't even start. The command is not known. That is the problem. It has been trying to do the renewal, but can't because (it seems to me) that certbot is not installed.

    • Official Post
    Code
    root@2e4515103cf0:/#certbot renew
    bash: certbot: command not found

    Yeah, I did that... It's the exact same response and the log shows the same thing.


    Certbot doesn't even start. The command is not known. That is the problem. It has been trying to do the renewal, but can't because (it seems to me) that certbot is not installed.

    Hmm, I don't really see how that's possible, since certbot is built into the swag container.


    Can you post your swag compose/stack...


    Obviously delete your domain, email, token, etc.

    • Official Post

    I would probably ask this on the linuxserver forum, and see if they have a suggestion. Several of the linuxserver devs hang out there.


    LSIO Discussion
    A category for discussion about everything <a href="https://linuxserver.io">LinuxServer.io</a> - support, news, container requests and feedback we have it all…
    discourse.linuxserver.io

  • I searched that linuxserver forum as well. Haven't posted anything, because I had to sign up and figure that one out...

    I'm about to completely delete the Swag container including volumes and everything and see if I can start from scratch.

    • Official Post

    I searched that linuxserver forum as well. Haven't posted anything, because I had to sign up and figure that one out...

    I'm about to completely delete the Swag container including volumes and everything and see if I can start from scratch.

    Yeah.. kinda sucks but that is probably what I would do.. I don't use SBC's but I consider myself pretty adept at solving swag problems, as I've done so quite a few times... but I've never seen swag just not install certbot (even on the folks I've helped who were using Pi's, etc.).


    Wish I had a better answer for you.

  • OMG! That did the trick!


    So I deleted the swag container, removed the volume with all data and then reinstalled swag with all the same settings. The container immediately downloaded a new certificate!


    Obviously after all that I had to re-write the subdomain.conf files. To reconnect the containers and now everything is up and running again!


    Thank you again for your time!

  • UKnau22

    Added the Label resolved

Participate now!

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