/etc/apt/preferences and /etc/apt/preferences.d/* are ignored.

Bug #891696 reported by Aminda Suomalainen
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
APT
Invalid
Undecided
Unassigned
apt (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Apt pinning is not possible, because /etc/apt/preferences and /etc/apt/preferences.d/* files are ignored.

I know that they are ignored, because I made syntax error (after I had set up pinnings on both computers and noticed that they didn'' work on Ubuntu) in that file with two computers running different distribution. Debian gave error, Ubuntu didn't do anything.

Apt pinning with these files is referred from wiki pages and man pages.

I am using Ubuntu 11.10
Package version is 0.8.16~exp5ubuntu13
% apt-get --version
apt 0.8.16~exp5ubuntu13 laitealustalle i386 käännöksen päiväys Oct 6 2011 15:25:29
Tuetut moduulit:
*Ver: Standard .deb
*Pkg: Debian dpkg interface (Priority 30)
 Pkg: Debian APT solver interface (Priority -1000)
 S.L: 'deb' Standard Debian binary tree
 S.L: 'deb-src' Standard Debian source tree
 Idx: Debian Source Index
 Idx: Debian Package Index
 Idx: Debian Translation Index
 Idx: Debian dpkg status file
 Idx: EDSP scenario file

I expected packages to get pinned.

What happened instead: apt just ignored /etc/apt/preferences and /etc/apt/preferences.d/

Steps to reproduce:
1. Write anything to /etc/apt/preferences or some file in /etc/apt/preferences.d/
2. That file is ignored in Ubuntu (with Debian you get error).

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: apt 0.8.16~exp5ubuntu13
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Uname: Linux 3.0.0-12-generic i686
NonfreeKernelModules: nvidia wl
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Thu Nov 17 18:20:44 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386 (20110427.1)
SourcePackage: apt
UpgradeStatus: Upgraded to oneiric on 2011-10-09 (39 days ago)

Revision history for this message
Aminda Suomalainen (mikaela) wrote :
Revision history for this message
Torsten Spindler (tspindler) wrote :

I've added two files to /etc/apt/preferences.d, one containing a pin, the other nonsense:

$ cat /etc/apt/preferences.d/apache
Package: apache2
Pin: release n=lucid
Pin-Priority: 900

Package: apache2
Pin: release n=precise
Pin-Priority: 100

$ cat /etc/apt/preferences.d/wurst
just a test

Upon 'apt-cache policy apache2' I get an error for wurst and the pinning (sort of) worked:
apache2:
  Installed: (none)
  Candidate: 2.2.14-5ubuntu8
  Package pin: 2.2.14-5ubuntu8
  Version table:
     2.2.22-1ubuntu1 900
        500 http://archive.ubuntu.com/ubuntu/ precise/main i386 Packages
     2.2.14-5ubuntu8 900
        500 http://archive.ubuntu.com/ubuntu/ lucid/main i386 Packages
N: Can not read /etc/apt/sources.list.d/a.list.
E: Invalid record in the preferences file /etc/apt/preferences.d/wurst, no Package header

Not sure why 2.2.22-1ubuntu1 is listed with 900 instead of 100, though. Can you provide steps to reproduce your problem?

Changed in apt (Ubuntu):
status: New → Incomplete
Revision history for this message
Aminda Suomalainen (mikaela) wrote : Re: [Bug 891696] Re: /etc/apt/preferences and /etc/apt/preferences.d/* are ignored.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

The steps how I encountered this were:

1. Add pinning for Debian Sid.
2. "aptitude update"
3. "aptitude upgrade" and aptitude wants to upgrade to Debian Sid.

(I cannot test does this still happen, because I don't have Ubuntu
installed anywhere right now :(.)

1.3.2012 11:57, Torsten Spindler kirjoitti:
> I've added two files to /etc/apt/preferences.d, one containing a
> pin, the other nonsense:
>
> $ cat /etc/apt/preferences.d/apache Package: apache2 Pin: release
> n=lucid Pin-Priority: 900
>
> Package: apache2 Pin: release n=precise Pin-Priority: 100
>
> $ cat /etc/apt/preferences.d/wurst just a test
>
> Upon 'apt-cache policy apache2' I get an error for wurst and the
> pinning (sort of) worked: apache2: Installed: (none) Candidate:
> 2.2.14-5ubuntu8 Package pin: 2.2.14-5ubuntu8 Version table:
> 2.2.22-1ubuntu1 900 500 http://archive.ubuntu.com/ubuntu/
> precise/main i386 Packages 2.2.14-5ubuntu8 900 500
> http://archive.ubuntu.com/ubuntu/ lucid/main i386 Packages N: Can
> not read /etc/apt/sources.list.d/a.list. E: Invalid record in the
> preferences file /etc/apt/preferences.d/wurst, no Package header
>
> Not sure why 2.2.22-1ubuntu1 is listed with 900 instead of 100,
> though. Can you provide steps to reproduce your problem?
>
>
> ** Changed in: apt (Ubuntu) Status: New => Incomplete
>

- --
Mika Suomalainen
> Hotmail:
>> gpg --keyserver keyserver.ubuntu.com --recv-keys
>> 7969153703D41B0D
> GMail:
>> gpg --keyserver keyserver.ubuntu.com --recv-keys
>> 67D0EF32C0151D5C
> TouchLay (revoked):
>> gpg --keyserver keyserver.ubuntu.com --recv-keys
>> EB3FC5CC8751C396
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPUSOdAAoJEHlpFTcD1BsN9rEIAJkV9TiqMmYGsgFltIHwiYMl
4b1bCPdJ7HnF0Qn9mtsaZ3359ZaGo5XnjiN1gpWTpfTgmzIfFpks5o/0K95snY3D
M3rnn8bgFb2jzadScJi9TLYwpHO/pycPO+VifVt5Sosfe05V8tFU2U5Y1IPLXCMr
axZvniZ5+FCncX4MATBiUBBf4pjD3IAuIhOd2UwH+Mfw/M+jH0jNC7GiPhVpTU8a
3zob4WIMAr87+nEEEKlULOjSH5i4nwrf6DbcLay6hKPPg6jrmZB5GU0Mt3MFXkev
vh4udh0psAZRjfR3m9iYFCXKgNJLlTJbJF9QlDV3r9hV2VBm3Whb7hk2qEC1g88=
=gXIz
-----END PGP SIGNATURE-----

Revision history for this message
Torsten Spindler (tspindler) wrote :

Can you remember if it failed with aptitude, not apt? I think there is a pending bug on preferences.d support for aptitude.

Revision history for this message
Aminda Suomalainen (mikaela) wrote : Re: [Bug 891696] Re: /etc/apt/preferences and /etc/apt/preferences.d/* are ignored.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

If I recall correctly, it happened with both, apt-get and aptitude.

Torsten Spindler <email address hidden> wrote:

>Can you remember if it failed with aptitude, not apt? I think there is
>a
>pending bug on preferences.d support for aptitude.
>
>--
>You received this bug notification because you are subscribed to the
>bug
>report.
>https://bugs.launchpad.net/bugs/891696
>
>Title:
> /etc/apt/preferences and /etc/apt/preferences.d/* are ignored.
>
>Status in “apt” package in Ubuntu:
> Incomplete
>
>Bug description:
> Apt pinning is not possible, because /etc/apt/preferences and
> /etc/apt/preferences.d/* files are ignored.
>
> I know that they are ignored, because I made syntax error (after I had
> set up pinnings on both computers and noticed that they didn'' work on
> Ubuntu) in that file with two computers running different
> distribution. Debian gave error, Ubuntu didn't do anything.
>
> Apt pinning with these files is referred from wiki pages and man
> pages.
>
> I am using Ubuntu 11.10
> Package version is 0.8.16~exp5ubuntu13
> % apt-get --version
>apt 0.8.16~exp5ubuntu13 laitealustalle i386 käännöksen päiväys Oct 6
>2011 15:25:29
> Tuetut moduulit:
> *Ver: Standard .deb
> *Pkg: Debian dpkg interface (Priority 30)
> Pkg: Debian APT solver interface (Priority -1000)
> S.L: 'deb' Standard Debian binary tree
> S.L: 'deb-src' Standard Debian source tree
> Idx: Debian Source Index
> Idx: Debian Package Index
> Idx: Debian Translation Index
> Idx: Debian dpkg status file
> Idx: EDSP scenario file
>
> I expected packages to get pinned.
>
> What happened instead: apt just ignored /etc/apt/preferences and
> /etc/apt/preferences.d/
>
> Steps to reproduce:
>1. Write anything to /etc/apt/preferences or some file in
>/etc/apt/preferences.d/
> 2. That file is ignored in Ubuntu (with Debian you get error).
>
> ProblemType: Bug
> DistroRelease: Ubuntu 11.10
> Package: apt 0.8.16~exp5ubuntu13
> ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
> Uname: Linux 3.0.0-12-generic i686
> NonfreeKernelModules: nvidia wl
> ApportVersion: 1.23-0ubuntu4
> Architecture: i386
> Date: Thu Nov 17 18:20:44 2011
>InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release i386
>(20110427.1)
> SourcePackage: apt
> UpgradeStatus: Upgraded to oneiric on 2011-10-09 (39 days ago)
>
>To manage notifications about this bug go to:
>https://bugs.launchpad.net/ubuntu/+source/apt/+bug/891696/+subscriptions

Mika Suomalainen
> gpg --keyserver keyserver.ubuntu.com --recv-keys 62FE66853913CB03
-----BEGIN PGP SIGNATURE-----
Version: APG v1.0.8

iQEuBAEBCAAYBQJPVZWeERxNaWthIFN1b21hbGFpbmVuAAoJEGL+ZoU5E8sDmNsH
/jkgYmdPfIthEW1Rb3M15TaAuwUAgvRkRSECW83r/gyJevtcDBJKqd/jxLKUInqM
+Zf0cWCl629UTzSP9tgkjki3rkaCppZ3H1ygvHSe2w//naCmFhJl60pbHBxZhZoL
ua5MRRlPoTO5TQhVPGnnxtcASB92WrzMgfNT+EvJtJJuT48gs3/dpmZmX/hRPYuH
LObQQwQG3vTWbd61rWrDDUaD6jEqEWkP0uC3HlRUQWw8wcAGLOTgnNkko3nFpUjp
xElSuzbDxP0wLIm3tqaDYLukTEpVGQB3RPsoUSyhRUa/x6N6vno6xljdA7AFTjdP
Q4/oCQ6NfixqQIO966D6m5o=
=QYKU
-----END PGP SIGNATURE-----

Revision history for this message
Torsten Spindler (tspindler) wrote :

Do you still have the config files, so I can confirm the bug?

Revision history for this message
Aminda Suomalainen (mikaela) wrote : Re: [Bug 891696] Re: /etc/apt/preferences and /etc/apt/preferences.d/* are ignored.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

No, I don't have them. I usually backup only home folders when
reinstalling OS or installing different OS.

On 06.03.2012 06:57, Torsten Spindler wrote:
> Do you still have the config files, so I can confirm the bug?
>

- --
Mika Suomalainen
> gpg --keyserver keyserver.ubuntu.com --recv-keys 62FE66853913CB03
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPVh3PAAoJEGL+ZoU5E8sDDzUH/07f7GnFXLp3Cf7tDJFfSalj
D1+zNrv4Xtw0/SONGjSaVtuPFb28AnJsQfJlXo4fbAlj7Rqs+N98obG6mAIvBMNJ
NRvfKoOMpi6T2CiFBBB3FyZVZjCg1wYD+K7CaRWyb1k4C2GK0WXVb/rxgS83ww/N
wznk09hWpx4KsqY8HIznNgnt0eMOsCs27fg932+XM6nBt7yCWSu+0ZoYcayzFpBB
aUSP1GanyQWmUCgYZJZ+mPQ1uqFIzfVeDc9LOceHOdXJZdxBFog/GbezNiCaIXzL
/jW+iFxmM12X6Pr3ao8c47sX+25Tl4ySuSgSu4HK1rZqW/DHsbWQd5gKiKDFGBQ=
=MeiV
-----END PGP SIGNATURE-----

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for apt (Ubuntu) because there has been no activity for 60 days.]

Changed in apt (Ubuntu):
status: Incomplete → Expired
Revision history for this message
xtsbdu3reyrbrmroezob (xtsbdu3reyrbrmroezob) wrote :

this bug is still valid and confirmed, including upstream in debian 9

Changed in apt (Ubuntu):
status: Expired → Confirmed
Revision history for this message
xtsbdu3reyrbrmroezob (xtsbdu3reyrbrmroezob) wrote :

"""
       Note that the files in the /etc/apt/preferences.d directory are parsed
       in alphanumeric ascending order and need to obey the following naming
       convention: The files have either no or "pref" as filename extension
       and only contain alphanumeric, hyphen (-), underscore (_) and period
       (.) characters. Otherwise APT will print a notice that it has ignored a
       file, unless that file matches a pattern in the
       Dir::Ignore-Files-Silently configuration list - in which case it will
       be silently ignored.

"""

this appears to be well defined behavior. filenames MUST adhere to the above. will close this bug out.

Changed in apt (Ubuntu):
status: Confirmed → Invalid
Changed in apt:
importance: Unknown → Undecided
status: Unknown → New
importance: Undecided → Unknown
status: New → Unknown
importance: Unknown → Undecided
status: Unknown → New
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.