How to fix GPG errors in Ubuntu

Problem: When running sudo apt-get update, you get a bunch of errors such as

W: GPG error: http://ppa.launchpad.net oneiric Release: The following signatures
couldn't be verified because the public key is not available: NO_PUBKEY 6E871C4A881574DE

And because of this, you can’t run the update. There are a couple of fixes for this.

First, there’s the standard suite of commands:

sudo apt-get clean

sudo rm -r /var/lib/apt/lists/*

sudo touch /var/lib/apt/lists/lock

sudo mkdir /var/lib/apt/lists/partial

sudo apt-get clean

sudo apt-get update

If these don’t work you may need to manually re-download the keys.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys hex_key_here

Substituting the actually key for hex_key_here. The key is the long hexadecimal number at the end of the ap-get update error. Using the example I gave above, I would type into my terminal

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6E871C4A881574DE

AND do yourself a favor and copy/paste the keys and/or the commands rather than manually typing them. One error is all it takes to make a lot of frustration.

If this stuff doesn’t work, there may be more info here: http://ubuntuforums.org/showthread.php?t=1221323

Advertisements

How to install themes/icons in Gnome shell

For shell themes:

Make sure the download is a .zip file. For some reason, that’s the only file type that Gnome-tweak recognizes. Then open gnome-tweak-tool (Advanced Settings) go to the Theme tab, and browse to find your theme.

For GTK/window themes:

Extract the folder containing the data into /usr/share/themes. Close and reopen gnome-tweak to add it to the options. If it still won’t show up, open a terminal and type

gconf-editor

Go to desktop>gnome>shell>windows and type in the name of the theme (exactly!). Then do alt+F2 and it should reload, plus add it to your options in gnome-tweak.

For icon themes:

Extract the folder containing the icon data into /usr/share/icons. Restart gnome-tweak. They should be there.


Unable to obtain lock for software installation

Problem:

Could not get lock /var/lib/apt/lists/lock- open (11: Resource temporarily unavailable)

Explanation of the problem:
Ubuntu uses the programs apt and dpkg for all package handling (installing, removing, updating, upgrading, etc.). To prevent multiple package management processes from running at once, apt or dpkg opens or “locks” an empty file named (appropriately) “lock”, in either /var/lib/apt/lists/ (for apt processes) or /var/lib/dpkg/ (for dpkg processes). If this file is already locked by an apt or dpkg process, no other process of that nature can run. That’s the in-depth explanation. Put shortly, you apparently have another apt or dpkg process running. This could be in the form of Synaptic Package Manager, or the USC, as they both utilize apt. Here’s brief instructions on how to remedy this.

Open a terminal and run

ps -ef | grep apt

The result will be a list of processes using apt. Kill them (all except the bottom one, called something like

cortman 3298 2798 0 15:40 pts/0 00:00:00 grep --color=auto apt

This is the grep process itself. To kill run

sudo kill -9 process_id

Substituting “process_id” for the actual id, which is a 4-5 digit number, second column from the left. If I were to kill the process given above, it would be

sudo kill -9 3298

Do the same for dpkg-

ps -ef | grep dpkg

to unlock the /var/lib/dpkg/lock file. You can now run whatever installation process you were attempting before.

 

Glossary of terms:

ps -ef: lists all processes
grep apt: means “find processes with apt in the description”
sudo: run the following command as root
kill -9: end the process immediately and unconditionally.


How to change GRUB 2 boot order

First figure out which OS you’d like to be default. Observe its order number in the list of options (and note that GRUB starts counting at 0). Open a terminal and enter

sudo gedit /etc/default/grub

Change the GRUB_DEFAULT= to the number of the preferred OS. If my Ubuntu is third in the list (counting from zero, remember) I would set it to

GRUB_DEFAULT=3

Save, and then run

sudo update-grub

This should do it!