Error When Updating to v5.3.78 - Cannot update system because list-invoices.php is not writable with correction

Environment: Production Invoice Ninja Self Hosted - version 5.3.75 being upgraded from the self update web console to v5.3.78
OS - Debian 10 server with current security patches (Linux)
PHP - v8.0.17 with current security patches
Database Engine - MySQL/MariaDB - Current version with latest security patches
Web Server - Apache v2.4.5x with current security patches
PDF Engine - Local SnapPDF (not using Phantom)
Other - Virtual Machine = yes
Other - VM is not Docker; private VM instance with dedicated resources

Error and Issue: Upgrading Invoice Ninja from v5.3.75 to v5.3.78 via the self update within the web application console does not complete with an error message “Cannot update system because list-invoices.php is not writable”. The error message is displayed briefly in the web console and is logged in the {path to web}/invoiceninja/storage/logs/laravel.log

Error message from the laravel.log
[2022-04-02 15:16:33] production.ERROR: Cannot update system because list-invoices.php is not writable {“userId”:1,“exception”:"[object] (App\Exceptions\FilePermissionsFailure(code: 0): C$
[stacktrace]

Recent Changes: Increased the PHP memory limit from 128M to 512M last week during our scheduled maintenance window.

Requesting input from @david and @hillel - Thanks

Hi,

It looks like a permissions issue, this should correct it.

sudo chown -R www-data:www-data storage
sudo find ./ -type d -exec chmod 755 {} \;

@hillel thanks for the quick reply.

We came to the same conclusion, but the error continued to persist. However we ran the chown command one level up, against the directory containing our instance of Invoice Ninja and were able to successfully complete the update afterwards.

We are looking into the logs to see if there was some other change to permissions from an internal or external cause. If we find anything significant, we will post a follow up.

To clarify for those who may ask:
Our Invoice Ninja servers are usually “installed” at /var/www/html/invoiceninja for Apache 2 based web server instances.

Your instructions are asking that the commands be run from /var/www/html/invoiceninja, essentially from within the “installation” sub directory as the command sudo chown -R www-data:www-data storage targets the permissions in /var/www/html/invoiceninja/storage sub directory

We ran the commands “one level up” at /var/www/html targeting the invoiceninja sub directory and all the contents within it with the sudo chown -R www-data:www-data invoiceninja followed by the update (from the web console) and follow up command of sudo -u www-data php artisan optimize

Thanks for the update!

cc @david