由于 libc,perf 损坏

由于 libc,perf 损坏

我正在尝试在 Ubuntu 18.04 上安装 perf。但是,我遇到了libc依赖性问题:

$ 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

还有其他人遇到过这个问题吗?有什么办法可以解决吗?

答案1

在@DougSmithies的建议下,我进行了源代码构建perf。这相当简单,但并不简单,因此这里是说明。

1)克隆Linux内核:

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

2) 通过 找到您的内核uname -r,并通过搜索git tags 来检出相应的内核分支。所以对我来说:

linux$ git checkout v5.0

3)安装一些依赖项:

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

tools/perf/Makefile解释每个依赖项的目的。

3)进入perf目录并运行:

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

4)编辑/proc/sys/kernel/perf_event_paranoid(和/或?)/etc/sysctl.conf使得其中的唯一值是-1

5)获取 root shell 并

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

我现在有perf

答案2

看来您在 sources.list 中提出了 bionic-proposed。如果是这样

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

这只有当你集成了仿生技术后才能发挥作用。

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

剪掉

相关内容