Page MenuHomeDevCentral

Can't upload pictures on Mastodon: permission error to create a directory
Closed, ResolvedPublic

Description

[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: file -b --mime '/tmp/06cc9b024bef9b15f63577235487f17f20170523-21-1nfe2c6.png'
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/06cc9b024bef9b15f63577235487f17f20170523-21-kcyr60.png[0]'
 2>/dev/null
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: identify -format %m '/tmp/06cc9b024bef9b15f63577235487f17f20170523-21-kcyr60.png[0]'
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: convert '/tmp/06cc9b024bef9b15f63577235487f17f20170523-21-kcyr60.png[0]' -auto-orient -resize "1280x1280>" -q
uality 90 -strip '/tmp/30405db2a37893acd4e8bfa6d78e849520170523-21-1nfo834'
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/f97d41565387647a58883f6680dc79e720170523-21-1j9nely[0]' 2>
/dev/null
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: identify -format %m '/tmp/f97d41565387647a58883f6680dc79e720170523-21-1j9nely[0]'
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: convert '/tmp/f97d41565387647a58883f6680dc79e720170523-21-1j9nely[0]' -auto-orient -resize "400x400>" -quality 90 -strip '/tmp/1c02f66cb1646242ed172e19c28dff0a20170523-21-f4yes9'
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: file -b --mime '/tmp/06cc9b024bef9b15f63577235487f17f20170523-21-5b5is4.png'
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/f97d41565387647a58883f6680dc79e720170523-21-1j9nely[0]' 2>
/dev/null
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/4bc7ed354e80d39cf75b4107a181de3f20170523-21-1r5n7bc[0]' 2>
/dev/null
[3b9c641c-974d-4b2f-8682-178de1a95ca4] method=POST path=/api/v1/media format=html controller=Api::V1::MediaController action=create status=500 error='Errno::EA
CCES: Permission denied @ dir_s_mkdir - /mastodon/public/system/media_attachments/files/000/032/696' duration=299.05 view=0.00 db=10.44
[3b9c641c-974d-4b2f-8682-178de1a95ca4]
[3b9c641c-974d-4b2f-8682-178de1a95ca4] Errno::EACCES (Permission denied @ dir_s_mkdir - /mastodon/public/system/media_attachments/files/000/032/696):
[3b9c641c-974d-4b2f-8682-178de1a95ca4]  
[3b9c641c-974d-4b2f-8682-178de1a95ca4] app/controllers/api/v1/media_controller.rb:13:in `create'

Event Timeline

Could be a SELinux issue, as the same time in the main logs:

May 23 20:10:43 dwellers.nasqueron.org kernel: SELinux: initialized (dev tmpfs, type tmpfs), uses mountpoint labeling
May 23 20:10:43 dwellers.nasqueron.org kernel: SELinux: mount invalid.  Same superblock, different security settings for (dev mqueue, type mqueue)

I switched the SELinux configuration to Permissive, so we'll get logs, and we'll be apply to apply sand_virt_t SELinux policy to the directories to manage by the container.

dereckson renamed this task from Can't upload pictures on Mastodon: to Can't upload pictures on Mastodon: permission error to mkdir.May 23 2017, 18:38
dereckson renamed this task from Can't upload pictures on Mastodon: permission error to mkdir to Can't upload pictures on Mastodon: permission error to create a directory.

It's easier than that: in most recent Mastodon version, the process runs under a Mastodon user, so it now needs to own the /mastodon/public directory.

mastodon_web_1 contaienr
$ chown -R mastodon system