I have been trying to install xlock using the command

sudo apt-get install xlock

It outputs this instead of installing xlock:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package xlock is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'xlock' has no installation candidate

I have already done the two following commands before trying to install xlock respectively:

sudo apt-get update 
sudo apt-get upgrade

In case the reader simply doesn't think xlock doesn't exist, here is the url for its man page: here

I am new to Linux (six month year old user) so I am far from knowledgeable. Please help.

  • What do you mean by xlock? Is it PAM-related? – N0rbert Aug 9 '18 at 8:11
  • I’m not sure. I’m sorry. I’m new to Linux and I don’t know if it is. You could check the man page on the link if that helps though. – user10121076 Aug 10 '18 at 7:07

You can download and install it manually:

1. Download archive from http://sillycycle.com/xlock/
2. Unpack (into e.g. /tmp/xlockmore)
3. Install build deps: apt install build-essential libx11-dev libxext-dev libxt-dev
4. cd /tmp/xlockmore; ./configure; make; make install
| improve this answer | |

You chose wrong package: xclock is available in x11-apps package.
Check on the https://packages.ubuntu.com.

So the correct command is:

sudo apt-get install x11-apps

Also if you do not know/remember package name you can write its executable name in terminal to get the suggestion from command-not-found tool:

$ xlock

Command 'xlock' not found, did you mean:

  command 'lxlock' from deb lxlock
  command 'slock' from deb suckless-tools
  command 'vlock' from deb vlock
  command 'flock' from deb util-linux
  command 'rlock' from deb ruby-lockfile
  command 'wlock' from deb sendfile
  command 'xclock' from deb x11-apps
  command 'mlock' from deb mlock

Try: sudo apt install <deb name>

$ xclock 

Command 'xclock' not found, but can be installed with:

sudo apt install x11-apps

If you really mean xlock, then according to its Ubuntu man xlock-page it is removed after Ubuntu 12.04 LTS

I found PPA ppa:chaocrator-ppa/anarchy (it has package for 16.04 LTS, but not for 18.04 LTS) with needed xlockmore-gl package. You can install it with commands below:

cd ~/Downloads
wget http://ppa.launchpad.net/chaocrator-ppa/anarchy/ubuntu/pool/main/x/xlockmore/xlockmore-gl_5.31-0~xenial_amd64.deb
sudo apt-get install ./xlockmore-gl_5.31-0~xenial_amd64.deb
| improve this answer | |
  • WOAH! I didn’t know that! I’ll check it out when I get home. I’m still out but thanks for sharing that information with me! – user10121076 Aug 10 '18 at 7:12
  • I tried installing and using all the commands printed when I type xlock into the CLI but it isn’t the command I’m looking for. I’m looking for the one described in the url in my question. – user10121076 Aug 10 '18 at 18:24
  • See updates. I found man-page and PPA with xlock. – N0rbert Aug 11 '18 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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