Tagged: cron ubuntu gnome-terminal
May 29, 2021 at 01:12 #33747
With a previous 6.X version (can’t remember which), my cronjobs with GUIs e.g. /bin/bash worked fine as long as I set the DISPLAY environment variable. However, since upgrading to version 6.12.3 they no longer work and I get the following error message:
# Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.gnome.Terminal exited with status 8
Googling this error, I saw the main cause was not having LANG=”en_US.UTF-8″ set in /etc/default/locale but it’s set correctly for me. Following another lead I copied the DBUS_SESSION_BUS_ADDRESS environment variable and passed it to the cronjob via command line and then everything worked, however as I understand it this is not a permanent solution because this environment variable setting will change every time the computer restarts.
Ideally, I’d like to go back to not having to deal with this DBUS business. Any idea why updating NoMachine would have caused this problem and ideally how I can have things go back to how they were or at least how I can set things up so that I won’t have to constantly change the DBUS setting? I’d like to avoid upgrading to NoMachine 7 if possible so that I won’t have to deal with any license issues.
* NoMachine 6.12.3 free version on Ubuntu 18.04 using gdm3
* Problem seems to arise connecting to both physical and virtual displaysJune 1, 2021 at 15:32 #33826
I am not sure that I clearly understood what is your problem with crontab and NoMachine. I tried simple command to start application to desired virtual or physical desktop and application did show on required display.
Here is the command I used:
XAUTHORITY=/home/$user/.Xauthority DISPLAY=:1002 firefoxJune 4, 2021 at 11:44 #33886
Thanks for the response. It seems the problem is specific to gnome-terminal being run from cron for some reason (previously I’d assumed it was for any program with a GUI component). I use gnome-terminal because I want the terminal to be visible from the desktop. Before I upgraded it worked fine. Unfortunately including the environment variables as you suggested did not help.June 4, 2021 at 16:06 #33891
I feel that issue is more related to gnome-terminal and its implementation. I found some articles that speaks about problem https://gitlab.gnome.org/GNOME/gnome-terminal/-/issues/194.
I noticed additionally when I dont have any user logged on physical display this command worked for me, but i tried on Ubuntu 21.04.
DISPLAY=:1002 dbus-launch gnome-terminalJune 5, 2021 at 05:19 #33901
That looks promising, thanks. I agree, seems like it could be a gnome-terminal problem, but I thought I’d ask here since everything was fine before upgrading from 6.7.6_11 to 6.12.3 (and later a 7.6.2_4 version I tried after encountering the problem). I’ll try using dbus-launch and report back in a couple of weeks when I’m back in town in case it might help someone else.June 15, 2021 at 08:43 #34032
dbus-launch fixed this, excellent, thanks!
However, now I have a problem where unless I have the NoMachine server set to run at startup any connection attempt reports that the currently running display (physical) cannot be detected even after restarting the NoMachine server. Could this be caused by using player version 6.7 to connect to server version 7.X?
Performance-wise is there v 6.7 and the most recent 7.X version?June 15, 2021 at 09:57 #34038
Sorry, that last sentence should have read: performance-wise is there much difference between version 6.7 and the most recent 7.X?June 15, 2021 at 14:25 #34042
Issue of physical desktop not detected could be issue with server configuration where local server is not running. Can you check if the local Xorg/Wayland service is running?June 18, 2021 at 20:38 #34090
Thanks for the help.
I was located next to the NoMachine host/server and could see its desktop’s output on the connected monitor, so no problems with the Xorg service. Another piece of information: when it fails to detect the current physical display, if I select for it to create a new one, it is unable to do so.
Unfortunately another cron issue I just ran into:
I also run a file backup script from cron that I again want run from a terminal emulator that’s displayed on the desktop. Although the dbus-launch trick is able to get the window to show up, the script asks for me to unlock the login keyring when run, something that did not happen with v6.7 in the past. I’d actually had this problem earlier on the physical display and got around it by setting DBUS_SESSION_BUS_ADDRESS=”unix:path=/run/user/1000/bus” but that trick no longer works. Thinking perhaps gnome-terminal was the problem I installed another terminal emulator (Simple Terminal) and although it did not require dbus-launch to get the terminal window to show up, it still asked for the login key ring. Any suggestions for this?
This topic was marked as solved, you can't post.