You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04.2中linux-image-virtual安装失败,依赖包linux-modules-5.15.0-76-generic无安装候选的问题求助

Ubuntu 22.04.2中linux-image-virtual安装失败,依赖包linux-modules-5.15.0-76-generic无安装候选的问题求助

嘿,我完全懂你遇到的困扰!在Ubuntu 22.04.2上执行完apt-get update后,升级系统时发现linux-image-virtual被保留,手动安装又碰到依赖包找不到的报错,我之前也踩过这个坑,下面是我整理的排查和解决方法:

问题复现

先把我当时遇到的和你一模一样的命令行输出贴出来,方便对照:

root@host3:~# apt-get upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
linux-image-virtual
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

接着尝试手动安装linux-image-virtual时:

root@host3:~# apt-get install linux-image-virtual
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
linux-image-5.15.0-76-generic : Depends: linux-modules-5.15.0-76-generic but it is not installable
E: Unable to correct problems, you have held broken packages.

单独安装缺失的依赖包时:

root@host3:~# apt-get install linux-modules-5.15.0-76-generic
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package linux-modules-5.15.0-76-generic 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 'linux-modules-5.15.0-76-generic' has no installation candidate

解决方法

1. 检查并更新软件源

这个问题大概率是官方源里已经移除了5.15.0-76版本的内核包(Ubuntu会定期淘汰旧版本内核),所以先确保你的软件源是最新的:

  • 先备份当前源配置(以防操作出错):
    cp /etc/apt/sources.list /etc/apt/sources.list.bak
    
  • 重新生成适用于Ubuntu 22.04(jammy)的官方源配置:
    echo "deb http://archive.ubuntu.com/ubuntu jammy main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu jammy-updates main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu jammy-backports main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu jammy-security main restricted universe multiverse" > /etc/apt/sources.list
    
  • 再次刷新源缓存:
    apt-get update
    

2. 使用dist-upgrade自动处理依赖

apt-get dist-upgrade比普通的upgrade更智能,它会自动调整依赖关系,包括移除旧包、安装必要的新依赖:

apt-get dist-upgrade

执行完成后,再检查linux-image-virtual是否已经正常安装。

3. 安装源中可用的最新内核虚拟包

如果上面的方法没解决,先查看当前源里可用的linux-image-virtual版本:

apt-cache policy linux-image-virtual

然后直接安装最新可用的版本,或者用以下命令强制安装带推荐依赖的包:

apt-get install --install-recommends linux-image-virtual

4. 清理破损依赖状态

如果系统存在破损依赖,先修复后再尝试安装:

apt-get clean
apt-get autoclean
apt-get -f install

总结

这个问题核心原因是目标内核版本已从官方源下架,只要确保源配置最新,通过dist-upgrade或直接安装最新可用版本就能解决。

备注:内容来源于stack exchange,提问作者Fabian Santiago

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 11:49:38