in luckybackup i schedule a job this add a job in cron
env DISPLAY=:0 /usr/bin/luckybackup …
task is well launched at the expected time but no gui and no execution of the backup
i must terminate luckybackup with terminate command.
log of luckybackup
Invalid MIT-MAGIC-COOKIE-1 key
No protocol specified
No protocol specified
No protocol specified
…
No protocol specified
No protocol specified
No protocol specified
When you start a GUI program from the background (cron or other), there is no guarantee whatsoever that a GUI is running in the first place (or do you expect the background program to start X (when not running) and then log in in the Display Manager?).
OTOH there may be already a running GUI session, but there may even be more then one. So which one to choose? You tried to solve that by specifying the session to be used (DISPLAY=:0), but are you sure that session is the correct one? In any case your program (luckybackup) can not “lnow this”.
And even when all this is by incident working together, the owner of the running session on DISPLAY=:0 has the final saying. You can not without approval og the owner of a session open windows on a session from outside. That would be a huge security hole. that would e.g.allow anybody to trace all keyboard srokes from outside (remember that basically that outside program may even run on another system and try to use the GUI session over the network).
For that the GUI session owner can allow outside host/user combinations to use his GUI. Earlier there was the tool xhosts for this, but it isn’t available in todays openSUSE. Most probably because of security.
I think you should think over the implications of what you want: allowing a program to open a window on a session where that program is not running from, on in a multi-user and multi-session operating system like Linux.
For many years i used cron to start luckybackup without no problem and without any action from me about any security feature thus with default opensuse security.
suddenly since 2017 12 14 i have got this problem.
I don’t use lucky backup,
And, your referenced thread is confusing… one moment your backup is working, next it’s not. Or is it actually working?
In any case,
I noticed the person assisting you described using the “xhost +” command for X11 access control, and you should know that some serious flaws were discovered or more accurately re-evaluated late last year… So, it’s possible or likely that if lucky backup relies on the “xhost +” command anywhere, it might not work the same today (or shortly) as it has in the past. You should find some info on this with a simple Internet search.
I don’t know why a backup cron job should need to launch a graphical window, practically every graphical app on Linux can be run entirely in non-graphical mode.
HTH but obviously not able to offer anything solid,
TSU
This guide provides a good overview openSUSE: X Window System and X AuthenticationAs Tsu pointed out xhost authentication has some security issues, so not advisable. In any case the following can be done to grant X-server access to a root-owned process running outside of X.
xhost +si:localuser:root
As a test, I then changed to a VT (CTRL+ALT+F3) and was able to start a graphical app from tty3 using
# env DISPLAY=:0 /path/to/graphical-utility
When I went back to tty7, there it was running.
I then revoked these rights with ‘xhost -si:localuser:root’ and used Xauthority instead. This has to pertain to the user that has an active X-session already of course…
Jan 16 11:49:07 linux-58nc crontab[4705]: (roubach) LIST (roubach)
Jan 16 11:49:07 linux-58nc crontab[4706]: (roubach) REPLACE (roubach)
Jan 16 11:49:07 linux-58nc crontab[4707]: (roubach) LIST (roubach)
Jan 16 11:49:18 linux-58nc crontab[4829]: (roubach) LIST (roubach)
Jan 16 11:50:01 linux-58nc cron[2754]: (roubach) RELOAD (/var/spool/cron/tabs/roubach)
Jan 16 11:50:23 linux-58nc su[4853]: The gnome keyring socket is not owned with the same credentials as the user login: /run/user/1000/keyring/control
Jan 16 11:50:23 linux-58nc su[4853]: gkr-pam: couldn’t unlock the login keyring.
Jan 16 11:50:23 linux-58nc su[4853]: (to root) roubach on pts/0
Jan 16 11:50:23 linux-58nc su[4853]: pam_unix(su-l:session): session opened for user root by roubach(uid=1000)
Jan 16 11:50:23 linux-58nc su[4853]: pam_systemd(su-l:session): Cannot create session: Already running in a session
in luckybackup log :
Invalid MIT-MAGIC-COOKIE-1 keyNo protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :0
Could not connect to any X display.
i uninstalled gnome keyring because skype uses libresecret now.
thus we get something less complicated :
Jan 16 12:41:01 linux-58nc CRON[4463]: (roubach) CMD (env DISPLAY=:0 /usr/bin/luckybackup --silent --skip-critical /home/roubach/.luckyBackup/profiles/default.profile > /home/roubach/.luckyBackup/logs/default-LastCronLog.log 2>&1)
Jan 16 12:41:01 linux-58nc CRON[4461]: pam_unix(crond:session): session closed for user roubach
Jan 16 12:43:21 linux-58nc su[4542]: (to root) roubach on pts/0
Jan 16 12:43:21 linux-58nc su[4542]: pam_unix(su-l:session): session opened for user root by roubach(uid=1000)
Jan 16 12:43:21 linux-58nc su[4542]: pam_systemd(su-l:session): Cannot create session: Already running in a session
Hi!
I have same trouble, but your solution doesn’t work fo me (openSUSE Tumbleweed.).
I get this error when i run cron-task from gui:
Invalid MIT-MAGIC-COOKIE-1 keyNo protocol specified
qt.qpa.screen: QXcbConnection: Could not connect to display :0
Could not connect to any X display.
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
All the reasons given for having to execute luckybackup in graphical mode eg notifications) don’t hold water.
There are many examples where apps have both a graphical and command line interface, and when the interface is separated from the functionality, it’s trivial to invoke whatever you wish. The key of course for the application to be properly written in modular form and separating the UI from functionality.
Since this issue about having to run xhost+ has come up a few times,
This is a big sign that luckybackup should be looking at whether they should be looking at refactoring their codebase.
One day, even these workarounds may not exist because of the security risks they introduce.
So with thanks to the contributors to this thread this works for me, but I don’t understand why it stopped working.
I’m posting this as I had trouble finding a solution with crontab and kdialog in it and maybe it will help someone.