Hi!

On Wed, 2017-12-06 at 16:42:55 +0000, Adams, Bruce (KMLWG) wrote:
> Package: dpkg
> Version: 1.18.24
> Severity: normal

> When using the --admindir option I get the error message:
> 
> "dpkg: error: unable to access dpkg status area: No such file or directory"
> 
> This does not follow the unix convention of telling me the path that it is
> unable to read. i.g. it should be something like:
> 
> /path/to/status/dir: error: unable to access dpkg status area: No such file 
> or directory
> 
> unless it really does think the status dir is just 'dpkg'.

Right, this is rather suboptimal as a way to try to diagnose the
problem. The historical reason this has been this way, I think, has
been to avoid leaking too much information about the dpkg _internal_
database. But given that most other error messages for the database print
full paths, this does not seem to hold. So I'll just fix the string to
make sense.

> Some background. I am trying to create a fake installation as a normal user
> without touching the existing data in /var/lib/dpkg.
> 
> It is not clear how to create an admin directory from any documentation
> I have found so far. Note that:
> 
> sudo dpkg --force-not-root --root=i/want/to/install/here  
> --admindir=/var/lib/dpkg --install some_package.deb
> 
> works but
> 
> dpkg --force-not-root --root=i/want/to/install/here  
> --admindir=/even/a/copy/of/var/lib/dpkg --install some_package.deb
> 
> results in this cryptic error message.

The minimal way to do that currently would be:

  $ mkdir -p fsys db/{info,updates}
  $ touch db/status
  $ PATH=/sbin:/usr/sbin:$PATH fakeroot \
    dpkg --admindir=db --instdir=fsys -i somepkg.deb

But, beware that passing --root after --admindir or --instdir, will reset
those paths.

Thanks,
Guillem

Reply via email to