Update fails because routes-v7.php ⚠

Hi @hillel

So I just attempted to update and this is a new error I never seen before:
image
Updated several times in the past now flawlessly, but this time it is trolling me.

Also notice that this error flashes by very fast, so it is hard to see it. I had to run the update several times to screenshot it. :scream:

Please kindly advise.

Thanks in advance. :smiley:
Kind regards
AngryWarrior.

Probably a permission/ownership issue. Have you run php artisan optimize as root instead of www-data?

find /path/to/invoiceninja \\( ! -user www-data -o ! -perm -644 \\) -ls

should probably also throw bootstrap/cache/config.php

1 Like

Thanks for the suggestion @xoo

If it was permission issue then I would have been able to run the last 10-15 former/previous updates in the past… :smiley::thinking:

Please do correct me if I am incorrect in my assumption.
Kind regards
AngryWarrior.

Can you execute the find command and tell us what you get? (Assuming www-data is the user your nginx/apache is running as.)

I can only speculate about the cause, but running php artisan optimize as root will recreate bootstrap/cache/routes-v7.php (and bootstrap/cache/config.php) and is one way to end up with those files owned be root.

1 Like

Should the command be executed exactly like be below with the brackets too? (On the Ninja folder)
( ! -user www-data -o ! -perm -644 \\) -ls

I’m not a super user of Linux, still learning. :wink:
Kind regards
AngryWarrior.

Still stuck with this issue. I would appreciate any help, thanks.

Kind regards
AngryWarrior

The command is

find /path/to/invoiceninja \( ! -user www-data -o ! -perm -644 \) -ls

What it does is:

  • find all files
  • beginning at your invoice directory (you need to use your real path here)
  • the backslash is needed to escape the opening and closing parenthesis from the shell
  • the parenthesis are needed to execute logical OR (-o) before the (implicit) logical AND just before the -ls
  • search for files that are ( NOT owned by www-data (change, if your nginx or apache runs as a different user) OR that have NOT ALL the permission bits 644 set ) AND list them

man find has a full man page on find

1 Like

Thanks @xoo .

Not 100% certain what i am doing wrong here:


But as I mentioned I am no super Linux user so I do not know all Linux shell commands and syntaxes etc.

Thanks in advance.
Kind regards
AngryWarrior

I have checked on my server through webmin (which I have installed too in the past to make it a bit easier to do maintenance tasks etc.) and all folder and files are from what i can see owned by www-data which I know I had set in the past to own the www root folder of ninja and its subfolder /files too when i installed Invoice Ninja.

I’m thinking of where that “routes-v7.php file” actually reside in the folder structure of invoice ninja? I been searching for it, but I cannot seem to find it.

I have also downloaded a fresh set of installation files, unzipped it to a local folder and search that for “routes-v7.php”, but nothing found there either…

So I’m a bit puzzled of it (of the location of "routes-v7.php").

Thanks again. :smiley:

Kind regards
AngryWarrior

Right!
So after been digging a bit further I have figured out that the “routes-v7.php” is automatically generated by the laravel framework in the → bootstrap → cache folder.

But on my server there is no such file:

Folders have 750 permission
Files have 644 permission.
All folder and files are owned by the www-data user.

Also I have changed bootstrap and storage (including their subfolders), to 755 as per recommendations in the documentation:


https://invoice-ninja.readthedocs.io/en/latest/install.html

Thanks in advance
Kind regards
AngryWarrior

I’ve solved the issue and my server is now running latest version of Invoice Ninja.
image

Kind regards
AngryWarrior

1 Like