SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am running into an issue with running a cron that uses notify-send. This scripts works on Gnome and XFCE. For whatever reason, I cannot get it to work on KDE Plasma (-current 5.21.3). From what I have been able to research, it seems to be related to DBUS_SESSION_BUS_ADDRESS not being set. I have tried all sorts of different variations to no avail. Even setting the DISPLAY value doesn't seem to work.
Any thoughts as to what else I am missing? Thanks!
#!/bin/bash
DISPLAY=:1
notify-send -u critical "Remember to check for precip."
It doesn't work in Wayland or with Xorg. I thought it might have been a Wayland thing. This same script works with XFCE in Slackware and Fedora Gnome.
I believe that your "issue" is of completely another nature.
In fact, you just demonstrate that there is a HUGE security issue on XFCE or even Fedora's GNOME, which permits to another user (i.e. the one used by CRON) to send notifications to another user desktop - so, I can imagine someone defacing somehow the "nobody" account then bombing everybody logged in the box with Viagra advertising on desktop popups.
Also, you just demonstrate that KDE Plasma5 has a superior security, and it is NOT VULNERABLE to this particular security issue.
I suggest you to not rely your work on existence of this particular security issue, which probably will be fixed sooner or later by the XFCE and GNOME developers.
Last edited by LuckyCyborg; 03-22-2021 at 06:45 AM.
In fact, you just demonstrate that there is a HUGE security issue on XFCE or even Fedora's GNOME, which permits to another user (i.e. the one used by CRON) to send notifications to another user desktop - so, I can imagine someone defacing somehow the "nobody" account then bombing everybody logged in the box with Viagra advertising on desktop popups.
Also, you just demonstrate that KDE Plasma5 has a superior security, and it is NOT VULNERABLE at this particular security issue.
I suggest you to not rely your work on existence of this particular security issue, which probably will be fixed sooner or later by the XFCE and GNOME developers.
I'm running the cron as my own user while I'm logged in. I don't see how this would be a problem.
I'm running the cron as my own user while I'm logged in. I don't see how this would be a problem.
This is a very important information, you should have been specified.
Then, you need to have somehow an DBUS session started on every console, for this to work with Plasma5.
You can look for the threads regarding PipeWire about our tries to use a DBUS SESSION on the systemd style, started at a whatever user login.
It's not that simple, so IF you do not need that for a greater scope (like running the PipeWire daemons on console), probably better leave at how it is.
Last edited by LuckyCyborg; 03-22-2021 at 06:55 AM.
#!/bin/bash
/usr/bin/mkdir -p ~/.slackpkg
/usr/sbin/slackpkg check-updates | /usr/bin/sed -n '/available/ p' > ~/.slackpkg/updated-repo.txt
username=$(/usr/bin/whoami)
#pid=$(pgrep -u $username kded5)
pid=$(ps -u $username e | grep -m 1 DBUS_SESSION_BUS_ADDRESS | awk '{print $1}')
dbus=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$pid/environ | sed 's/DBUS_SESSION_BUS_ADDRESS=//')
export DBUS_SESSION_BUS_ADDRESS=$dbus
[ -s ~/.slackpkg/updated-repo.txt ] && /usr/bin/notify-send -i dialog-warning "[ S L A C K P K G ]" "Available updates"
Very nice!! Thank you. I'll try that and report back.
Quote:
Originally Posted by LuckyCyborg
This is a very important information, you should have been specified.
Then, you need to have somehow an DBUS session started on every console, for this to work with Plasma5.
You can look for the threads regarding PipeWire about our tries to use a DBUS SESSION on the systemd style, started at a whatever user login.
It's not that simple, so IF you do not need that for a greater scope (like running the PipeWire daemons on console), probably better leave at how it is.
You are right. My apologies for that. I blame the fact that it is still early in the morning where I live and I have yet to have my coffee.
Well, no matter what option I use, notify-send nor kdialog works. I even tried all the options in that thread. The script works fine of course when running from a terminal. I'm pretty stumped. This shouldn't be this difficult. :/
One more thing that I should note is that kdialog does not work even with this environment. Only notify-send does. Perhaps kdialog requires some extra bit of configuration. Just wanted to note that for future reference.
The way plasma is launched in slackware is incorrect imo and fails to set DBUS_SESSION_BUS_ADDRESS properly on launch. Its done correctly for xfce so thats why that works, no idea what happens in gnome because I'm not using that at the moment.
If you are launching plasma from init 3 you can edit your ~/.xinitrc file to correct the behaviour. Look for the line
Any of the above will set the DBUS_SESSION_BUS_ADDRESS environment variable properly. The problem is that "dbus-launch --sh-syntax" echos syntax to set the DBUS_SESSION_BUS_ADDRESS when it completes but that still requires the "eval" to actually set it. The alternative dbus-run-session command does the same thing and sets the variable automatically. The last command checks if theres already a dbus and uses dbus-run-session if it needs to.
Same problem is in the wayland launching script "/usr/bin/startkwayland", you can apply the same fix there. Also applies to the init 4 lanuch of x11 plasma in " /usr/share/xsessions/plasma.desktop". Whichever you use just fix it there. Then you shouldn't have to resort to hacks to get the DBUS_SESSION_BUS_ADDRESS variable.
Been fixing this for a while now in my installs, hoping to see it fixed in slackware 15...
The way plasma is launched in slackware is incorrect imo and fails to set DBUS_SESSION_BUS_ADDRESS properly on launch. Its done correctly for xfce so thats why that works, no idea what happens in gnome because I'm not using that at the moment.
If you are launching plasma from init 3 you can edit your ~/.xinitrc file to correct the behaviour. Look for the line
Any of the above will set the DBUS_SESSION_BUS_ADDRESS environment variable properly. The problem is that "dbus-launch --sh-syntax" echos syntax to set the DBUS_SESSION_BUS_ADDRESS when it completes but that still requires the "eval" to actually set it. The alternative dbus-run-session command does the same thing and sets the variable automatically. The last command checks if theres already a dbus and uses dbus-run-session if it needs to.
Same problem is in the wayland launching script "/usr/bin/startkwayland", you can apply the same fix there. Also applies to the init 4 lanuch of x11 plasma in " /usr/share/xsessions/plasma.desktop". Whichever you use just fix it there. Then you shouldn't have to resort to hacks to get the DBUS_SESSION_BUS_ADDRESS variable.
Been fixing this for a while now in my installs, hoping to see it fixed in slackware 15...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.