Note that there are some explanatory texts on larger screens.

plurals
  1. POScripts launched from udev do not have DISPLAY access anymore?
    primarykey
    data
    text
    <p>I have a script that runs from <code>udev</code> when I plug in my external drive. It always worked. But after upgrading from <strong>Linux 3.8/Xorg 1.12/Mint 14</strong> (<strong>Ubuntu 12.10</strong> compatible) to <strong>Linux 3.11/Xorg 1.14/Mint 16</strong> (<strong>Ubuntu 13.10</strong> compatible), it doesn't work anymore.</p> <p>The script still runs, but none of the commands that require the display work. I figured that out by quitting the <code>udev</code> daemon and manually run <code>udevd --debug</code> for verbose output (more below).</p> <p>This script used to work in <strong>Mint 14/12.10</strong>:</p> <pre><code>export DISPLAY=:0 UUID=$1 DEV=$2 notify-send -t 700 "mounting $DEV ($UUID)" gnome-terminal -t "Backing up home..." -x rsync long line of data zenity --warning --text="Done." </code></pre> <p>But not anymore in <strong>Mint 16/13.10</strong>. In case you are wondering about possible solutions, I gradually added stuff and now it looks like this:</p> <pre><code>export DISPLAY=:0.0 xhost +local: xhost +si:localuser:root xhost + DISPLAY=:0.0 export DISPLAY=:0.0 UUID=$1 DEV=$2 notify-send -t 700 "mounting $DEV ($UUID)" gnome-terminal -t "Backing up home..." -x rsync long line of data zenity --warning --text="Done." --display=:0.0 </code></pre> <p>But it still doesn't work. <code>udevd --debug</code> still shows this:</p> <pre><code>'(err) 'No protocol specified' '(err) '' '(err) '** (gnome-terminal:24171): WARNING **: Could not open X display' '(err) 'No protocol specified' '(err) 'Failed to parse arguments: Cannot open display: ' '(err) 'No protocol specified' '(err) '' '(err) '** (zenity:24173): WARNING **: Could not open X display' '(err) 'No protocol specified' '(err) '' '(err) '(zenity:24173): Gtk-WARNING **: cannot open display: :0.0' '(err) 'No protocol specified' </code></pre> <p>Note that any bash logic works. Echoing test vars to <code>&gt;&gt;/tmp/test.log</code> works. It's just accessing the display that does not work anymore.</p> <p>This is driving me crazy. What is the correct way to achieve this now?</p> <h2>Update 2013-12-20</h2> <p>So, in the previous Ubuntu, <code>X</code> commands would automatically find it's way to the current <code>X</code> using user.</p> <p>Now, I seem to need these two things <em>every time</em>:</p> <ul> <li>On the <code>X</code> using user: <ul> <li><code>xhost +si:localuser:root</code></li> </ul></li> <li>On the <code>root/udev</code> side: <ul> <li>Copy <code>X</code> using users' <code>~/.Xauthority</code> file to <code>/root</code></li> </ul></li> </ul> <p>This 'feels' like a step back in time. This only works scripted when I log in as the same user everytime, so I can copy the <code>.Xauthority</code> file from that users' home when the script executes.</p> <p>What 'trick' did the old Ubuntu use to have this done auto'magic'ally?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload