LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-24-2020, 07:24 AM   #1
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Rep: Reputation: Disabled
Unhappy composer: composer.json is not writable


Hi there, I have Ubuntu/VPS, nginx, mariadb, /var/www/html/test.com/composer.json: permission=755, chown/chgrp=www-data/www-data

oldy: composer update/upgrade
Code:
Update symfony/polyfill-ctype (v1.17.0 => v1.18.1) : Update failed (Could not delete /vendor/symfony/polyfill-ctype/README.md)

In Filesystem.php line 217:
Could not delete /vendor/symfony/polyfill-ctype/README.md
oldy: composer require symfony/polyfill-ctype
Code:
./composer.json is not writable.
Can you tell me about this? I am almost newbie to this.

Last edited by Oldy; 08-24-2020 at 11:08 AM.
 
Old 08-24-2020, 09:15 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,616
Blog Entries: 19

Rep: Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460
You don't say what name you were working in. 755 means that the owner of the file has read, write and execute rights (4+2+1) but everyone else has read and execute only (4+1). So if you were working as www-data, you should have had write access, but not if you were logged on as yourself.

Similarly with your failed update. /vendor isn't a standard Linux directory but, as it's a top-level directory, I assume that it is owned by root. So you would have to be root to do an update.
 
Old 08-24-2020, 11:23 AM   #3
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
You don't say what name you were working in.
nginx, mariadb and Ubuntu/VPS. Or 'oldy: sudo root' Is that correct?

oldy: composer require symfony/polyfill-ctype

/var/www/html/test.com/vendor perm 755

Summary:
- permission is 755 (ex. vendor and composer.json)
- chown/chgrp: www-data/www-data
- user is oldy, super user is root

How can I do it now?
 
Old 08-24-2020, 12:10 PM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,616
Blog Entries: 19

Rep: Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460
If you want to update a software package, you must be root. In your case, that means using sudo with your own password. Once the update is done, the other problem may resolve itself.

If not, we'll deal with it then.
 
Old 08-24-2020, 12:33 PM   #5
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
oldy: sudo composer upgrade

or

oldy: sudo composer require symfony/polyfill-ctype

Quote:
Do not run Composer as root/super user!
 
Old 08-24-2020, 12:51 PM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,616
Blog Entries: 19

Rep: Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460Reputation: 4460
OK, let's try something else. When you used "composer require" you were told:
./composer.json is not writable.

So it looks as if you have a composer.json file in your home directory. Correct? In that case, just make it writable and see if that solves the problem. You can do it with chmod:
Code:
chmod u+w composer.json
If it's not in your home directory, you might need to use sudo to change the permissions.
 
Old 08-24-2020, 01:22 PM   #7
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
oldy $ chown u+w composer.json
Quote:
Operation not permitted
oldy $ sudo chown u+w composer.json (blank)
oldy $ composer require symfony/polyfill-ctype
Quote:
./composer.json is not writable.
and the same composer.json as before.
 
Old 08-24-2020, 01:40 PM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Sorry, instead of chowning and chmodding, shouldn't you run composer as www-data?
Code:
sudo -u www-data composer ...
 
Old 08-24-2020, 03:05 PM   #9
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
Yes, one step further.


composer update or upgrade, ok
sudo -u www-data composer update or upgrade, ok
composer require symfony/polyfill-ctype, ok


Here is mariadb so I should have database/host/user/pass, but it fails:
Something went wrong: SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known



Possibly I read this:

/storage/logs/flarum-installer.log
Quote:
...
Flarum Installer.ERROR: Symfony\Component\Console\Exception\CommandNotFoundException: Command "migrate" is not defined. in /var/www/html/test.com/vendor/symfony/console/Application.php:669
...
Flarum Installer.ERROR: Symfony\Component\Console\Exception\NamespaceNotFoundException: There are no commands defined in the "cache" namespace. in /var/www/html/test.com/vendor/symfony/console/Application.php:597
...

Last edited by Oldy; 08-25-2020 at 06:26 AM.
 
Old 08-25-2020, 11:55 PM   #10
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
The information you provide is patchy; all I can gather from it is that
  • you have some sort of SQL problem. The error message however suggests that it could have something to do with DNS; does your VPS do DNS? Try a simple 'ping archive.org'
  • apparently you are not meeting some of the prerequisites to install flarum - what I do not know, maybe you have to edit a file beforehand, maybe you have to install some dependencies. Did you check flarums's installation requirements & instructions before attempting this?
 
Old 08-26-2020, 10:43 AM   #11
Oldy
Member
 
Registered: Jul 2020
Posts: 40

Original Poster
Rep: Reputation: Disabled
ping archive.org
Quote:
64 bytes from www.archive.org : icmp_seq=1 ttl=51 times=148 ms
64 bytes from www.archive.org : icmp_seq=2 ttl=51 times=147 ms
etc

One step further.

I tested database (access_tokens.frm, access_tokens.ibd, api_keys.frm, api_keys.ibd, clarkwinkelmann_group_invitations.frm etc) with new server.

oldy$ php --version
PHP 7.4.3

user is only me.

oldy$ sudo systemctl restart mariadb, ok
oldy$ sudo systemctl restart php7.4-fpm.service, ok
oldy$ sudo systemctl restart nginx, ok

oldy$ sudo service mariadb restart, ok
oldy$ sudo service php7.4-fpm restartm, ok
oldy$ sudo service nginx restart, ok

oldy$ sudo apt clean, ok
oldy$ sudo apt update, ok
oldy$ sudo apt upgrade, ok
oldy$ sudo apt install, ok
oldy$ sudo -u www-data composer update, ok
oldy$ sudo -u www-data composer upgrade, ok

oldy$ php flarum cache:clear,
oldy$ php flarum migrate -vvv,
oldy$ php flarum install -vvv
Quote:
Warning: unlink(/test.com/blabla/) and file_update_contents(/test.com/blabla/): failed to open stream: Permission denined on line xxx
oldy$ sudo -u www-data php flarum cache:clear, ok
oldy$ sudo -u www-data php flarum migrate -vvv, ok
oldy$ sudo -u www-data php flarum install -vvv, ok


oldy$ pwd
/var/www/html/test.com

oldy$ sudo systemctl status mariadb
(yellow font)
Quote:
...
debian-start
Looking for mysql as /usr/bin/mysql
Looking for mysqlcheck as /usr/bin/mysqlcheck
Version check failed. Got the following error when the mysql command line client
ERROR 1045 Access denied for user root@localhost (using password: NO)
...
Above fails, but still success below

oldy$ mariadb -u root -p <password>
Quote:
Welcome to the MariaDB monitor.
MariaDB > _

oldy$ sudo -u www-data systemctl status mariadb, ok


Edit: I must have now 'sudo -u www-data composer/php ...<and password>' (long sentence every day from now) rather then short 'composer/php ...'

Last edited by Oldy; 08-27-2020 at 12:46 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve the content of a json file using shell script .Without jq /json Historia Linux - Newbie 12 03-25-2020 09:50 AM
LXer: JSON Lines: record-style JSON LXer Syndicated Linux News 0 01-28-2020 08:03 PM
Composer not working and no error on centos 7 newbie14 Linux - Server 6 08-21-2019 02:02 AM
Installing pulseaudio (steam) - json not found? krip0tx Slackware 3 12-22-2012 12:05 PM
Squirrelmail 1.4.13 + HTML mail composer not working +Yan Linux - Software 0 02-24-2008 02:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration