为什么“apt-get source”会因“权限被拒绝”错误而失败?

为什么“apt-get source”会因“权限被拒绝”错误而失败?

当我尝试获取当前正在运行的内核的源时出现以下错误。

目前我正在使用以下内核:

ignite@ignite:~$ uname -a
Linux ignite 3.5.0-17-generic #28-Ubuntu SMP
Tue Oct 9 19:32:08 UTC 2012 i686 i686 i686 GNU/Linux

我收到以下错误。我已将名称 http 更改为 htt,因为论坛不允许我发布太多链接。

ignite@ignite:/boot$ apt-get source linux-image-$(uname -r)
Reading package lists... Done
Building dependency tree
Reading state information... Done
Picking 'linux' as source package instead of 'linux-image-3.5.0-17-generic'
NOTICE: 'linux' packaging is maintained in the 'Git' version control system at:
http://kernel.ubuntu.com/git-repos/ubuntu/ubuntu-quantal.git
Need to get 106 MB of source archives.
Err http://my.archive.ubuntu.com/ubuntu/ quantal-updates/main linux 3.5.0-30.51 (dsc)
  404  Not Found [IP: 91.189.92.202 80]
Err http://my.archive.ubuntu.com/ubuntu/ quantal-updates/main linux 3.5.0-30.51 (tar)  
  Could not open file linux_3.5.0.orig.tar.gz - open (13: Permission denied) [IP: 91.189.92.202 80]
Err http://my.archive.ubuntu.com/ubuntu/ quantal-updates/main linux 3.5.0-30.51 (diff)
  404  Not Found [IP: 91.189.91.13 80]
Failed to fetch http://my.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_3.5.0-30.51.dsc
  404  Not Found [IP: 91.189.92.202 80]
Failed to fetch http://my.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_3.5.0.orig.tar.gz
  Could not open file linux_3.5.0.orig.tar.gz - open (13: Permission denied) [IP: 91.189.92.202 80]
Failed to fetch http://my.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_3.5.0-30.51.diff.gz
  404  Not Found [IP: 91.189.91.13 80]
E: Failed to fetch some archives.

请建议如何解决此错误并获取内核源。

答案1

您正在要求 apt-get 下载内核源代码并将其复制到您的/boot目录中。/boot不是所有人都可写的,因此您收到以下错误:

Could not open file ... - open (13: Permission denied)

apt-get source只需在另一个目录中运行,例如您的主目录:

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

切勿将无用的文件放在主目录之外。使用sudo apt-get source肯定会达到您的目的,但是您的/boot目录将被无用的文件和目录污染。这是一种非常糟糕的做法。

相关内容