11

I did a fresh install of Ubuntu 20.04 today. I got as far as setting up my vim environment which installs plug.vim using curl when I hit a speed bump.

Error creating directory /home/simon/.vim/autoload.
curl: (23) Failed writing received data to disk/application

The relevant lines in the .vimrc are:

" Auto-install plugin manager if it doesnt exist (and PlugInstall)
if empty(glob('~/.vim/autoload/plug.vim'))
    silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
        \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    autocmd VimEnter * PlugInstall | source $MYVIMRC
endif

Trying to isolate the problem, it seems like I can't use a path with a dot file in it as an output for curl.

eg. This fails:

➜  ~ curl -fLo ~/.test_dot_folder/test.py --create-dirs example.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0Warning: Failed to create the file /home/simon/.test_dot_folder/test.py: No 
Warning: such file or directory
100  1256  100  1256    0     0   2800      0 --:--:-- --:--:-- --:--:--  2803
curl: (23) Failure writing output to destination

But this works:

➜  ~ curl -fLo ~/test_dot_folder/test.py --create-dirs example.com
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1256  100  1256    0     0   2659      0 --:--:-- --:--:-- --:--:--  2661
➜  ~ 

The only difference is the . in front of the folder. Even when I do

mkdir .test_dot_folder

and then run the first curl command, it still fails.

If you're wondering about permissions in the directory:

Here's what happens when I run @waltinator's pathlld script on my home directory.

➜  ~ sudo code/pathlld.sh -v .

drwxr-xr-x 22 simon simon 4096 Aug 7 20:15 . /dev/nvme0n1p5 on / type ext4 (rw,relatime,errors=remount-ro)

Any suggestions as to what's going wrong?

Teg Veece
  • 111
  • 1
  • 1
  • 4

1 Answers1

16

Weirdly and coincidentally I had exactly the same problem as you. Not only with curl, but with Vim and Plug at the same time. Small world.

My guess to fix this was that it was a problem with the curl that I was using.

I had installed curl from the snap store:

sudo snap install curl

I then got the same error message as you:

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
Error creating directory /home/ian/.vim/autoload.
curl: (23) Failed writing received data to disk/application

My fix was to remove the snap curl and install the basic apt curl:

$ sudo snap remove curl
$ sudo apt install curl

and voila...

$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs     https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 82784  100 82784    0     0   612k      0 --:--:-- --:--:-- --:--:--  612k
icc97
  • 761