Running as root without sandbox error ubuntu .net core



  • Hello

    I am using an asp.net core mvc app and using JSReport to output some views as PDF.

    I have followed several guides of what I can find online and I am pretty sure that every package I need to install is installd (google-chrome-unstable is installed too)

    I start the app by doing sudo dotnet app.dll "http://:5000;https://:5001" and using an apache server as a reverse proxy.

    However I am getting the Running as root without --no sandbox is not supported" error. I am unable to determine what I need to do in order to not get this error.

    Full output here: https://pastebin.com/s8Asse8p

    To output the PDF I am using recipe.chromepdf and a razor view which works great when I develop on windows, but get the error from before on the ubuntu server.

    Any help is appreciated



  • I start the app by doing sudo dotnet app.dll "http://:5000;https://:5001" and using an apache server as a reverse proxy.

    Do you need to start as root? It should work if you start it without sudo.

    In case you for some reason needs to use sudo, you need to configure chrome as the exception mentioned.
    You can do this, for example, using an environment variable.
    chrome_launchOptions_args=--no-sandbox



  • Thank you jan, I got away with using a local jsreport instance for now, where do I set the arguments? I used to use the binaries (they seem faster, so hopefully I can get back to that later) and I couldn't see where I should put the arguments, if it is in the VHost file or in the C# code, I already tried to look for this but couldn't find anything.

    Running without sudo gives me an https certificate error, but at least I think this should be easier to solve.



  • Thank you jan, I got away with using a local jsreport instance for now, where do I set the arguments?

    So you now use your local jsreport instance started using node.js and it is now running as a web server?
    In this case, it is better to use jsreport.Client and connect to it.

    I used to use the binaries (they seem faster, so hopefully I can get back to that later)

    Binaries are typically not faster than full jsreport running through node.js as web server.

    I couldn't see where I should put the arguments, if it is in the VHost file or in the C# cod

    What kind of arguments do you mean?

    Running without sudo gives me an https certificate error, but at least I think this should be easier to solve.

    Not an expert on this topic. However, maybe you should let the reverse proxy deal with https and abstract it out from your application.
    Your application would be then running just http and you don't need sudo for it.



  • So you now use your local jsreport instance started using node.js and it is now running as a web server?
    In this case, it is better to use jsreport.Client and connect to it.

    Oh, and if I follow the link you linked to it, I will be able to set it up? Because for some reason this js report node is just timing out every html request I send to it.

    Binaries are typically not faster than full jsreport running through node.js as web server.

    Oh, it does make sense that they are faster though, since machine code works fast

    What kind of arguments do you mean?

    this one: chrome_launchOptions_args=--no-sandbox and if I should set it up for using non root/sudo then I don't know how to do that either.

    Not an expert on this topic. However, maybe you should let the reverse proxy deal with https and abstract it out from your application.
    Your application would be then running just http and you don't need sudo for it.

    My reverse proxy autoswitches http to https, and I think it should do that by default as well, so no biggie there. It's a long time since I visited this though. So can't quite remember everything.


Log in to reply
 

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