Silviu-Marius Ardelean's blog

a software engineer's web log

apt-get and the static IP challenges within Raspbian OS

This is the story of my first experiences with Raspberry PI 2 card computer. Back in March I bought a new toy, a Raspberry PI 2. I have downloaded the Raspbian OS ISO image, wrote it on the microSD card and the toy was up and running. Raspbian OS Boot

As most probably you already know, the default package manager tool for Debian Linux derived distribution is apt-get. The apt-get command line tool that allows handling packages for new applications installation, updates, uninstall etc. The existence of this tool is one important things that convinced me to use Linux Mint and Ubuntu instead of Red Hat fork distributions. The Raspbian OS is, also a Debian derived distribution, special design for small card-computer devices such Raspberry PI 2.

As you known the static IP address assignation facilitates easier access to any device (ex. via the SSH protocol) and I prefer to use it. I assigned a fix IP address to my Raspberry device into my router and in addition I set the network setting to the proper static IP address (editing /etc/network/interfaces).

After a device reboot, I started the first update check via apt-get. Having a long experience with Ubuntu and Linux Mint, I had the surprise of getting errors in the moment of “apt-get update” execution.

apt-get cache cleaning provided no improvements. The ping to an explicit IP from Internet was getting answer but not for domains, so the DNS was not acting as expected. Usually, the DNS settings modification is not needed in case we are using a DHCP server.
I preferred to use the Google’s DNS public DNS service by editing the /etc/resolv.conf file.

But even if I was logged with the root privileges each time I tried to save the /etc/resolv.conf I got “No space left on device” error message. I was surprised to realize that the disk was “100% full” and my microSD card size was less than a half I know (8GB).

In order to repair such disk space situations we have to run the raspi-config application, where we have to select the first option Expand Filelsystem.

raspi-config tool

In case you get error (i got twice), please insist over this option until you’ll get the message “Root partition has been resized“.
After the root partition has been recovered, the proper disk space was displayed. That allowed me the manual define the DNS settings I mentioned earlier within /etc/resolv.conf file.
Off-course you need to restart the network settings. In case you’re connected like me via SSH reboot the toy (sudo reboot). Tring to restart the networking daemon (pi@raspberrypi ~ $ sudo /etc/init.d/networking restart) might make the device unavailable into the network.

With these “improvements” the apt-get application was running perfect with the static IP address and I was able to install whatever official packages I needed.

References:
Raspberry Pi Static IP Address
Raspberry Pi’s “No space left on device” error message

Silviu Ardelean

Software Engineer

More Posts - Website

Follow Me:
TwitterFacebookPinterest

Share

2 Responses to “apt-get and the static IP challenges within Raspbian OS”


  1. Bogdan

    Hi! I am having the same issue with RPi 3 + latest raspbian lite. I have expanded the root filesystem and updated the /etc/resolv.conf with google’s DNS servers, but I get the same error when running sudo apt-get update. I can ping 8.8.8.8 without problems. Any ideeas?

  2. I’m not sure which error your are talking about the apt-get error resolved via Google’s DNS or “no space left on device”?

Leave a Reply

*