[Pleroma] Unable to send images

I have an error trying to send an image to my pleroma instance. If I try I get this error:

● pleroma.service - pleroma social network
  Loaded: loaded (/etc/systemd/system/pleroma.service; enabled; vendor preset: enabled)
  Active: active (running) since Sat 2020-03-07 17:45:03 CET; 11min ago
  Process: 21161 ExecStop=/var/www/pleroma/pleroma/bin/pleroma stop (code=exited, status=0/SUCCESS)
  Main PID: 22099 (beam.smp)
  Tasks: 28 (limit: 4915)
  CGroup: /system.slice/pleroma.service
       ├─22099 /var/www/pleroma/pleroma/erts-10.3.5.2/bin/beam.smp -- -root /var/www/pleroma/pleroma -progname erl -- -home /var/www/pleroma/pleroma -- -noshell -s elixir start_cli -mode embedded -setcookie ZMB1eDqcDaxM7He6IIqfNveCTIz03mDe1CbZwLs_RsgbUZrwGKdEfw== -name pleroma@127.0.0.1 -config /var/www/pleroma/pleroma/tmp/pleroma-1.1.9-20200307174503-9296.runtime -boot /var/www/pleroma/pleroma/releases/1.1.9/start -boot_var RELEASE_LIB /var/www/pleroma/pleroma/lib -extra --no-halt
       ├─22147 erl_child_setup 1024
       ├─23363 inet_gethost 4
       ├─23364 inet_gethost 4
       └─24121 /var/www/pleroma/pleroma/erts-10.3.5.2/bin/epmd -daemon

    mar 07 17:55:47 noferini.org pleroma[22099]: ** (exit) an exception was raised:
    mar 07 17:55:47 noferini.org pleroma[22099]:     ** (File.CopyError) could not copy from "/tmp/plug-1583/multipart-1583600147-764940057871059-1" to "/home/yunohost.app/pleroma/uploads/2cf9e047efee808f89e93ca2465950b2962a91b014ea3cf1034b71824469d2fa.jpg": permission denied
    mar 07 17:55:47 noferini.org pleroma[22099]:         (elixir) lib/file.ex:814: File.cp!/3
    mar 07 17:55:47 noferini.org pleroma[22099]:         (pleroma) lib/pleroma/uploaders/local.ex:27: Pleroma.Uploaders.Local.put_file/1
    mar 07 17:55:47 noferini.org pleroma[22099]:         (pleroma) lib/pleroma/uploaders/uploader.ex:48: Pleroma.Uploaders.Uploader.put_file/2
    mar 07 17:55:47 noferini.org pleroma[22099]:         (pleroma) lib/pleroma/upload.ex:65: Pleroma.Upload.store/2
    mar 07 17:55:47 noferini.org pleroma[22099]:         (pleroma) lib/pleroma/web/activity_pub/activity_pub.ex:971: Pleroma.Web.ActivityPub.ActivityPub.upload/2
    mar 07 17:55:47 noferini.org pleroma[22099]:         (pleroma) lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex:815: Pleroma.Web.MastodonAPI.MastodonAPIController.upload/2
    mar 07 17:55:47 noferini.org pleroma[22099]:         (pleroma) lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex:5: Pleroma.Web.MastodonAPI.MastodonAPIController.action/2
    mar 07 17:55:47 noferini.org pleroma[22099]:         (pleroma) lib/pleroma/web/mastodon_api/controllers/mastodon_api_controller.ex:5: Pleroma.Web.MastodonAPI.MastodonAPIController.phoenix_controller_pipeline/2

I get the same error trying to change the avatar of the user.

The directory

  /home/yunohost.app/pleroma/

have these permissions:

 ls -la /home/yunohost.app/pleroma/
 totale 16
 drwxr-xr-x 4 pleroma pleroma 4096 feb 29 17:44 .
 drwxr-xr-x 8 root    root    4096 feb 29 17:44 ..
 drwxr-xr-x 3 pleroma pleroma 4096 feb 29 17:44 static
 drwxr-xr-x 2 pleroma pleroma 4096 feb 29 17:44 uploads
1 Like

This is not a real solution but a workaround.

As reported in this comment for the bug report on github (https://github.com/YunoHost-Apps/pleroma_ynh/issues/110#issuecomment-602163230) it is sufficient to edit the file

/etc/pleroma/config.exs

the lines

config :pleroma, :instance, static_dir: "/var/www/pleroma/instance/static"
config :pleroma, Pleroma.Uploaders.Local, uploads: "/var/www/pleroma/instance/uploads"

and creating the directory

/var/www/pleroma/instance/uploads

with the user.group “pleroma.pleroma” (the directory static exists).

Now the image sending would work.

Should this not be /var/www/pleroma/instance/uploads ?

Yes, correct and corrected!

Thanks!