I am unable to start gnome-terminal from rc.local , with the following error. ** (gnome-terminal:1304): WARNING **: Command line `dbus-launch --autolaunch=bd53fdd726adb41172f458c100000007 --binary-syntax --close-stderr' exited with non-zero exit status 1: Autolaunch error: X11 initialization failed.\n Failed to parse arguments: Cannot open display: Failed to parse arguments: Cannot open display: the command inside rc.local is cd /path/to/server gnome-terminal -e 'sudo node startserver.js'

- 527
- 1
- 6
- 14
-
It works fine if i manually start it via sudo /etc/rc.local – Sujithra Aug 09 '12 at 12:08
1 Answers
There seems to be an error message trying to tell you something: exited with non-zero exit status 1: Autolaunch error: X11 initialization failed
- in other words, rc.local doesn't have an X display to start gnome-terminal from.
If you're sure that an X display will be available at the time this executes (and I doubt this - rc.local finishes executing long before an X display comes up), you can try env DISPLAY=:0 gnome-terminal -e 'sudo node startserver.js'
. This may be problematic, as the gnome-terminal
will run as root (which is a Bad Idea for several reasons).
If, on the other hand, you're trying to start a terminal in the logged-in user's X display (which seems to be your end goal), you may want to add the command to your autostart scripts. See this for the GUI version, see your ~/.config/autostart
and /etc/xdg/autostart
for the results.

- 91,498
- 46
- 177
- 222
-
thanks but my server listens on port 80 it needs sudo to bind to that port. – Sujithra Aug 09 '12 at 12:40
-
@techgentsia: How is that related to my answer? I'm **not** suggesting to change what runs *inside* gnome-terminal (which is your `sudo whatever`, this **stays the same**), but the user of the `gnome-terminal` process itself. – Piskvor left the building Aug 09 '12 at 13:04
-
I tried to run gnome-terminal inside rc.local because it starts with root privilege. is there no way to do so... – Sujithra Aug 09 '12 at 13:16