Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to lock my screen on my XUbuntu machine and am failing. I tried using xflock and I get the following error when I run it from the terminal.

/usr/bin/xflock4: 29: /usr/bin/xflock4: xlock: not found

What am I doing wrong? Any hints on how I can rectify this?

share|improve this question

Reading /usr/bin/xflock4 you'll see that the script first checks if xscreensaver or gnome-screensaver are running.

If neither of these are running the script will try to run xlock and then maybe slock.

My 12.04.3 system has been upgraded over the years. In the past I had to edit xflock4 because it wasn't properly detecting if xsreensaver or gnome-screensaver was running.

Early versions used "pgrep xscreensaver". This didn't work properly so I needed to use "ps aux | x[s]creensaver" to detect xscreensaver for instance.

Today my script just has a #comment stating it checks if xscreensaver or gnome-screensaver is running. Not sure if an upgrade to 12.04 out this in place or I took if from a system higher than 12.04.

share|improve this answer
I suppose you used ps aux | grep x[s]creensaver. In the original xflock4 for 12.04 xlock is the last option; that explains the error. – jarno Jan 28 at 16:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.