1

I have a server running Debian Stretch that I need to install PHP 7.1 on, which isn't available in the default repositories of Stretch, but in Testing aka Buster. I tried to use apt pinning to add the Buster repositories with a lower priority, so packages from Buster only get installed when I specify them.

I added the following to the (otherwise untouched) /etc/apt/sources.list:

# buster to get php 7.1 for nextcloud
deb http://ftp.de.debian.org/debian/ testing main 
deb-src http://ftp.de.debian.org/debian/ testing main

deb http://security.debian.org/debian-security testing/updates main
deb-src http://security.debian.org/debian-security testing/updates main

And I created a file called 01-buster in the (otherwise empty) /etc/apt/preferences.d directory, with the following content:

Package: *

Pin: release a=stable
Pin-Priority: 700

Package: *

Pin: release a=testing
Pin-Priority: 650

Now, when I run apt update, I get the following output:

Hit:1 http://security.debian.org/debian-security stretch/updates InRelease
Ign:2 http://ftp.de.debian.org/debian stretch InRelease                  
Hit:3 http://security.debian.org/debian-security testing/updates InRelease    
Hit:4 http://ftp.de.debian.org/debian testing InRelease                  
Hit:5 http://ftp.de.debian.org/debian stretch-updates InRelease
Hit:6 http://ftp.de.debian.org/debian stretch Release
Reading package lists... Done                      
E: Invalid record in the preferences file /etc/apt/preferences.d/01-buster, no Package header

Other commands, such as apt search php or apt policy return the same error.

I am 95% sure I have done apt pinning in the past successfully with exactly the same settings. Does anyone have an idea what is going on here?

morph
  • 51
  • 6

1 Answers1

0

Try removing the blank line between Package: and Pin::

Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=testing
Pin-Priority: 650