0

I'm trying to install perf on Ubuntu 18.04. However, I've run into a libc dependency problem:

$ perf
WARNING: perf not found for kernel 5.0.0-21

  You may need to install the following packages for this specific kernel:
    linux-tools-5.0.0-21-generic
    linux-cloud-tools-5.0.0-21-generic
$ sudo apt install linux-cloud-tools-5.0.0-21-generic
The following packages have unmet dependencies:
 linux-tools-5.0.0-21-generic : Depends: linux-tools-5.0.0-21 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install linux-cloud-tools-5.0.0-21
The following packages have unmet dependencies:
 linux-tools-5.0.0-21 : Depends: libc6 (>= 2.28) but 2.27-3ubuntu1 is to be installed
E: Unable to correct problems, you have held broken packages.
$ sudo apt install libc6
libc6 is already the newest version (2.27-3ubuntu1).
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.2 LTS
Release:    18.04
Codename:   bionic

Has anyone else hit this and it there any way around it?

  • 1
    Ubuntu places a lot of unnecessary dependencies on many of the kernel provided tools, including pref, but also turbostat and others. Extremely annoying. You could compile perf yourself and use that or just find the actual perf program and use it directly, instead of that script they use (/usr/bin/perf). – Doug Smythies Jul 10 at 20:42
  • @DougSmythies: Astonishingly simple and effective solution. It takes seconds to build it from source. – user14717 Jul 10 at 20:53
  • @DougSmythies: If you put the build instructions in the answer section I'll accept it. Otherwise I'll put the build instructions there. – user14717 Jul 10 at 21:14
  • O.K. give me some time. – Doug Smythies Jul 10 at 21:17
  • Actually, you better do it. It turns out I only know how to do it from the upstream git master code tree, which is all I use. I do not know how to do it from an Ubuntu installed kernel. – Doug Smythies Jul 10 at 21:28
1

At the recommendation of @DougSmithies, I did a source build of perf. It was pretty easy, but not trivial, so here are the instructions.

1) Clone the linux kernel:

$ git clone https://github.com/torvalds/linux.git

2) Find your kernel via uname -r, and checkout the corresponding kernel branch via searching through the git tags. So for me:

linux$ git checkout v5.0

3) Install a few dependencies:

linux$ sudo apt install bison flex libelf-dev systemtap-sdt-dev libssl-dev libslang2-dev liblzma-dev libdw-dev libunwind-dev libgtk2.0-dev binutils-dev libbabeltrace-dev libiberty-dev libperl-dev libaudit-dev

The tools/perf/Makefile will explain the purpose of each dependency.

3) Change into the perf directory, and run:

linux/tools/perf$ make
linux/tools/perf$ make install

4) Edit /proc/sys/kernel/perf_event_paranoid (and/or?) /etc/sysctl.conf so that the only value therein is -1.

5) Get a root shell and

$ sudo bash
# echo 0 > /proc/sys/kernel/kptr_restrict

Now I have perf!

  • Good thorough answer. Myself, I don't bother with checking out the same version as the kernel I am running. Actually, I very very rarely even bother to recompile it. – Doug Smythies Jul 11 at 14:52
0

It seems you have bionic-proposed in your sources.list. If so

 sudo apt install -t bionic-proposed linux-tools-generic-hwe-18.04-edge linux-cloud-tools-generic-hwe-18.04-edge

This can only work if you have bionic-proposed is integrated.

sudo apt --dry-run install -t bionic-proposed linux-tools-generic-hwe-18.04-edge linux-cloud-tools-generic-hwe-18.04-edge
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  linux-cloud-tools-5.0.0-21-generic linux-cloud-tools-common linux-hwe-cloud-tools-5.0.0-21 linux-hwe-tools-5.0.0-21
  linux-tools-5.0.0-21-generic
The following packages will be REMOVED:
  libllvm7*
The following NEW packages will be installed:
  linux-cloud-tools-5.0.0-21-generic linux-cloud-tools-common linux-cloud-tools-generic-hwe-18.04-edge
  linux-hwe-cloud-tools-5.0.0-21 linux-hwe-tools-5.0.0-21 linux-tools-5.0.0-21-generic linux-tools-generic-hwe-18.04-edge

snip

  • sudo apt install -t bionic-proposed linux-tools-generic-hwe-18.04-edge linux-cloud-tools-generic-hwe-18.04-edge E: The value 'bionic-proposed' is invalid for APT::Default-Release as such a release is not available in the sources – user14717 Jul 10 at 19:33
  • Seems like that might not be the problem? I've never seen what you were doing there before! – user14717 Jul 10 at 19:34

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.