I have a piece of software which I would like to install in a separate hierarchy beneath $HOME/local on an Ubuntu 16.04 machine.

The software is distributed as a Debian package, and the source code is not available (I would happily have downloaded it and compiled it myself had it been).

I don't have (and should not have) sudo access on the machine I'm attempting this on. The software is not to be installed system-wide, but only for my personal use.

I tried to

$ dpkg --root="$HOME/local" -i package_x.y.z_x86_64.deb

but I get

dpkg: error: requested operation requires superuser privilege

After trying with --force-all and creating all the necessary files and directories needed to satisfy dpkg (local/usr/bin, local/var/dpkg with subdirectories info, triggers and updates, along with an empty status file in local/var/dpkg), I get stuck with

$ dpkg --root=$HOME/local -i --force-all package-x.y.z_x86_64.deb
dpkg: could not open log '/var/log/dpkg.log': Permission denied
(Reading database ... 0 files and directories currently installed.)
Preparing to unpack package_x.y.z_x86_64.deb ...
Unpacking package (1:x.y.z) ...
dpkg: error processing archive package_x.y.z_x86_64.deb (--install):
 error setting ownership of './usr/bin/application': Operation not permitted
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:

It's obviously failing to chown the files to the correct users in accordance with the package specification.

The next step for me would probably be to have a talk with the sysadmins on this machine to see if they could install this software for me, but I wonder if there's something I've missed that would have allowed me to have my own local package installation root?

  • dpkg is used to install packages system-wide. To install locally, presuming that all the requisite libraries et al. are installed, obtain a tarball and install it manually somewhere inside $HOME. – DopeGhoti Jun 13 '17 at 17:19
  • Your best bet is to try to get your local sysadmin to install the package for you. – Faheem Mitha Jun 13 '17 at 17:25
  • @FaheemMitha Yeah, that's what I gather. I will try Stephen's suggestion first when I have opportunity, but it may possibly leave me with an unusable installation. – Kusalananda Jun 13 '17 at 17:28
  • Related, on the Ask Ubuntu site (which I did not think of checking): askubuntu.com/questions/193695/… and askubuntu.com/questions/339/… – Kusalananda Jun 13 '17 at 18:14

No, you haven’t missed anything. The best you can do in such circumstances is use dpkg-deb to extract the contents of the package, and hope they’ll work:

dpkg-deb -x package_x.y.z_x86_64.deb my-private-root

This won’t run any of the maintainer scripts contained in the package; you can extract those using

dpkg-deb -e package_x.y.z_x86_64.deb my-private-control
| improve this answer | |

Allowing users to install software using the system's package manager, would give a lot of problems, one that is easy to realise is the maintenance of dependencies. Even though the dependencies of the package you want to install are satisfied today, they might not be satisfied tomorrow when the real systems administrators have done some change - Should your installation prevent their work (not many will believe so), should your software be uninstalled or just left broken?

Debian packages are just ar-archives that contain two tarballs, so they should be easy to extract on any unix system, but if you're on a Debian (or a derivative that doesn't remove it) it's easier to use dpkg-deb as Stephen suggests in his answer. Note that in addition to maintainer scripts not being run when extracting the contents of the package manually, dependencies aren't checked. It's simple to check the dependencies (but as noted circumstances might change), doing what the maintainer scripts would do might be simple, but might also be hard. You'll need to read the script and figure out what they do and how to do it in your limited environment.

| improve this answer | |

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.