I had the same problem and running the above piece of code has sloved it, but I don't really understand why since the output from apt-get was just
Reading package lists... Done
Building...