我需要下载我正在运行的 Ubuntu 内核的源代码。所以我跟着 these instructions 。下载几乎成功。就在它的最后,我得到了:



有谁知道问题是什么以及我应该怎么做?

最佳答案

https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel 页面说只运行 apt, 没有任何 sudo 前缀:

  apt-get source linux-image-$(uname -r)`

因此,只需在没有 sudo 前缀的情况下启动它。

许多流行的 apt 命令如 apt install 会写入一些全局数据库和文件,并且应该以 sudo 开头。但是 apt-get source 和大多数 apt-cache 都没有特权,可以从任何用户运行。 apt-get source 会写入当前目录,从 root 启动时从特殊的伪用户下载文件是一个安全功能......

这被多次报告给 bugzillas,并在 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813786 中改写
$ LANG=C sudo apt-get source debian-installer
W: Can't drop privileges for downloading as file 'debian-installer_20160106.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)



警告被改写:
Note: This is a warning about disabling a security feature. It is
supposed to be scary as we are disabling a security feature and we
can't just be silent about it! Downloads really shouldn't happen
any longer as root to decrease the attack surface – but if a warning
causes that much uproar, consider what an error would do…

The old WARNING message:
| W: Can't drop privileges for downloading as file 'foobar' couldn't be
| accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
is frequently (incorrectly) considered to be an error message indicating
that the download didn't happen which isn't the case, it was performed,
but without all the security features enabled we could have used if run
from some other place…

关于linux - Ubuntu 内核源代码下载过程中出错,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45766719/

10-16 19:13