Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picture not available when posting #211

Closed
ashemsay opened this issue Apr 21, 2023 · 39 comments · Fixed by #224
Closed

Picture not available when posting #211

ashemsay opened this issue Apr 21, 2023 · 39 comments · Fixed by #224

Comments

@ashemsay
Copy link

ashemsay commented Apr 21, 2023

Describe the bug

When posting, the picture isn't displayed, , after selecting the picture, on the page where I should enter the caption, in place of the picture I have borken image link icon and if I proceed with the post, I have a "No preview available" as picture

Context

  • Hardware: VM on dedictated server
  • YunoHost version: 11.1.18
  • I have access to my server: Through SSH + through the webadmin + direct access via keyboard / screen
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: I have had this yunohost server since version 2.x, it has been migrated to new hardware twice. I never had to tweak anything in pixelfed though
  • Using, or trying to install package version/branch: 0.11.5~ynh1

Steps to reproduce

I use the french version so my translations might not be perfect

  1. Go to 'New post'
  2. Select picture
  3. Enter caption (here I have a broken image link Icon in place of the picture)
    Screenshot from 2023-04-21 22-44-54
  4. Click "Post"
  5. Now instead of the picture I chose, I have a "No preview available" picture
    Screenshot from 2023-04-21 22-45-22_masked

Expected behavior

I can publish new post with working picture.

Logs

In nginx logs I can see after having selected the picture:

==> /var/log/nginx/pixelfed.domain.tld-error.log <==
2023/04/21 22:53:41 [crit] 1415#1415: *3120 stat() "/var/www/pixelfed/public/storage/m/_v2/251479588738306048/9e2db7367-e375b7/6QnD4lY8C5gG/zwxT6aM3CPi2zCXZNa5q9TPQmQVBGmtZKa6l5axo.jpg" failed (13: Permission denied), client: 82.65.39.45, server: pixelfed.domain.tld, request: "GET /storage/m/_v2/251479588738306048/9e2db7367-e375b7/6QnD4lY8C5gG/zwxT6aM3CPi2zCXZNa5q9TPQmQVBGmtZKa6l5axo.jpg?v=1682110420 HTTP/2.0", host: "pixelfed.domain.tld", referrer: "https://pixelfed.domain.tld/i/web/compose"
2023/04/21 22:53:41 [crit] 1415#1415: *3120 stat() "/var/www/pixelfed/public/storage/m/_v2/251479588738306048/9e2db7367-e375b7/6QnD4lY8C5gG/zwxT6aM3CPi2zCXZNa5q9TPQmQVBGmtZKa6l5axo.jpg" failed (13: Permission denied), client: 82.65.39.45, server: pixelfed.domain.tld, request: "GET /storage/m/_v2/251479588738306048/9e2db7367-e375b7/6QnD4lY8C5gG/zwxT6aM3CPi2zCXZNa5q9TPQmQVBGmtZKa6l5axo.jpg?v=1682110420 HTTP/2.0", host: "pixelfed.domain.tld", referrer: "https://pixelfed.domain.tld/i/web/compose"

Permissions on the file are set as such:

namei -om /var/www/pixelfed/public/storage/m/_v2/251479588738306048/9e2db7367-e375b7/6QnD4lY8C5gG/zwxT6aM3CPi2zCXZNa5q9TPQmQVBGmtZKa6l5axo.jpg
f: /var/www/pixelfed/public/storage/m/_v2/251479588738306048/9e2db7367-e375b7/6QnD4lY8C5gG/zwxT6aM3CPi2zCXZNa5q9TPQmQVBGmtZKa6l5axo.jpg
 drwxr-xr-x root     root     /
 drwxr-xr-x root     root     var
 drwxr-xr-x root     root     www
 drwxr-x--- pixelfed www-data pixelfed
 drwxrwx--- pixelfed www-data public
 lrwxrwxrwx pixelfed www-data storage -> /var/www/pixelfed/storage/app/public
   drwxr-xr-x root     root     /
   drwxr-xr-x root     root     var
   drwxr-xr-x root     root     www
   drwxr-x--- pixelfed www-data pixelfed
   drwxrwx--- pixelfed www-data storage
   drwxrwx--- pixelfed www-data app
   drwxrwx--- pixelfed www-data public
 drwxrwx--- pixelfed www-data m
 drwxrwx--- pixelfed www-data _v2
 drwxrwx--- pixelfed www-data 251479588738306048
 drwxrwx--- pixelfed www-data 9e2db7367-e375b7
 drwx------ pixelfed pixelfed 6QnD4lY8C5gG
 -rw-r--r-- pixelfed pixelfed zwxT6aM3CPi2zCXZNa5q9TPQmQVBGmtZKa6l5axo.jpg

