我正在尝试获取某些包的源文件,但出现了以下错误:
~$ sudo apt source ros-kinetic-nav-core
Reading package lists... Done
Need to get 6.606 B of source archives.
Get:1 http://packages.ros.org/ros/ubuntu xenial/main ros-kinetic-nav-core 1.14.0-0xenial (dsc) [1.061 B]
Get:2 http://packages.ros.org/ros/ubuntu xenial/main ros-kinetic-nav-core 1.14.0-0xenial (tar) [3.509 B]
Get:3 http://packages.ros.org/ros/ubuntu xenial/main ros-kinetic-nav-core 1.14.0-0xenial (diff) [2.036 B]
Fetched 6.606 B in 4s (1.455 B/s)
dpkg-source: warning: extracting unsigned source package (ros-kinetic-nav-core_1.14.0-0xenial.dsc)
dpkg-source: info: extracting ros-kinetic-nav-core in ros-kinetic-nav-core-1.14.0
dpkg-source: info: unpacking ros-kinetic-nav-core_1.14.0.orig.tar.gz
dpkg-source: info: unpacking ros-kinetic-nav-core_1.14.0-0xenial.debian.tar.xz
W: Can't drop privileges for downloading as file 'ros-kinetic-nav-core_1.14.0-0xenial.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
文件可用,但 apt 无法提取它们:
/opt/ros/kinetic/share/nav_core$ ls
cmake ros-kinetic-nav-core-1.14.0 ros-kinetic-nav-core_1.14.0-0xenial.dsc
package.xml ros-kinetic-nav-core_1.14.0-0xenial.debian.tar.xz ros-kinetic-nav-core_1.14.0.orig.tar.gz
答案1
只需使用apt-get source
不带前缀的命令sudo
;它将写入当前目录。
警告被重新措辞后错误报告:以 root 身份运行 apt-get source 时无法放弃权限 | Debian 错误报告日志(以及数十份关于同一特征的其他报告)
我不明白为什么会有关于此的错误报告。如果您在 _apt 无法写入的目录中获取数据,它将以 root 身份而不是 _apt 身份运行获取程序,这样您就可以执行任何愚蠢的任务(这里不需要 root)。
我们也可以将其设为错误并说:此命令不能以 root 身份运行,但这也不会让人高兴。
虽然我们可能希望在某个时候解决这个问题,但这并不是什么大问题,而且需要大量的工作来解决。
警告被重新表述为:
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…