Caddy V2 - Upgraded from V1 issue

1. Caddy version (caddy version):

v2

2. How I run Caddy:

Google VPS

a. System environment:

ubuntu 18.04

b. Command:

paste command here

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

paste config here, replacing this text
DO NOT REDACT anything except credentials

3. The problem I’m having:

I installed caddy v2 over the top of v1 and when I do “caddy version” I get the following error;
“args:2 - Error during parsing: Unknown directive ‘version’”

When I do “caddy -version” it returns v1.0.4. It’s as though something hasn’t overwrote after installing v2.

I could not find any info what so ever on how to remove version 1 properly.

4. Error messages and/or full log output:

5. What I already tried:

Rebooting
Installing V2 again

6. Links to relevant resources:

Hi zen262176! Welcome around

How did you install v2? Where did you place the executable? Also, please run this command report the result:
$ which caddy

1 Like

Hello,

I installed V2 via the following command line; (As per instructions on the caddy website);
"https://caddyserver.com/docs/download"

echo "deb [trusted=yes] https://apt.fury.io/caddy/ /" \ | sudo tee -a /etc/apt/sources.list.d/caddy-fury.list
sudo apt update
sudo apt install caddy

It was all automatic so I never required to place the executable anywhere. This is the output of;
"which caddy";

/usr/local/bin/caddy

Thank you.

Thank you. So the apt pkg installs the binary in /usr/bin, but you have the old caddy placed in /usr/local/bin/caddy. If you run echo $PATH you’ll see /usr/local/bin somewhere to the left of /usr/bin. This means when you run the command caddy, the OS will search for the executable through the directories listed in $PATH from left to right, and will find it in /usr/local/bin (which is v1) before it finds the one in /usr/bin (which is v2).

If your “installation” of v1 was using getcaddy.com or manually placing the executable in /usr/local/bin, then resolving this should be as simple as removing the /usr/local/bin/caddy executable.

Also don’t forget to update your config!

2 Likes

I removed the executable from "/usr/local/bin/caddy" then "sudo systemctl restart caddy". I then did a "which caddy" and got "/usr/bin/caddy". I then did "caddy version" and got "-bash: /usr/local/bin/caddy: No such file or directory".

I made a backup so can replace back if required. :slightly_smiling_face:

ah it’s resolved! I just rebooted the server, it must have been linking the file somewhere but a reboot has cleared that up.

When I do "caddy version" now; it returns;
v2.0.0 h1:pQSaIJGFluFvu8KDGDODV8u4/QRED/OPyIR+MWYYse8=

Absolutely perfect, it’s resolved it by your method. Thank you for replying so fast.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.