Bug#414202: apt: Unable to specify options on the command line that work via a conf file - lock errors
Package: apt
Version: 0.6.46.4-0.1
Severity: normal
This apt-conf file does work:
(In this example, /var/emdebian/sqlite is a non-privileged directory)
Dir "/var/emdebian/sqlite/"
{
Etc "/var/emdebian/sqlite/"
{
SourceList "sources-debian.unstable";
};
State "unstable-amd64/"
{
Status "/var/emdebian/sqlite/status-debian"
}
Cache "unstable-amd64/";
};
The same options on the command line do not:
apt-get -o Apt::Dir="/var/emdebian/sqlite/" \
-o Apt::Dir::Etc="/var/emdebian/sqlite/" \
-o Apt::Dir::Etc::SourceList="sources-debian.unstable" \
-o Apt::Dir::State=unstable-amd64/ \
-o Apt::Dir::State::Status="/var/emdebian/sqlite/status" \
-o Apt::Dir::Cache=unstable-amd64/ \
update
Example in an arbitrary directory:
mkdir -p archives/partial
mkdir -p lists/partial
mkdir unstable
touch status.unstable
apt-get -o Apt::Dir="$PWD" -o Apt::Dir::Etc::SourceList="sources.unstable" -o Apt::Dir::State="unstable/" -o Apt::Dir::State::Lists="lists/" -o Apt::Dir::State::Status="status.unstable" -o Apt::Dir::Cache="unstable/" update
E: Could not open lock file /var/lib/apt/lists/lock - open (13 Permission denied)
E: Unable to lock the list directory
Despite the directories being specifically set to non-privileged
folders, apt still tries to use /var/lib/apt/
This is complicating my embedded work where it is common to require
multiple apt caches for different architectures and suites. The bug
leads to many many apt-conf.foo files being either auto-generated or
packaged alongside the script and then maintained or copied each time a
different architecture needs to be queried.
With 11 supported cross-building architectures, two suites (rising to
three, possibly four) and three buildd platforms, the permutations of
apt.conf-foo files is becoming a real problem.
When using sudo, apt-get ignores the command line options are updates
the cache files according to my /etc/apt/sources.list NOT the local
sources.unstable file that I specified on the command line.
The same errors occur with apt-cache:
$ apt-cache -o Apt::Dir="$PWD" -o Apt::Dir::Etc::SourceList="sources.unstable" -o Apt::Dir::State="unstable/" -o Apt::Dir::State::Lists="lists/" -o Apt::Dir::State::Status="status.unstable" -o Apt::Dir::Cache="unstable/" pkgnames
prints the list of pkgnames from the system cache, not the local one.
Enclosing all options within one quote does not affect the problem:
$ apt-get -o 'Apt::Dir="/var/emdebian/sqlite/"
Apt::Dir::Etc="/var/emdebian/sqlite/"
Apt::Dir::Etc::SourceList="sources-debian.unstable"
Apt::Dir::State="unstable-amd64/"
Apt::Dir::State::Status="/var/emdebian/sqlite/status-debian"
Apt::Dir::Cache="unstable-amd64/"' update
E: Could not open lock file /var/lib/apt/lists/lock - open (13 Permission denied)
E: Unable to lock the list directory
$ cd ~
$ apt-get -o Apt::Dir::State::Lists="$PWD/lists/" update
E: Could not open lock file /var/lib/apt/lists/lock - open (13 Permission denied)
E: Unable to lock the list directory
apt-(get|cache) just seem to ignore -o command line options that work fine
when using the -c <filename> method.
-- Package-specific info:
-- apt-config dump --
APT "";
APT::Architecture "amd64";
APT::Build-Essential "";
APT::Build-Essential:: "build-essential";
APT::Authentication "";
APT::Authentication::TrustCDROM "true";
Dir "/";
Dir::State "var/lib/apt/";
Dir::State::lists "lists/";
Dir::State::cdroms "cdroms.list";
Dir::State::userstatus "status.user";
Dir::State::status "/var/lib/dpkg/status";
Dir::Cache "var/cache/apt/";
Dir::Cache::archives "archives/";
Dir::Cache::srcpkgcache "srcpkgcache.bin";
Dir::Cache::pkgcache "pkgcache.bin";
Dir::Etc "etc/apt/";
Dir::Etc::sourcelist "sources.list";
Dir::Etc::sourceparts "sources.list.d";
Dir::Etc::vendorlist "vendors.list";
Dir::Etc::vendorparts "vendors.list.d";
Dir::Etc::main "apt.conf";
Dir::Etc::parts "apt.conf.d";
Dir::Etc::preferences "preferences";
Dir::Bin "";
Dir::Bin::methods "/usr/lib/apt/methods";
Dir::Bin::dpkg "/usr/bin/dpkg";
DPkg "";
DPkg::Pre-Install-Pkgs "";
DPkg::Pre-Install-Pkgs:: "/usr/bin/apt-listchanges --apt || test $? -ne 10";
DPkg::Pre-Install-Pkgs:: "/usr/sbin/dpkg-preconfigure --apt || true";
DPkg::Tools "";
DPkg::Tools::Options "";
DPkg::Tools::Options::/usr/bin/apt-listchanges "";
DPkg::Tools::Options::/usr/bin/apt-listchanges::Version "2";
-- (no /etc/apt/preferences present) --
-- /etc/apt/sources.list --
deb ftp://mirror.ox.ac.uk/debian/ unstable main
deb-src ftp://mirror.ox.ac.uk/debian/ unstable main
#deb ftp://mirror.ox.ac.uk/debian/ experimental main
#deb-src ftp://mirror.ox.ac.uk/debian/ experimental main
deb http://www.linux.codehelp.co.uk/packages unstable main
deb-src http://www.linux.codehelp.co.uk/packages unstable main
#deb http://www.linux.codehelp.co.uk/packages experimental main
#deb-src http://www.linux.codehelp.co.uk/packages experimental main
#deb http://www.emdebian.org/emdebian/unstable main
deb http://www.emdebian.org/debian/ unstable main
deb-src http://www.emdebian.org/debian/ unstable main
deb-src http://mentors.debian.net/debian unstable main
-- System Information:
Debian Release: 4.0
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Versions of packages apt depends on:
ii debian-archive-keyring 2007.02.19 GnuPG archive keys of the Debian a
ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries
ii libgcc1 1:4.1.1-21 GCC support library
ii libstdc++6 4.1.1-21 The GNU Standard C++ Library v3
apt recommends no packages.
-- no debconf information
Reply to: