Sunday, November 11, 2012

apt-get update fails to fetch files,"Temporary failure resolving …" error

overview

There are two parts to your question:
  • fixing temporary resolve messages
  • fixing the package management issues

Temporary resolve

It is likely that this issue is either:
  • temporary due to your Internet Service Provider not correctly forwarding internet naming (DNS) to either its or external DNS servers, or
  • due to a change in your network has similarly blocked this naming - for example, new router/modem, reconfiguring a switch with a new configuration.
Lets look at the possible DNS resolving issues.
First, temporarily add a known DNS server to your system.
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Then run sudo apt-get update.
If this fixes your temporary resolving messages then either wait for 24 hours to see if your ISP fixes the issue for you (or just contact your ISP) - or you can permanently add a DNS server to your system:
echo "nameserver 8.8.8.8" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null
8.8.8.8 is Google's own DNS server.
Another example DNS server you could use is OpenDNS - for example:
echo "nameserver 208.67.222.222" | sudo tee /etc/resolvconf/resolv.conf.d/base > /dev/null

package-management issues

In addition to the temporary resolve issues - you have a few package management issues that need to be corrected - I'm assuming you have tried recently to upgrade from one Ubuntu version to the next recommended version - in your case from Natty (11.04) to Oneiric (11.10)
Open a terminal and type
sudo nano /etc/apt/sources.list
Look for lines that have your a different distribution name in the list than you were expecting - in your case - you have upgraded to oneiric but you have another release name natty
For example, look for lines that look like deb http:/archive.canonical.com/ natty backports
Add a # to the beginning of the line to comment it out - for example
#deb http:/archive.canonical.com/ natty backports
Save and re-run:
sudo apt-get update && sudo apt-get upgrade
You should not have any more release naming errors.
 At the time of writing this, possible common release names include lucid, maverick, natty,oneiric, precise and quantal

Saturday, November 3, 2012

Speed up Firefox by moving cache into RAM in Ubuntu

By default Firefox puts its cache in your home partition.You can speed up Firefox and reduce disk writes by moving this cache into RAM if you have 1GB RAM or more.

1.Edit /etc/fstab,open terminal from Applications->Accessories menu and type:
sudo gedit /etc/fstab
Add following into this file and close it.
tmpfs /tmp tmpfs noexec,defaults,noatime 0 0
tmpfs /var/tmp tmpfs noexec,defaults,noatime 0 0
2.Edit /etc/sysctl.conf:
sudo gedit /etc/sysctl.conf
add this line and save it:
vm.swappiness=1
3. Type about:config in firefox address bar and click I'll be careful,I promise!.Right click on blank area and create a new string value called

browser.cache.disk.parent_directory,set its value to /tmp

Now,reboot your system and experience the performance.

http://ubuntuguide.net/speed-up-firefox-by-moving-cache-into-ram-in-ubuntu

Linux memory cache

Note: Linux is NOT "eating" your RAM! Please take a look at Geirha's excellent answer below to understand why...
After the above note, if you still feel "cleaning" the cache could help, you can certainly try: it's a one-liner from the terminal:
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
There's no easy way to disable the cache, but you can achieve the same effect by cleaning it as often as every minute, if you want to:
  • Make it a cron-job
  • Press Alt-F2, type gksudo gedit /etc/crontab, and add this line near the bottom:
    */15 * * * * root sync && echo 3 > /proc/sys/vm/drop_caches
  • This cleans every 15 minutes. You can set to 1 or 5 minutes if you really want to by changing the first parameter to * or */5 instead of */15

One liner to know REAL free RAM, excepting cache

Geirha's answer explains the details, but in short, you get the number of free megabytes with:
free -m | sed -n -e '3p' | grep -Po "\d+$"
which on my 2GB command-line server returns an extremely health 1835.


http://askubuntu.com/questions/155768/how-do-i-clean-or-disable-the-memory-cache

http://www.linuxatemyram.com/