zepgram / magento2-fast-vm

Optimal vagrant developer box for Magento2. Folders synced by nfs/rsync. This box includes Magento developer utilities.
MIT License
110 stars 35 forks source link

problem with permissions(can't upload product images) #79

Open srgrbkl opened 3 years ago

srgrbkl commented 3 years ago

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. [] []

AlexRoig commented 3 years ago

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

zepgram commented 3 years ago

I'll take a look in few minutes.

zepgram commented 3 years ago

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 commented 3 years ago

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

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

srgrbkl commented 3 years ago

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

get error: (failed)net::ERR_CONNECTION_REFUSED

AlexRoig commented 3 years ago

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.

zepgram commented 3 years ago

@AlexRoig Good news ! Thanks for testing.

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

zepgram commented 3 years ago

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.

srgrbkl commented 3 years ago

@zepgram tested develop branch and its works fine now

dutchwebdesign commented 3 years ago

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' }

zepgram commented 3 years ago

Well I tried it and it seems ok: image

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

dutchwebdesign commented 3 years ago

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

dutchwebdesign commented 2 years ago

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

zepgram commented 2 years ago

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.