YunoHost-Apps / nextcloud_ynh

Nextcloud package for YunoHost
https://nextcloud.com/
GNU Affero General Public License v3.0
147 stars 63 forks source link

chown -R nextcloud: /var/www/nextcloud /home/yunohost.app/nextcloud/data done twice on upgrade #608

Closed supermamie closed 7 months ago

supermamie commented 12 months ago

Describe the bug

chown -R nextcloud: /var/www/nextcloud /home/yunohost.app/nextcloud/data is done twice on upgrade

Context

Here are some interesting parts :

2023-10-09 10:19:52,872 DEBUG    yunohost.hook (unknown function) - [21101.131] + set +x
2023-10-09 10:19:52,878 INFO     yunohost.hook (unknown function) - [21101.131] [#############+......] > Upgrading Nextcloud...
2023-10-09 10:19:52,879 DEBUG    yunohost.hook (unknown function) - [21101.131] + echo '[#############+......] > Upgrading Nextcloud...'
2023-10-09 10:19:52,880 DEBUG    yunohost.hook (unknown function) - [21101.131] + set -o xtrace
2023-10-09 10:19:52,880 DEBUG    yunohost.hook (unknown function) - [21101.131] + source upgrade.d/upgrade.last.sh
2023-10-09 10:19:52,886 DEBUG    yunohost.hook (unknown function) - [21101.131] ++ next_version=27.1.2
2023-10-09 10:19:52,886 DEBUG    yunohost.hook (unknown function) - [21101.131] ++ nextcloud_source_sha256=0742b247aaee0b7044db0062f0a914aa77338c7a7d8fe7da0917147d76689721
2023-10-09 10:19:52,887 DEBUG    yunohost.hook (unknown function) - [21101.131] + last_version=27.1.2
2023-10-09 10:19:52,887 DEBUG    yunohost.hook (unknown function) - [21101.131] + last_major_version=27
2023-10-09 10:19:52,887 DEBUG    yunohost.hook (unknown function) - [21101.131] + chown -R nextcloud: /var/www/nextcloud /home/yunohost.app/nextcloud/data
2023-10-09 10:42:45,727 DEBUG    yunohost.hook (unknown function) - [21101.131] + exec_occ -V

As you can see, it took 20min for the chown. This is not a problem at all, I have a lot of files, it may be usefull for some reason. But, it is done again later in the process, and takes nearly 20min again :

2023-10-09 10:44:56,110 DEBUG    yunohost.hook (unknown function) - [21101.131] + set +o xtrace
2023-10-09 10:44:56,134 DEBUG    yunohost.hook (unknown function) - [21101.131] + set +o xtrace
2023-10-09 10:44:56,165 DEBUG    yunohost.hook (unknown function) - [21101.131] + echo ''\''/tmp/tmp.Zd2eMg2wHm'\'' wasn'\''t deleted because it doesn'\''t exist.'
2023-10-09 10:44:56,166 INFO     yunohost.hook (unknown function) - [21101.131] '/tmp/tmp.Zd2eMg2wHm' wasn't deleted because it doesn't exist.
2023-10-09 10:44:56,167 DEBUG    geventwebsocket.handler (unknown function) - Failed to write closing frame -> closing socket
2023-10-09 10:44:56,168 DEBUG    geventwebsocket.handler (unknown function) - Closed WebSocket
2023-10-09 10:44:56,168 DEBUG    geventwebsocket.handler (unknown function) - Failed to write closing frame -> closing socket
2023-10-09 10:44:56,168 DEBUG    geventwebsocket.handler (unknown function) - Closed WebSocket
2023-10-09 10:44:56,269 DEBUG    yunohost.hook (unknown function) - [21101.131] + set -o xtrace
2023-10-09 10:44:56,271 DEBUG    yunohost.hook (unknown function) - [21101.131] + chown -R nextcloud: /var/www/nextcloud /home/yunohost.app/nextcloud/data
2023-10-09 11:02:24,474 DEBUG    yunohost.hook (unknown function) - [21101.131] + exec_occ maintenance:mode --off

Maybe this second time is not needed (but maybe it is, I just think it is strange to do it twice)

And while I am writting this ticket, there is another chown running, but this is a different command this time (instead of doing it in one command, it is done in two commands)

2023-10-09 11:03:52,612 DEBUG    yunohost.hook (unknown function) - [21101.131] ++ whoami
2023-10-09 11:03:52,618 DEBUG    yunohost.hook (unknown function) - [21101.131] + [[ nextcloud = root ]]
2023-10-09 11:03:52,623 DEBUG    yunohost.hook (unknown function) - [21101.131] + sudo -u nextcloud php8.2 --define apc.enable_cli=1 occ --no-interaction --no-ansi background:cron
2023-10-09 11:03:53,828 DEBUG    yunohost.hook (unknown function) - [21101.131] Set mode for background jobs to 'cron'
2023-10-09 11:03:53,872 DEBUG    yunohost.hook (unknown function) - [21101.131] + chown -R nextcloud:www-data /var/www/nextcloud
2023-10-09 11:03:57,913 DEBUG    yunohost.hook (unknown function) - [21101.131] + chown -R nextcloud: /home/yunohost.app/nextcloud/data
2023-10-09 11:16:25,564 DEBUG    yunohost.hook (unknown function) - [21101.131] + find /var/www/nextcloud/ -type f -print0
2023-10-09 11:16:25,571 DEBUG    yunohost.hook (unknown function) - [21101.131] + xargs -r0 chmod 0644
2023-10-09 11:16:28,394 DEBUG    yunohost.hook (unknown function) - [21101.131] + xargs -r0 chmod 0755
2023-10-09 11:16:28,396 DEBUG    yunohost.hook (unknown function) - [21101.131] + find /var/www/nextcloud/ -type d -print0
2023-10-09 11:16:28,825 DEBUG    yunohost.hook (unknown function) - [21101.131] + xargs -r0 chmod 0640
2023-10-09 11:16:28,826 DEBUG    yunohost.hook (unknown function) - [21101.131] + find /home/yunohost.app/nextcloud/data/ -type f -print0

Here I had a timeout on the web interface

Expected behavior

Maybe do the chown only once ?

Logs

https://paste.yunohost.org/mogejaxone

supermamie commented 11 months ago

27.1.2\~ynh1 -> 27.1.2\~ynh2

2023-10-12 10:59:55,527: DEBUG - + chown -R nextcloud:www-data /var/www/nextcloud
2023-10-12 10:59:57,097: DEBUG - + chown -R nextcloud: /home/yunohost.app/nextcloud/data
2023-10-12 11:23:00,996: DEBUG - + find /var/www/nextcloud/ -type f -print0

Only done once. (Then other actions made the upgrade still long, but those are not chown : )

2023-10-12 10:59:55,527: DEBUG - + chown -R nextcloud:www-data /var/www/nextcloud
2023-10-12 10:59:57,097: DEBUG - + chown -R nextcloud: /home/yunohost.app/nextcloud/data
2023-10-12 11:23:00,996: DEBUG - + find /var/www/nextcloud/ -type f -print0
2023-10-12 11:23:00,998: DEBUG - + xargs -r0 chmod 0644
2023-10-12 11:23:03,903: DEBUG - + find /var/www/nextcloud/ -type d -print0
2023-10-12 11:23:03,904: DEBUG - + xargs -r0 chmod 0755
2023-10-12 11:23:04,428: DEBUG - + xargs -r0 chmod 0640
2023-10-12 11:23:04,430: DEBUG - + find /home/yunohost.app/nextcloud/data/ -type f -print0
2023-10-12 11:44:48,200: DEBUG - + xargs -r0 chmod 0750
2023-10-12 11:44:48,206: DEBUG - + find /home/yunohost.app/nextcloud/data/ -type d -print0
2023-10-12 11:55:40,965: DEBUG - + chmod 640 /var/www/nextcloud/config/config.php