v1.6.0 permission problems after upgrade/update



  • Hi there,

    I am experiencing an issue where I get an error on nodebb after updating it to v1.6.0 from 1.5.x (can't remember the last patch number)

    I get Internal Server Error when going to my site and this is the log output in systemctl status nodebb:

    Sep 15 19:16:00 [HOSTNAME] nodebb[1952]: 15/9 19:16:00 [1962] - info: [plugins/spam-be-gone] Settings loaded
    Sep 15 19:16:00 [HOSTNAME] nodebb[1952]: 15/9 19:16:00 [1962] - info: Routes added
    Sep 15 19:16:00 [HOSTNAME] nodebb[1952]: 15/9 19:16:00 [1962] - info: NodeBB Ready
    Sep 15 19:16:00 [HOSTNAME] nodebb[1952]: 15/9 19:16:00 [1962] - info: Enabling 'trust proxy'
    Sep 15 19:16:00 [HOSTNAME] nodebb[1952]: 15/9 19:16:00 [1962] - info: NodeBB is now listening on: 0.0.0.0:4567
    Sep 15 19:16:13 [HOSTNAME] nodebb[1952]: 15/9 19:16:13 [1962] - error: /
    Sep 15 19:16:13 [HOSTNAME] nodebb[1952]: Error: EACCES: permission denied, open '/opt/nodebb/build/public/templates/categories.jst'
    Sep 15 19:16:13 [HOSTNAME] nodebb[1952]: at Error (native)
    Sep 15 19:16:14 [HOSTNAME] nodebb[1952]: Error: EACCES: permission denied, open '/opt/nodebb/build/public/templates/500.jst'
    Sep 15 19:16:14 [HOSTNAME] nodebb[1952]: at Error (native)

    Whats the workaround/solution to this issue?

    Nothing was changed, besides updating it.

    Thanks and kind regards,


  • Global Moderator

    Did you run it with sudo? That would mean those files are owned by root.



  • I did it with root, yes.

    After checking file permissions... I see the permissions/ownerships are all mixed between my nodebb account and root. I assume they should all be owned by my nodebb account, right?



  • yup... that fixed it.

    Thanks @PitaJ :)



  • interesting... after running ./nodebb build (as some plugins don't want to open, it gets stuck at 3/4 of the way usually, but /build fixes it)... it gave me internal server error again.

    I have to run "chown -hR account:group /nodebb" again to fix it... weird



  • hmmm... I'm in a catch 22... I run build, to make my plugins work (calendar being one of them), but I have to chown them again... which brings me back to forcing to restart nodebb and my plugins don't work...

    This is a tough one lol

    **Edit: nevermind... everything doesn't work (top navbar, plugins settings, plugins, topics, posts, etc), unless I manually refresh my browser. ACP works normally, funny enough lol



  • hmmm... lots of errors in the console. @PitaJ / @julian feel free to check if you can see something in the console...


  • Admin

    How are you running build? Everything in the nodebb folder should not be owned by root. You don't need to run build with root...



  • @julian usually I run it as root (I know the consequences of using root, I have a specific way of logging into my machine, akin to freebsd style of working), as my nodebb account is a nologin account

    The only change I made was to update nodebb, and everything stopped working. Also, login works and register works... I don't need to refresh the page to open it. The console (browser dev tools) still has ~17 errors when the page opens and when one tries to access something (from navbar or admin panel)

    **Edit: I ran it as the nodebb account, and still the same issue.


  • Global Moderator

    If you run ./nodebb build and ./nodebb start as root, you shouldn't have a problem. You need to run all of the commands as the same user.


  • Admin

    @adam-poniatowski said in v1.6.0 permission problems after upgrade/update:

    as my nodebb account is a nologin account

    Which is fine, but the files themselves should ideally not be owned by root either, and that goes for the dependencies in node_modules/ as well.

    Can you not run ./nodebb start as your unprivileged user? su - nodebb -c "./nodebb start"?



  • @PitaJ That's what normally worked without any problems. Now it starts without any issues (after chown'ing everything back to my nodebb account, for some weird reason)

    @julian I tried running it as my nodebb account... it doesn't start, this is the output:

    Starting NodeBB
      "./nodebb stop" to stop the NodeBB server
      "./nodebb log" to view server output
      "./nodebb restart" to restart NodeBB
    
    internal/child_process.js:319
        throw errnoException(err, 'spawn');
        ^
    
    Error: spawn EACCES
        at exports._errnoException (util.js:1018:11)
        at ChildProcess.spawn (internal/child_process.js:319:11)
        at Object.exports.spawn (child_process.js:378:9)
        at Function.module.exports.daemon (/opt/nodebb/node_modules/daemon/index.js:50:31)
        at module.exports (/opt/nodebb/node_modules/daemon/index.js:25:20)
        at /opt/nodebb/loader.js:228:21
        at FSReqWrap.oncomplete (fs.js:123:15)
    

    All files are owned by the nodebb account. Starting it up as root (with ./nodebb start and systemctl start nodebb) works... but having the odd issue of browsing between routes (/popular, /users, /categories, etc), but certain ones work without an issue like /login, /register and /admin. but the same issues are inside of the ACP.

    I'm bummed out on this one... it worked before upgrading to v1.6.0 . I also updated my server, which might/might not have an impact


  • Global Moderator

    What did you chown? Did you everything in nodebb or just everything in nodebb/build?



  • @pitaj everything lol... let me guess... I shouldn't have done that? ;)


  • Global Moderator

    No that should work. The error you have here is related to file permissions.



  • @pitaj should I try chmod -R 755 /nodebb ? just for shits and giggles?


  • Global Moderator

    I'd just try backing up your db and uploaded files, and reinstalling nodebb fresh.

    But if you wanna try other things first, go ahead.



  • reverted to my last snapshot... unfortunately a little old and an older version. oh well... I will wait for the next patch before updating :)

    **Edit: I forgot that my snapshot is a little bit older than I thought. v1.4.6 lol



  • update to v1.5.3 had no issues. I'll try updating it to v1.6.0 and report back what happens.



  • yup... updating to v1.6.0 causes the same issues... ownership is changed to root, changing it back to the rightful owner starts it back up (internal server error is gone):

    Sep 17 19:28:58 [HOSTNAME] [ACCOUNT][4048]: Error: EACCES: permission denied, open '/opt/nodebb/build/public/templates/footer.jst' Sep 17 19:28:58 [HOSTNAME] [ACCOUNT][4048]: at Error (native) Sep 17 19:28:59 [HOSTNAME] [ACCOUNT][4048]: Error: EACCES: permission denied, open '/opt/nodebb/build/public/templates/footer.jst' Sep 17 19:28:59 [HOSTNAME] [ACCOUNT][4048]: at Error (native) Sep 17 19:28:59 [HOSTNAME] [ACCOUNT][4048]: 17/9 19:28:59 [4058] - error: / Sep 17 19:28:59 [HOSTNAME] [ACCOUNT][4048]: Error: EACCES: permission denied, open '/opt/nodebb/build/public/templates/categories.jst' Sep 17 19:28:59 [HOSTNAME] [ACCOUNT][4048]: at Error (native) Sep 17 19:28:59 [HOSTNAME] [ACCOUNT][4048]: Error: EACCES: permission denied, open '/opt/nodebb/build/public/templates/500.jst' Sep 17 19:28:59 [HOSTNAME] [ACCOUNT][4048]: at Error (native)

    Bummer... reverting back to my snapshot :( yeah... I will have to wait for the next patch.

    For anyone having the same issues... reinstalling it with v1.6.0 is the best option... unless I am the unlucky one XD


Log in to reply
 


Looks like your connection to NodeBB was lost, please wait while we try to reconnect.