0

I'm trying to get source files of some package, it gives that error:

~$ 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)

Files are available but apt cannot extract them:

/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
4
  • 3
    You don't need to run apt source with sudo. Try without. Make sure you are in a filesystem location where you have permission to write (ie somewhere in your home directory) too.
    – Zanna
    Apr 5, 2017 at 17:14
  • Thanks for the comment. It's my laziness. I want that source for entering to source folder with roscd nav_core command to locate sources easily. I didn't think about permissions :P Apr 5, 2017 at 19:18
  • :) Did you fix it then?
    – Zanna
    Apr 5, 2017 at 19:37
  • No :P After getting sources to my personal workspace, renaming the folder makes it work with roscd. But I am not sure, May be renaming isn't necessary :P I will try it tomorrow :) Apr 5, 2017 at 19:46

1 Answer 1

3

Just use apt-get source command without sudo prefix; it will write to current directory.

The warning was reworded after Bug Report: Can't drop privileges when running apt-get source as root | Debian Bug report logs (and dozens of other reports of the same feature)

I don't get why there are bug reports about that. If you fetch in a directory _apt cannot write to, it will run the fetchers as root instead of _apt so you can do whatever foolish (no root needed here) task you are trying to do.

We could also just make it an error and say: This command does not work as root, but that won't make people happy either.

While we might want to solve this at some point, this is no huge deal, and would require a huge amount of work to fix.

Warning was reworded:

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…
2
  • I also tried with root user, same thing happened. Aug 22, 2017 at 16:18
  • Thank you for answer. I was trying to get sources to installation directory, for entering roscd some_package command. But I found another solution. Explained on comments above. Aug 22, 2017 at 16:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.