magento2-fast-vm icon indicating copy to clipboard operation
magento2-fast-vm copied to clipboard

problem with permissions(can't upload product images)

Open srgrbkl opened this issue 4 years ago • 14 comments

I'm trying to upload images of product but I get an error(tested in m2.4.2): 'A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.' system.log: main.CRITICAL: The permissions can't be changed for the "/home/vagrant/magento/pub/media/tmp/catalog/product/u/n/u.jpg" path. Warning!chmod(): Operation not permitted. [] []

srgrbkl avatar Feb 24 '21 08:02 srgrbkl

I'm having exactly the same issue. Fresh VM install with CE 2.4.2. Any hints?

AlexRoig avatar Mar 01 '21 18:03 AlexRoig

I'll take a look in few minutes.

zepgram avatar Mar 01 '21 18:03 zepgram

Ok, so this is related to this line: vendor/magento/framework/Filesystem/Driver/File.php::524 : Magento try to apply permission right after image creation.

On NFS mount, all permissions are forced to "u=rwx:g=rwx:o=rwx" with bindfs. I'll try to disable bindfs and run installation with normal permissions.

zepgram avatar Mar 01 '21 20:03 zepgram

I made some change, can you confirm that everything is working on develop branch ?

If it's fine I'll merge into master.

zepgram avatar Mar 02 '21 13:03 zepgram

tested develop branch with options: mount: 'rsync' path: 'root' provision: 'all'

get error: (failed)net::ERR_CONNECTION_REFUSED

srgrbkl avatar Mar 02 '21 14:03 srgrbkl

I took my existing VM, shut it down, used your modified Vagrantfile and run 'vagrant up' again and it's working perfectly. I kept in my config the NFS mount. Although when I started investigating the issue I faced a lot of problems with the CSP module on Magento and had to disable it.

AlexRoig avatar Mar 02 '21 16:03 AlexRoig

@AlexRoig Good news ! Thanks for testing.

@srgrbkl bindfs looks like mandatory for rsync mount, I'm investigating.

zepgram avatar Mar 02 '21 16:03 zepgram

You can retry with a simple vagrant reload @srgrbkl, rsync should work correctly this time. If you have an issue on first launch, run bin/magento setup:upgrade && permission.

zepgram avatar Mar 02 '21 19:03 zepgram

@zepgram tested develop branch and its works fine now

srgrbkl avatar Mar 02 '21 20:03 srgrbkl

We have same problem with magento 2.4.3 inside pagebuilder:

main.CRITICAL: The permissions can't be changed for the "/home/vagrant/magento/pub/media/wysiwyg/oks-hero.jpg" path. Warning!chmod(): Operation not permitted. [] []

I used this code with and without Vagrantfile and both not working, also permission command does not fix it.

config.bindfs.default_options = { force_user: 'vagrant', force_group: 'www-data', perms: 'u=rwx:g=rwx:o=rx' }

dutchwebdesign avatar Sep 24 '21 13:09 dutchwebdesign

Well I tried it and it seems ok: image

Could you describe what you did ? What is your mount configuration (default / rsync / nfs) ?

zepgram avatar Sep 25 '21 13:09 zepgram

we use nfs -> in the pagebuilder use the image upload (from own computer)

dutchwebdesign avatar Oct 18 '21 12:10 dutchwebdesign

We fixed it by disable in vagrantfile #config.bindfs.bind_folder guestDirectory, guestDirectory, after: :provision and using command on host vagrant plugin uninstall vagrant-bindfs

see https://github.com/puphpet/puphpet/issues/1756

dutchwebdesign avatar Nov 22 '21 10:11 dutchwebdesign

I'll take a look to find a solution, bindfs is supposed to be required to avoid issues with permissions while using NFS mount.

I did this commit a long time ago : https://github.com/zepgram/magento2-fast-vm/commit/3b9e9e573633c481e41a20d3a865ff40b451504a

But this was creating an issue with RSYNC mount.

zepgram avatar Nov 22 '21 10:11 zepgram