![linux-generate 无法安装](https://linux22.com/image/1029321/linux-generate%20%E6%97%A0%E6%B3%95%E5%AE%89%E8%A3%85.png)
我有一个 Dockerfile,它基于 Ubuntu 22.04 编译自定义 Linux 内核。直到今天早上,它一直运行良好,但现在在运行步骤时失败,并apt-get update && apt-get build-dep -y linux linux-signed
出现以下错误:
The following packages have unmet dependencies:
builddeps:linux-signed : Depends: linux-generate (= 5.15.0-60.66) but it is not installable
我已将deb-src
我的 apt 源中的所有行都取消注释。
root@ef3c9ab828f8:/# cat /etc/apt/sources.list | grep deb-src
deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ jammy multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ jammy-backports main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted
deb-src http://security.ubuntu.com/ubuntu/ jammy-security universe
deb-src http://security.ubuntu.com/ubuntu/ jammy-security multiverse
什么是linux-generate
?无论我在哪里寻找(谷歌apt-cache search
,https://launchpad.net/ubuntu/+source/linux-generate)我找不到该包或有关它的任何信息。
更新
这是一个产生问题的最小 Dockerfile(在两个不同的主机上测试):
FROM ubuntu:22.04
RUN sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list
RUN apt-get update
RUN apt-get build-dep -y linux linux-signed
更新 2:
root@16e6b6976fda:/# apt policy linux-generate
N: Unable to locate package linux-generate
答案1
免责声明:仅为部分解决方案。
我在 ubuntu 20.04 上使用了一种略有不同的构建方法。使用当前内核版本 5.4.0-144(截至 2023-03-03)。我的构建脚本运行以下命令:
sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list
apt update
apt -y build-dep linux-image-5.4.0-144-generic
这失败了builddeps:linux-signed : Depends: linux-generate (= 5.4.0-144.161) but it is not installable
但是,如果没有指定内核版本,该命令将会成功:
sed -i 's/# deb-src/deb-src/' /etc/apt/sources.list
apt update
apt -y build-dep linux-image-generic
此解决方法也适用于 ubuntu 22.04。