XGD_RUNTIME error with custom Pacman hook.

The Patient's vitals. Of course the patient could also be a PEBKAC error.

I'm using @tbg's awesome Timeshift hook.

The Issue

This hook includes a killshot whereby you hit any key within 10 seconds and it'll stop the snapshot.

When I hit a key it tells me:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-shaeda'

But prompts me for a password which fails. It asks for the password again but if I type it again, the first character of the password will close the window. It'll then continue with the snapshot.

env (Just the XDG_RUNTIME_DIR listing)


ls -la

drwx------ 9 shaeda shaeda 320 Sep  6 15:16 .
drwxr-xr-x 3 root   root    60 Sep  6 12:25 ..
srw-rw-rw- 1 shaeda shaeda   0 Sep  6 12:25 bus
drwx------ 3 shaeda shaeda  60 Sep  6 12:25 dbus-1
drwx------ 2 shaeda shaeda  60 Sep  6 14:35 dconf
drwx------ 2 shaeda shaeda 140 Sep  6 12:25 gnupg
dr-x------ 2 shaeda shaeda   0 Sep  6 12:25 gvfs
srw------- 1 shaeda shaeda   0 Sep  6 12:25 kdeinit5__0
srw------- 1 shaeda nobody   0 Sep  6 15:16 kdesud_:0
srwxr-xr-x 1 shaeda shaeda   0 Sep  6 12:25 klauncherEqKEPw.1.slave-socket
-rw-r--r-- 1 shaeda shaeda  67 Sep  6 12:25 KSMserver__0
srwxr-xr-x 1 shaeda shaeda   0 Sep  6 12:25 kwallet5.socket
drwxr-xr-x 2 shaeda shaeda  60 Sep  6 12:25 p11-kit
srw-rw-rw- 1 shaeda shaeda   0 Sep  6 12:25 pipewire-0
drwx------ 2 shaeda shaeda 100 Sep  6 12:25 pulse
drwxr-xr-x 2 shaeda shaeda  80 Sep  6 12:25 systemd

Lastly, I've confirmed multiple times that the user was replaced in all parts of the hook with my username.

Can't seem to figure out what the deal is.
I apprecaite any help.

It's a KDE thing I think.

It's always there on every KDE install I've done.


I'm thinking this modification to the hook should hopefully satisfy the required variables. Sometimes you need to specify more though.

Exec = sudo -Hiu shae /bin/sh -c "DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1000 konsole -e /etc/pacman.d/hooks.bin/killshot.sh | /etc/pacman.d/hooks.bin/timeshift.sh"

Assuming "shae" is your username and your uid is 1000.

Anytime you execute a command as root that must run in userspace you sometimes need to list different environment variables for it to work . Usually "DISPLAY=:0" is enough, but depending on what you are doing sometimes you need to specify far more. It's a bit like black magic sometimes to figure out the required variables.

The modified command runs on my system just fine, but then my old box hasn't been compromised by the @kdemeoz computer poltergeist.


Just to make sure I'm not an idiot (How can we ever be certain)...

This is for 50-timeshift.hook, correct?

That's just your opinion. :smiley: :wink: :slight_smile:

Says a German comedian in a movie.
Among other things he is the boss of sayings:
'I need more details. '

1 Like



Operation = Upgrade
Type = Package
Target = *

Description = pre-upgrade timeshift snapshot
When = PreTransaction
Exec = sudo -Hiu shae /bin/sh -c "DISPLAY=:0 XDG_RUNTIME_DIR=/run/user/1000 konsole -e /etc/pacman.d/hooks.bin/killshot.sh | /etc/pacman.d/hooks.bin/timeshift.sh"

You can never be sure. If it works, you guessed right. If not, back to the drawing board.


Trying to find something I forgot to install to test it. :roll_eyes:

That hook is kde specific as it uses the konsole terminal.

Replace " konsole" with the name of the terminal emulator that you use on your system. Not all terminal emulators will launch properly using the "-e" (execute) parameter. The gnome terminal may be problematic to auto-execute with this script.


Problem Child is back.

Looks like it doesn't work.
I hadn't noticed because I haven't install a bunch of apps nor done and update since then.
But todays update for testing threw this error.

:: Running pre-transaction hooks...
(1/1) pre-upgrade timeshift snapshot
call to execv failed (No such file or directory)
error: command failed to execute correctly

I've seen it once before when I updated an AUR package but got side tracked and forgot.

I noticed today.

Not really sure what's going on with your hook, because I've never seen any errors like that. The only error I see is that the backup failed when I cancel it (which is not really an error because that was intended).

Are you sure you have the paths to both scripts correct?

Which terminal are you trying to launch the scripts from?

I use Konsole, but other terminals can be fussy a bout launching with the "-e" parameter.

Are you using bash as your shell?

I've changed nothing except the path to the timeshift backup location and my username.
They worked previously and I haven't tinkered with them since.
I went and checked again and everything is unchanged.

Konsole and bash

I tried googling that execv error and pfft. There's all kinds of bizarre stuff on it but nothing as far as I could (about two inches in front of me) see.
I even read through man execv. Man pages give me a headache.

I'm going to go through the files again right now. It's like the 40th time I've done it in the last hour. I'm probably missing something.

EDIT: The only change is the KDE specific change you posted a couple posts up. Because of the XDG error that was happening.

It's too bad there's no similar feature as running the status command with a hook as with a service. When writing a service the errors in the status output are very helpful for debugging purposes.

Sadly, it's really hard to debug this kind of stuff remotely without some kind of smoking gun in the logs. Sorry but I'm not sure if there's anything further I can suggest at this point.

1 Like

I'm going to go back to the original 50-timeshift. It should fire off the timeshift snapshot.
If so, I'll just live with no being able to cancel it.
Boy, I sure do have some freakish issues. :smirk:

Thank you @tbg. I understand the remote assistance problem.

So, I should be there in a few hours. I'll be the person riding a Moose with a pink boa, weird clothes, and bunny ears hair band.
I'll bring some tacos too.

1 Like

Perhaps you could try adding your .Xauthority environment variable that is sometimes required.

Ok, I'll give that a try after lunch. :grin:

This is correct yes?

Nope, I believe you would want:

Exec = sudo -Hiu shae /bin/sh -c "DISPLAY=:0 XAUTHORITY=/home/shae/.Xauthority XDG_RUNTIME_DIR=/run/user/1000 konsole -e /etc/pacman.d/hooks.bin/killshot.sh | /etc/pacman.d/hooks.bin/timeshift.sh"

Is that almost a long enough one liner for you. :smiley:


Forum kindly sponsored by Bytemark