PS: I tried changing permissions on the file but it does not change anything, tried forcing owner to pixelfed:www-data as well but it dit not work and any new upload is still owned by pixelfed:pixelfed

@lapineige
Copy link
Member

Please try this branch : #210

@ashemsay
Copy link
Author

ashemsay commented Apr 22, 2023

Hello, thank for the quick answer.
I tried it (checked out the repository on the given commit to /tmp/pixelfed_ynh then did yunohost app upgrade pixelfed -f /tmp/pixelfed_ynh -F), nothing changed, same error in the logs, same result on the app

@lapineige
Copy link
Member

lapineige commented Apr 23, 2023

I didn't know about this method 🤔
Why not simply yunohost app upgrade pixelfed -u https://github.com/YunoHost-Apps/pixelfed_ynh/tree/testing ?

Can you confirm you're using app version 0.11.5~ynh3 now ?

@ashemsay
Copy link
Author

Yeah I wasn't sure about how to do it, tried your way, can confirm yunohost app info pixelfed shows version: 0.11.5~ynh3 but sadly, that did not fix the issue.

@mitexleo
Copy link

Yeah I wasn't sure about how to do it, tried your way, can confirm yunohost app info pixelfed shows version: 0.11.5~ynh3 but sadly, that did not fix the issue.

Could you please give me your instance url and diagnostics ?

@ashemsay
Copy link
Author

I replicated the issue on my test instance, same error logs, https://pixelfed.services.coupou.fr
How can I get diagnostics?

@lapineige
Copy link
Member

Here : https://pixelfed.services.coupou.fr/i/admin/diagnostics/home
You can copy it.

Be aware that it might contains information that you don't wanna share about your instance (config). Mainly domain name, which is already shared.

I guess @neonota want to know if PF_OPTIMIZE_IMAGES is set to true or false ?

@ashemsay
Copy link
Author

Here : https://pixelfed.services.coupou.fr/i/admin/diagnostics/home You can copy it.

Be aware that it might contains information that you don't wanna share about your instance (config). Mainly domain name, which is already shared.

I guess @neonota want to know if PF_OPTIMIZE_IMAGES is set to true or false ?

I get redirected to https://pixelfed.services.coupou.fr/i/web

@lapineige
Copy link
Member

It's in your admin interface, in Diagnosis tab.

@ashemsay
Copy link
Author

Can't find it yet, I'll try again tonight, going for a long drive for now.

@mitexleo
Copy link

mitexleo commented Apr 23, 2023

Can't find it yet, I'll try again tonight, going for a long drive for now.

You problem is same as @lapineige. Take a look at : pixelfed/pixelfed#4275 (comment)

I've provided the correct config. It should resolve this issue permanently. Also don't forget to set umask value to 0002

@mitexleo
Copy link

Can't find it yet, I'll try again tonight, going for a long drive for now.

Here's the link to Diagnostics page : https://yourserver.com/i/admin/diagnostics/home

@lapineige
Copy link
Member

Also don't forget to set umask value to 0021

What's that ?

@mitexleo
Copy link

Also don't forget to set umask value to 0021

What's that ?

If you set umask value to 0002 , all new dirs will be created with 775 and files would be created with 664 permissions.

@ashemsay
Copy link
Author

Here it is:

=======================
 Pixelfed Instance Diagnostic v0.2 
=======================
Troubleshooting

Bootstrap: Writable ✅
Storage: Writable ✅
DATABASE Ping: Pong! Connected to DB "pixelfed" ✅
REDIS Ping: Pong! Connected to Redis ✅
ACTIVITYPUB instance actor created: ✅ true
ACTIVITYPUB instance actor cached: ❌ false
OAUTH enabled: ✅ true
OAUTH token_expiration 365 days
OAUTH public key exists: ✅ true
OAUTH private key exists: ✅ true

Important Information

Version: 0.11.5-unknown git commit
Database: pgsql (13.9)
APP_URL: https://pixelfed.services.coupou.fr
APP_DOMAIN: pixelfed.services.coupou.fr
ADMIN_DOMAIN: pixelfed.services.coupou.fr
SESSION_DOMAIN: pixelfed.services.coupou.fr

PHP Variables

PHP: 8.1.18
PHP INI memory_limit: 128M
PHP INI post_max_size: 50M
PHP INI upload_max_filesize: 50M
PHP INI max_file_uploads: 20
PHP INI max_execution_time: 30
PHP INI max_input_time: 60
PHP INI file_uploads (On): 1
PHP INI - SECURITY allow_url_fopen (true): 1
PHP INI - SECURITY allow_url_include (false):
PHP INI - SECURITY expose_php (false):
PHP INI - SECURITY display_errors (false): Off
PHP INI - SECURITY display_startup_errors (false):
PHP INI - SECURITY log_errors (true): 1
PHP INI - SECURITY ignore_repeated_errors (false):
PHP INI - SECURITY disable_functions:

Pixelfed Variables (No Secrets)

CONFIG	VARIABLE NAME	DETAILS
APP	APP_NAME	"pixelfed"
APP	APP_ENV	"production"
APP	APP_DEBUG	❌ false
APP	APP_URL	"https://pixelfed.services.coupou.fr"
APP	APP_LOCALE	"en"
APP	APP_FALLBACK_LOCALE	"en"
BROADCASTING	BROADCAST_DRIVER	"log"
CACHE	CACHE_DRIVER	"redis"
CAPTCHA	CAPTCHA_ENABLED	❌ false
DATABASE	DB_CONNECTION	"pgsql"
DATABASE	REDIS_CLIENT	"phpredis"
EXP	EXP_LC	❌ false
EXP	EXP_TOP	❌ false
EXP	EXP_POLLS	❌ false
EXP	EXP_CPT	❌ false
EXP	EXP_GPS	❌ false
EXP	EXP_EMC	✅ true
FEDERATION	ACTIVITY_PUB	✅ true
FEDERATION	AP_OUTBOX	✅ true
FEDERATION	AP_INBOX	✅ true
FEDERATION	AP_SHAREDINBOX	✅ true
FEDERATION	AP_REMOTE_FOLLOW	✅ true
FEDERATION	ACTIVITYPUB_DELIVERY_TIMEOUT	"30"
FEDERATION	ACTIVITYPUB_DELIVERY_CONCURRENCY	"10"
FEDERATION	AP_LOGGER_ENABLED	❌ false
FEDERATION	ATOM_FEEDS	✅ true
FEDERATION	REMOTE_AVATARS	✅ true
FEDERATION	NODEINFO	✅ true
FEDERATION	WEBFINGER	✅ true
FEDERATION	PF_NETWORK_TIMELINE	✅ true
FEDERATION	PF_NETWORK_TIMELINE_DAYS_FALLOFF	2
FEDERATION	CUSTOM_EMOJI	❌ false
FEDERATION	CUSTOM_EMOJI_MAX_SIZE	"2000000"
FILESYSTEMS	FILESYSTEM_DRIVER	"local"
FILESYSTEMS	FILESYSTEM_CLOUD	"s3"
HASHING	BCRYPT_COST	"10"
HORIZON	HORIZON_PREFIX	"horizon-"
HORIZON	HORIZON_MEMORY_LIMIT	"64"
HORIZON	HORIZON_BALANCE_STRATEGY	"auto"
HORIZON	HORIZON_MIN_PROCESSES	"1"
HORIZON	HORIZON_MAX_PROCESSES	"20"
HORIZON	HORIZON_SUPERVISOR_MEMORY	"64"
HORIZON	HORIZON_SUPERVISOR_TRIES	"3"
HORIZON	HORIZON_SUPERVISOR_NICE	"0"
HORIZON	HORIZON_SUPERVISOR_TIMEOUT	"300"
HORIZON	HORIZON_DARKMODE	❌ false
IMAGE	IMAGE_DRIVER	"imagick"
INSTANCE	INSTANCE_DESCRIPTION	"Pixelfed - Photo sharing for everyone"
INSTANCE	INSTANCE_CONTACT_FORM	❌ false
INSTANCE	INSTANCE_CONTACT_MAX_PER_DAY	"1"
INSTANCE	INSTANCE_DISCOVER_PUBLIC	❌ false
INSTANCE	EXP_LOOPS	❌ false
INSTANCE	INSTANCE_PUBLIC_HASHTAGS	❌ false
INSTANCE	INSTANCE_CONTACT_EMAIL	""
INSTANCE	INSTANCE_PUBLIC_LOCAL_TIMELINE	❌ false
INSTANCE	INSTANCE_NETWORK_TIMELINE_CACHED	
INSTANCE	INSTANCE_NETWORK_TIMELINE_CACHE_DROPOFF	100
INSTANCE	INSTANCE_NETWORK_TIMELINE_CACHE_MAX_HOUR_INGEST	6
INSTANCE	PAGE_404_HEADER	"Sorry, this page isn't available."
INSTANCE	PAGE_404_BODY	"The link you followed may be broken, or the page may have been removed. <a href="/">Go back to Pixelfed.</a>"
INSTANCE	PAGE_503_HEADER	"Service Unavailable"
INSTANCE	PAGE_503_BODY	"Our service is in maintenance mode, please try again later."
INSTANCE	BANNED_USERNAMES	""
INSTANCE	USERNAME_REMOTE_FORMAT	"@"
INSTANCE	USERNAME_REMOTE_CUSTOM_TEXT	""
INSTANCE	STORIES_ENABLED	❌ false
INSTANCE	RESTRICTED_INSTANCE	❌ false
INSTANCE	OAUTH_TOKEN_DAYS	"365"
INSTANCE	OAUTH_REFRESH_DAYS	"400"
INSTANCE	OAUTH_PAT_ENABLED	❌ false
INSTANCE	OAUTH_PAT_ID	""
INSTANCE	ENABLE_COVID_LABEL	✅ true
INSTANCE	COVID_LABEL_URL	"https://www.who.int/emergencies/diseases/novel-coronavirus-2019/advice-for-public"
INSTANCE	COVID_LABEL_ORG	"visit the WHO website"
INSTANCE	ENABLE_CONFIG_CACHE	❌ false
LDAP	LDAP_CONNECTION	"default"
LDAP	LDAP_LOGGING	✅ true
LDAP	LDAP_CACHE	❌ false
LOGGING	LOG_CHANNEL	"stack"
LOGGING	LOG_LEVEL (stack)	"debug"
MAIL	MAIL_DRIVER	"smtp"
MAIL	MAIL_HOST	"localhost"
MAIL	MAIL_PORT	"25"
MAIL	MAIL_FROM_ADDRESS	"pixelfed@pixelfed.services.coupou.fr"
MAIL	MAIL_FROM_NAME	"Pixelfed"
MAIL	MAIL_ENCRYPTION	""
MEDIA	MEDIA_EXIF_DATABASE	❌ false
PIXELFED	ADMIN_DOMAIN	"pixelfed.services.coupou.fr"
PIXELFED	APP_DOMAIN	"pixelfed.services.coupou.fr"
PIXELFED	MEMORY_LIMIT	"1024M"
PIXELFED	OPEN_REGISTRATION	❌ false
PIXELFED	MAX_ACCOUNT_SIZE (KB)	"1000000"
PIXELFED	MAX_PHOTO_SIZE (KB)	"15000"
PIXELFED	MAX_AVATAR_SIZE (KB)	"2000"
PIXELFED	MAX_CAPTION_LENGTH	"500"
PIXELFED	MAX_BIO_LENGTH	"125"
PIXELFED	MAX_NAME_LENGTH	"30"
PIXELFED	MIN_PASSWORD_LENGTH	"8"
PIXELFED	MAX_ALBUM_LENGTH	"4"
PIXELFED	ENFORCE_EMAIL_VERIFICATION	✅ true
PIXELFED	IMAGE_QUALITY (1-100)	"80"
PIXELFED	ACCOUNT_DELETION	✅ true
PIXELFED	ACCOUNT_DELETE_AFTER	❌ false
PIXELFED	PF_ENABLE_CLOUD	❌ false
PIXELFED	PF_MAX_USERS	1000
PIXELFED	PF_OPTIMIZE_IMAGES	✅ true
PIXELFED	PF_OPTIMIZE_VIDEOS	✅ true
PIXELFED	PF_USER_INVITES	❌ false
PIXELFED	PF_USER_INVITES_TOTAL_LIMIT	"0"
PIXELFED	PF_USER_INVITES_DAILY_LIMIT	"0"
PIXELFED	PF_USER_INVITES_MONTHLY_LIMIT	"0"
PIXELFED	PF_MAX_COLLECTION_LENGTH	"100"
PIXELFED	MEDIA_TYPES	"image/jpeg,image/png,image/gif"
PIXELFED	LIMIT_ACCOUNT_SIZE	✅ true
PIXELFED	IMPORT_INSTAGRAM	❌ false
PIXELFED	IMPORT_INSTAGRAM_POST_LIMIT	"100"
PIXELFED	IMPORT_INSTAGRAM_SIZE_LIMIT	"5000"
PIXELFED	OAUTH_ENABLED	✅ true
PIXELFED	PF_BOUNCER_ENABLED	❌ false
PIXELFED	PF_MEDIA_FAST_PROCESS	✅ true
PIXELFED	PF_MEDIA_MAX_ALTTEXT_LENGTH	"1000"
PURIFY	RESTRICT_HTML_TYPES	BROKEN
QUEUE	QUEUE_DRIVER	"redis"
SESSION	SESSION_DRIVER	"redis"
SESSION	SESSION_LIFETIME	"86400"
SESSION	SESSION_DOMAIN	"pixelfed.services.coupou.fr"
TRUSTEDPROXY	TRUST_PROXIES	"*"
========= END =========

