Background
I got a very similar error when using an SD card image of basically unknown origins and trying to upgrade my packages. It turns out there's a config file that says \stable
and it needs to match the name of the Raspbian release instead.
It looks like my image, as well as your image, was using the "stable" branch at the time it was made. You can read more about the Debian branches (Raspbian is a derivative of Debian) here.
You'll need to find which branch you're using, which I found out how to do here, using the command cat /etc/os-release
. For example, it will say something like this:
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
I found several articles and Q&A sites with a similar error, but I had to do my own poking around to find the file to edit (SuperUser, LinuxQuestions.org, AskUbuntu). Funnily enough, I found the answer while typing up this answer.
How to fix the problem
Edit this file:
sudo nano /etc/apt/apt.conf.d/10defaultRelease
There will be a single line in that file, and change it from
APT::Default-release \"stable";
to
APT::Default-release \"jessie";
And then save and exit. You will now be able to use sudo apt-get upgrade
, and presumably any other apt function. I was able to do the upgrade, and then install packages after doing this.