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'
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.