@mitexleo
Copy link

Some recommendations:

  1. Increase php max_execution_time to 300
  2. Set ENABLE_CONFIG_CACHE to true in .env . Otherwise you won't be able to change anything from admin dashboard.

@mitexleo
Copy link

Can't find it yet, I'll try again tonight, going for a long drive for now.

You problem is same as @lapineige. Take a look at : pixelfed/pixelfed#4275 (comment)

I've provided the correct config. It should resolve this issue permanently. Also don't forget to set umask value to 0002

Did it fixed the issue ?

@ashemsay
Copy link
Author

ashemsay commented Apr 24, 2023

Some recommendations:

1. Increase php max_execution_time to `300`

2. Set `ENABLE_CONFIG_CACHE` to `true` in .env . Otherwise you won't be able to change anything from admin dashboard.

I did that, thanks for the input

Can't find it yet, I'll try again tonight, going for a long drive for now.

You problem is same as @lapineige. Take a look at : pixelfed/pixelfed#4275 (comment)
I've provided the correct config. It should resolve this issue permanently. Also don't forget to set umask value to 0002

Did it fixed the issue ?

I modified /var/www/pixelfed/config/filesystems.php like this:

<?php

return [
    /*
    |--------------------------------------------------------------------------
    | Default Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Here you may specify the default filesystem disk that should be used
    | by the framework. The "local" disk, as well as a variety of cloud
    | based disks are available to your application. Just store away!
    |
    */

    'default' => env('FILESYSTEM_DRIVER', 'local'),

    /*
    |--------------------------------------------------------------------------
    | Default Cloud Filesystem Disk
    |--------------------------------------------------------------------------
    |
    | Many applications store files both locally and in the cloud. For this
    | reason, you may specify a default "cloud" driver here. This driver
    | will be bound as the Cloud disk implementation in the container.
    |
    */

    'cloud' => env('FILESYSTEM_CLOUD', 's3'),

    /*
    |--------------------------------------------------------------------------
    | Filesystem Disks
    |--------------------------------------------------------------------------
    |
    | Here you may configure as many filesystem "disks" as you wish, and you
    | may even configure multiple disks of the same driver. Defaults have
    | been setup for each driver as an example of the required options.
    |
    | Supported Drivers: "local", "ftp", "sftp", "s3", "rackspace"
    |
    */

    'disks' => [

        'local' => [
            'driver' => 'local',
            'root'   => storage_path('app'),
            'permissions' => [
                'file' => [
                    'public' => 0664,
                    'private' => 0660,
                ],
                'dir' => [
                    'public' => 0775,
                    'private' => 0770,
                ],
            ],
        ],

        'public' => [
            'driver'     => 'local',
            'root'       => storage_path('app/public'),
            'url'        => env('APP_URL').'/storage',
            'visibility' => 'public',
            'throw' => true,
        ],

        's3' => [
            'driver'   => 's3',
            'key'      => env('AWS_ACCESS_KEY_ID'),
            'secret'   => env('AWS_SECRET_ACCESS_KEY'),
            'region'   => env('AWS_DEFAULT_REGION'),
            'bucket'   => env('AWS_BUCKET'),
            'visibility' => 'public',
            'url'      => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
            'throw' => true,
        ],

        'spaces' => [
            'driver' => 's3',
            'key' => env('DO_SPACES_KEY'),
            'secret' => env('DO_SPACES_SECRET'),
            'endpoint' => env('DO_SPACES_ENDPOINT'),
            'region' => env('DO_SPACES_REGION'),
            'bucket' => env('DO_SPACES_BUCKET'),
            'visibility' => 'public',
            'options' => [
                'CacheControl' => 'max-age=31536000'
            ],
            'root' => env('DO_SPACES_ROOT',''),
            'throw' => true,
            'url' => env('AWS_URL'),
        ],

        'backup' => [
            'driver' => env('PF_BACKUP_DRIVER', 's3'),
            'visibility' => 'private',
            'root' => env('PF_BACKUP_DRIVER', 'local') == 'local' ?
                storage_path('app/backups/') :
                env('PF_BACKUP_ROOT','/'),
            'key' => env('PF_BACKUP_KEY'),
            'secret' => env('PF_BACKUP_SECRET'),
            'endpoint' => env('PF_BACKUP_ENDPOINT'),
            'region' => env('PF_BACKUP_REGION'),
            'bucket' => env('PF_BACKUP_BUCKET'),
        ],

    ],

];

