Failed to initialize new repository on webdav storage

Duplicacy failed to initialize new repository on webdav storage (previous repository connected to the storage via sftp)

$ duplicacy init -erasure-coding 5:2 images webdav://nobodyxu@<server>/data/
Enter the WebDAV password:************
URL request 'MKCOL snapshots' returned status code 409
URL request 'MKCOL snapshots' returned status code 409
URL request 'MKCOL snapshots' returned status code 409

data/ is an already initialized duplicacy storage:

chunks/  config  snapshots/

What webdav implementation is the server running?

The webdav implementation is nginx 1.14.2-2+deb10u3 and it is installed using apt.

The system I am using is debian buster.

It also have ngx_http_dav_ext_module.so enabled.

Hi, I also found the error generated from nginx, which might be useful to debugging this problem:

2021/03/18 13:33:59 [error] 8700#8700: *1244 MKCOL can create a collection only, client: ****, server: ****, request: "MKCOL /data/snapshots HTTP/1.1", host: "****"
2021/03/18 13:34:00 [error] 8700#8700: *1244 MKCOL can create a collection only, client: ****, server: ****, request: "MKCOL /data/snapshots HTTP/1.1", host: "****"
2021/03/18 13:34:01 [error] 8700#8700: *1244 MKCOL can create a collection only, client: ****, server: ****, request: "MKCOL /data/snapshots HTTP/1.1", host: "****"

The access log is just normal:

**** - nobodyxu [18/Mar/2021:13:33:59 +0100] "MKCOL /data/snapshots HTTP/1.1" 409 167 "-" "Go-http-client/1.1"
**** - nobodyxu [18/Mar/2021:13:34:00 +0100] "MKCOL /data/snapshots HTTP/1.1" 409 167 "-" "Go-http-client/1.1"
**** - nobodyxu [18/Mar/2021:13:34:01 +0100] "MKCOL /data/snapshots HTTP/1.1" 409 167 "-" "Go-http-client/1.1"

I further investigated the error, and discovered stack overflow post and github issues for go software that might help you fix the bug:

TL;DR:

The MKCOL may succeed without the trailing slash, but notice that the resource reported created has a trailing slash.

The server has an option, according to the RFC. Since it determines the URL normalization procedure as long as it doesn’t violate the spec.

The server then can either try to normalize ever URL you send it’s way on every operation, returning lots of 3xx codes. This gets expensive. Or it can correct you in the beginning ( POST, MKCOL, etc. ) then fail or redirect after that.

But the key point is that it will always let you know the URL it prefers.

Omitting trailing slash at least with Nginx leads to “MKCOL can create a
collection only” error.

In this case the storage has been initialized and all subdirectories should already be there, so a simple fix is to ignore this 409 error.

However, I wonder if the same error occurs with a new storage. Can you do me a favor and try creating a new webdav storage?

$ duplicacy init -erasure-coding 5:2 images webdav://****@****/data2/
Enter the WebDAV password:****
URL request 'MKCOL snapshots' returned status code 409
URL request 'MKCOL snapshots' returned status code 409

/var/log/nginx/access.log:

**** - nobodyxu [19/Mar/2021:02:50:21 +0100] "PROPFIND /data2/ HTTP/1.1" 207 272 "-" "Go-http-client/1.1"
**** - nobodyxu [19/Mar/2021:02:50:22 +0100] "MKCOL /data2/snapshots HTTP/1.1" 409 167 "-" "Go-http-client/1.1"
**** - nobodyxu [19/Mar/2021:02:50:23 +0100] "MKCOL /data2/snapshots HTTP/1.1" 409 167 "-" "Go-http-client/1.1"

/var/log/nginx/error.log:

2021/03/19 02:50:22 [error] 8700#8700: *1369 MKCOL can create a collection only, client: ****, server: ****, request: "MKCOL /data2/snapshots HTTP/1.1", host: "****"
2021/03/19 02:50:23 [error] 8700#8700: *1369 MKCOL can create a collection only, client: ****, server: ****, request: "MKCOL /data2/snapshots HTTP/1.1", host: "****"

Nginx shows the completely same error as before,

Hi gchen

Can you spend some time fix this problem?

It is stopping me from backing up my data to my webdav server.

I’m also running local webdav on debian.
I found lighttpd’s implementation better than nginx’s.

Is there a good reason you’re not running SFTP?
In my case it’s because the server is a very CPU-limited ARM board.

You can test your installation for compliance with litmus:

sudo apt install litmus
litmus http://<LAN IP>/<folder> <username> <password>

This is a good setup guide with one caveat - the default lighttpd-mod-webdav isn’t compatible with Duplicacy. Install the most recent version instead:

sudo apt install lighttpd-mod-webdav/buster-backports

I tried webdav because the upload speed is very unstable and degrades seriously according to time, which I suspected might be because my ISP prioritises HTTP over SSH, so I’d like to try webdav.

However, as GChen has pointed out somewhere else (forgot the link), there’s another solution that’s more mature called minios, which can be easily setup and is more mature and maintained.

So I ended up taking his advice and uses minios instead.

1 Like