Raspberry Pi Installation of Ubuntu 14.04 LTS: Could not resolve 'ports.ubuntu.com'

I decided to move away from Raspbian to Ubuntu 14.04 LTS-Trusty Tahr, because I found some shortcomings in Raspbian:

  • There are two many pre-installed educational packages installed like Sonic PI, Minecraft PI and Wolfram which are great tools but I really did not need them.
  • Raspbain does not give me the sense of working with a real Linux distribution.
  • Raspbian is slow even on Raspberry Pi Model 2 (I know that you'll find people saying it is fastest one, but I did not feel that way!)

If you follow the [official instruction on Ubuntu] (https://wiki.ubuntu.com/ARM/RaspberryPi), you'll end up in the point where you need to add the swap partition:

sudo apt-get install dphys-swapfile

What happened was that I received the following error after running the command:

Err http://ports.ubuntu.com trusty/main dc armhf 1.06.95-8ubuntu1
    could not resolve 'ports.ubuntu.com'
Err http://ports.ubuntu.com trusty/universe dphys-swapfile all 20100506-1
    could not resolve 'ports.ubuntu.com'
E: failed to fetch http://ports.ubuntu.com/pool/main/b/bc/dc_1.06.95-      8ubuntu1_armhf.dev Could not resolve 'ports.ubuntu.com'
E: failed to fetch http://ports.ubuntu.com/pool/universe/d/dphys-swapfile/dphys-swapfile_20100506-1_all.dev Could not resolve 'ports.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I think I got really confused with the suggestion in the log to run apt-get update, because first I realized that apt-get is not even installed. After installing apt-get, I ran apt-get update and I was still getting into more trouble than helping me out. All of a sudden, it occurred to me that this has to be a networking issue.

What you should do is to make sure you are connected to a network interface. Now you have to be connected with DSL cable because Ubuntu's firmware is not pre-installed on the Ubuntu's Raspberry Pi Image, and if you plan to install it via sudo apt-get install linux-firmware, you will hit the same error in a loop.

To fix the issue, after you are connected run the following commands and make sure you are connected to a network interface: ip addr. If you are seeing the assigned IP address, you are good to go. Now try running the swap command again:

sudo apt-get install dphys-swapfile

You should be fine now! 😀😀😀

The Rstats tag of this blog is added to R Bloggers