did the artisan config:cache and cache:clear thing, restart both nginx and php8.1-fpm, did not fix the issue.

@ashemsay
Copy link
Author

Also don't forget to set umask value to 0021

What's that ?

If you set umask value to 0002 , all new dirs will be created with 775 and files would be created with 664 permissions.

Issue with changing umask is that it's a per-process setting, we can't set it for a specific directory, at least if we do it on the system side. Couldn't we set it somewhere in the application code?

@lapineige
Copy link
Member

  1. Increase php max_execution_time to 300

Why is that recommended ?
Should I make it the default for this package ?

2. Set `ENABLE_CONFIG_CACHE` to `true` in .env . Otherwise you won't be able to change anything from admin dashboard.

It should be enabled by default on Yunohost Pixelfed packaging 🤔
I will double check.

Also don't forget to set umask value to 0021

What's that ?

If you set umask value to 0002 , all new dirs will be created with 775 and files would be created with 664 permissions.

I don't know what it is 😄. I will search for it.

@lapineige
Copy link
Member

I suggest that we bring back the conversation from #210 to this issue 🙂

@wesleycook74
Copy link

I tried updating to 0.11.16 today, but unfortunately I am still having this issue :(

It's definitely related to the directory permissions since I can get the uploaded files to be displayed by modifying the permissions on only the directories to 755.

@lapineige
Copy link
Member

What directory do you change ? The last level (where the picture is), or an higher one ?

@lapineige
Copy link
Member

We are making progress: https://forum.yunohost.org/t/pixelfed-pictures-not-loading/24244/34

I noticed the new files are u:g as pixelfed:pixelfed, but the older ones are pixelfed:www-data

When you CHOWN the folders to pixelfed:www-data, it works even at 0750. Unfortunately, the new folders are still being created as pixelfed:pixelfed

I don't know how to change that behaviour…

@ashemsay
Copy link
Author

ashemsay commented May 4, 2023

I don't know how to change that behaviour…

I'm guessing some process writing the files is running as pixelfed whereas it usually runs as www-data (in non ynh installations)

@mitexleo
Copy link

mitexleo commented May 4, 2023

It's actually very easy to fix. You guys are thinking in harder ways.

@mitexleo
Copy link

mitexleo commented May 4, 2023

edit: removed to save space. It was a full quote of #211 (comment)

Take a look at the last comment : pixelfed/pixelfed#4275

@lapineige
Copy link
Member

lapineige commented May 4, 2023

 I'm guessing some process writing the files is running as pixelfed whereas it usually runs as www-data (in non ynh installations)

This hypothesis doesn't explain why changing rights to give read permission (because that should be the issue ?) to that hypothetical other process doesn't fix the mess 🤔

edit: more details here pixelfed/pixelfed#4275 (comment)

@lapineige
Copy link
Member

lapineige commented May 4, 2023

So...

In testing branch #215, I did some basic changes that should allow you to patch this as done here without relying on the command line. You only need to upgrade to that testing branch.

It should fix the issue with existing broken files.
It won't fix the issue with newly uploaded files - however you can force (--force) run the upgrade again and it will fix them (it's a bit killing a fly with a cannon but it's working) edit: not sure it will work as the filesystems.php fix will fail it will work.

What it does:

@ashemsay
Copy link
Author

ashemsay commented May 4, 2023

Thanks but since it does not fix the issue for new files I came up with a workaround.

Until we come up with a fix, I'm using this script (I thought of using crontab to schedule it every x minutes, but it seemed overkill since I don't post that often, so I'm using rundeck to run it when needed):

#!/bin/bash
chmod -R ug=rwX,o=rX /var/www/pixelfed/storage/app/public/

It gives read/write to owner and group, read to others and execution to all only directories and already executable files.

This hypothesis doesn't explain why changing rights to give read permission (because that should be the issue ?) to that hypothetical other process doesn't fix the mess 🤔

You're right

edit: more details here pixelfed/pixelfed#4275 (comment)

What I don't understand is why the filesystems.php setting does not work.

As for why the installation script chown command does not work, I'm clueless

@lapineige
Copy link
Member

It gives read/write to owner and group, read to others and execution to all only directories and already executable files.

If you are using #215 this is no longer needed.

I'm using this script (I thought of using crontab to schedule it every x minutes

The same was proposed here : https://forum.yunohost.org/t/pixelfed-pictures-not-loading/24244/47

That might be a good workaround.

 What I don't understand is why the filesystems.php setting does not work.

Yeah…

As for why the installation script chown command does not work, I'm clueless

It does. The thing is newly created file are not controlled by this script.

@ashemsay
Copy link
Author

ashemsay commented May 4, 2023

I don't know why I can't edit my previous message, so I'm adding my comment in this new one

This hypothesis doesn't explain why changing rights to give read permission (because that should be the issue ?) to that hypothetical other process doesn't fix the mess 🤔

You're right, but from what I understand php-fpm runs with the pixelfed user and thus it creates files owned by that user whereas nginx runs with the www-data user and nginx is indeed responsible for serving up the pages, that's why setting pixelfed as owner does not work.
I think if we run php-fpm with the www-data user this issue will go away.

lapineige added a commit that referenced this issue May 4, 2023
@lapineige
Copy link
Member

With the help of other contributors, in the related PR I made a change to pixelfed php settings, so it will be using www-data group instead.

I hope this will fix it… currently testing it.

@lapineige
Copy link
Member

You may already try #215 : it should fix the issue on Pixelfed side ! 🎉

Not yet on Mastodon, we still need to figure out why.

Thanks a lot to all people who contributed to solve this mystery ! 😃

@ashemsay
Copy link
Author

ashemsay commented May 4, 2023

I can confirm that fixed it, I'll just wait for it to be released to close the issue

@lapineige
Copy link
Member

Can someone, having upgraded to #210 (0.11.6~ynh2), reproduce this pixelfed/pixelfed#4275 (comment) and tell us what is the group owner of a newly uploaded picture ?

@sekretaerbaer
Copy link

i am currently on 0.11.8~ynh1
the upload of new images works without problems

namei -om /var/www/pixelfed/storage/app/public/m/_v2/436733357485973505/186f813ba-297a89/ltsCnM7nh3FC/vGIStOtCZmieo0ccHJqG05OkPhL0uD63zVEGphOT.jpg
f: /var/www/pixelfed/storage/app/public/m/_v2/436733357485973505/186f813ba-297a89/ltsCnM7nh3FC/vGIStOtCZmieo0ccHJqG05OkPhL0uD63zVEGphOT.jpg
 drwxr-xr-x root     root     /
 drwxr-xr-x root     root     var
 drwxr-xr-x root     root     www
 drwxr-x--- pixelfed www-data pixelfed
 drwxrwx--- pixelfed www-data storage
 drwxrwx--- pixelfed www-data app
 drwxrwx--- pixelfed www-data public
 drwxrwx--- pixelfed www-data m
 drwxrwx--- pixelfed www-data _v2
 drwxrwx--- pixelfed www-data 436733357485973505
 drwxr-x--- pixelfed www-data 186f813ba-297a89
 drwxr-x--- pixelfed www-data ltsCnM7nh3FC
 -rw-r--r-- pixelfed pixelfed vGIStOtCZmieo0ccHJqG05OkPhL0uD63zVEGphOT.jpg

@lapineige
Copy link
Member

Does it work from another software such as Mastodon ?

@lapineige
Copy link
Member

I forgot to close this, it should be resolved with recent updates (#215, #217). See upstream conversation : pixelfed/pixelfed#4275

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants