Fight for the Internet 1!

Tuesday, November 23, 2010

Ubuntu Graphics Session Fix after botched Kernel Upgrade

Overview
This post is about restoring graphics to your Linux Desktop session if you install some kernel updates that don't go so well. Particularly, ones that fail with your graphics drivers.

Quick Steps
If you get error message (when trying to upgrade kernel packages or kernel drivers): "Skipping (driver build) at this time because kernel-source is missing." Try the following steps:

Note: `uname -r` is a commandline option which will auto-substitute your kernel version and architecture into the install command. If installing via a GUI, just use the info output from running the console command `uname -r`.
sudo apt-get install linux-source-`uname -r` linux-headers-`uname -r`
If this does not automatically cause your nvidia drivers to compile, cause a manual install with:
sudo apt-get install nvidia-current
If that still doesn't work, try uninstalling and reinstalling nvidia-current.


Background
Today I noticed there were some kernel updates in Ubuntu, but they had been kept back. So I decided to manually install them, since they did not appear to be causing any package conflicts. I do updates from command line with 'apt-get' (because I'm awesome that way *wink*). While installing the held-back packages, being kernel updates, it tried to accommodate my Nvidia graphics drivers.

Apparently, this failed. I noticed the error on the console, and immediately downgraded my kernel back to the previous versions. But alas, it did no good. I rebooted and was confronted with a text-only machine. Now, I'm fine with this, since I spend a lot of time on console. (Screen, vim, ssh, and elinks are usually all I need for most rescue operations. Sometimes rtorrent, wget, and curl are handy too.)

After trying to get the packages to jive well together, I gave up trying to juggle the kernel packages and instead focused on the Nvidia drivers. I tried installing the nvidia-current package provided by the Ubuntu repositories. (I was running a later version from a PPA.). This failed, but triggered the same error.

"Skipping (driver build) at this time because kernel-source is missing." Now, I've seen this error before. So I quickly installed the linux-source-`uname -r` package. This did not quite do the trick, and I have been around long enough to know that the source-packages often require the header packages as well. So I install linux-headers-`uname -r` package.

Once installed that, I didn't even have to do anything. The system automatically compiled the missing nvidia drivers and installed them for me. A quick reboot later, and now I am blogging about this simple solution.

Thursday, November 18, 2010

How to replace Pidgin certificates (the GUI method)

This morning I tried Pidgin and got an error message saying:

"Unable to validate certificate. The certificate for omega.contacts.msn.com could not be validated."

For the record, the problem isn't on Pidgin's end – it's a misconfiguration of the MSN servers. Here is a short term fix until the problem on Microsoft's end is fixed.

How to replace your certificate (the GUI method)

Go to pidgin's Tools->Certificates. Remove the old certificate. Don't close this window yet. (You can, but it is easier to not).

With your browser, go to https://omega.contacts.msn.com. It will give you "Directory Listing Denied"error.

With Firefox, click on the lock symbol in the lower right corner. This will display dialog box about the page info. Click the button "View Certificate." On the window that pops up, go to the Details tab. Click on the "Export" button to export the certificate to a file.Call it whatever you like.

Now, go back to the pidgin Tools->Certificates dialog. Click the "Add" button to add the newly exported certificate. I had to specify the hostname as explicitly: omega.contacts.msn.com

This was the only way I could get it to work.

Saturday, November 6, 2010

Harddrive Space Disappearance and Freespace

Overview
This is just a quick list of places to look to free up space on your harddrive when using KDE. (In this article, I am dealing with version 4, but some of it does work for version 3 too.) This can be helpful if you ever suffer an anomaly of used space you just can't seem to locate and free up under the great KDE desktop.

Background Information
Sometimes rarely in Linux (running KDE) I receive the message that I'm running low on diskspace on my root (/) partition. (I only give it about 15 GBs total.) After emptying my Trash, most of the space on root (/) was still in use. So I began to dig around to find out the cause of this.

Akonadi
Size: 140.9 MB (on my system)
Location: ~/.kde/share/apps/akonadi
Though I own a Droid X smartphone, I do not use any of KDE's utilities to synchronize my devices. So I was quite surprised to see it taking up that much space. Please note, this is not the location of the installed program, just some data it had accrued about me personally and stored in my home directory.

Nepomuk
Size: 378.2 MB (on my system)
Location: ~/.kde/share/apps/nepomuk
Since no services in KDE actually use Nepomuk (and no programs I know of connect to it), currently is a 100% completely useless service. Don't let it run on your system, since it will only take up space and resources that you cannot use.

Thumbnails
Size: 4.6 GB (on my system)
Location: ~/.thumbnails
Now this one makes sense. I collect literally tens-of-thousands of images and regularly browse them, so I'm not surprised this is so large. Still, it would be nice to specify a limit to the size of this folder.

Clearing out this folder took a bit of skill. I had over 100,000 files in this directory total, and even doing `rm .thumbnails/normal/*` threw a rarely seen error: "Argument list too long"

The simple solution is just to delete the sub folder 'normal' and 'large' inside of '.thumbnails'. I could tell you some nifty console commands to hack around this, but this works just fine.


Apt cache (a.k.a. the System Package Cache)
Size: 1.3 GB (on my system)
Location: /var/cache/apt/archives/
If you are not a seasoned and knowledgeable Linux user, chances are you don't know about this one. Whenever you install any new updates or packages through any number of GUI / Graphical front-ends (such as Synaptic or Software Management) or through command-line program like dpkg or apt, all downloaded files (called packages) have to be placed somewhere while downloading. This location varies a little between Linux distributions, like Ubuntu versus Red Hat. Under Ubuntu and Debian (and any Debian forks) are placed in /var/cache/apt/archives. This can become very full with lots of temporary download files. There are a couple of ways to clear this folder out. My favorite is simply from command line:
sudo apt-get clean
Yum/DNF cache (a.k.a. the System Package Cache)
Size: 1.3 GB (on my system)
Location: /var/cache/yum/
If you are not a seasoned and knowledgeable Linux user, chances are you don't know about this one. Whenever you install any new updates or packages through any number of GUI / Graphical front-ends (such as Synaptic or Software Management) or through command-line program like dpkg or apt, all downloaded files (called packages) have to be placed somewhere while downloading. This location varies a little between Linux distributions, like Ubuntu versus Red Hat. Under Ubuntu and Debian (and any Debian forks) are placed in /var/cache/yum. This can become very full with lots of temporary download files

You should manually clear any folders of files you don't need.

Wine
Size: 5.0 GB (on my system)
Location: ~/.wine
The Wine folder. I was pretty surprised by this one also. All my Windows applications are installed in non-home-directory locations and I haven't done much with Wine lately, so this folder should have been relatively small. After doing some quick checking, I found the folder (.wine/drive_c/users/MY_USER_NAME/Local Settings/Temporary Internet Files) to be the culprit. I suspect this came from updating a videogame of mine recently, since it had a multiple Gigabytes to download and install.

Trash Files (Lost/Forgotten)
Size: 2.0 GB (on my system)
Location: ~/.local/share/Trash/files/
Even after emptying the Trash through the regular interface, some large files persisted. I found them here and manually deleted them. (Side Note: I have to say, though I generally love KDE, their trash system is fairly broken with two major problems. The first is if you open the Trash to look inside, it copies all the files to the /tmp/kde-username/ folder, consuming harddrive space. In my case, I let my trash become huge, so this immediately fills up all freespace on the root / partition. This is a terrible bug they absolutely should have fixed years ago. The other problem is, like this situation, occasionally letting files slip through the cracks and not be correctly deleted.)

KTorrent Magnet Links
Size: 8.3 GB (on my system)
Location: ~/.kde/share/apps/kio_magnet
There is a bug with the KDE IO Slave for using Magnet Links in Ktorrent. Instead of downloading files using the temporary storage directory as specified within KTorrent, it dumps them to this location. That's a serious problem. The easy fix to remove this directory, and create a symbolic link (with the same name) to some temporary folder wherever you want.


Hope that helps you clear up some space on your home-directories and root partitions.

Update 1: Added the Wine section.
Update 2: Added the forgotten Trash files section.
Update 3: Added KIO_Magnet /KDE Magnet Links section.

Sunday, October 31, 2010

MPlayer / SMPlayer problems in Ubuntu 10.10

I'm current having some small problems with SMPlayer in Ubuntu 10.10. I'm not sure what the cause is but I'm fairly certain it relates to the recent switch to Kernel Direct-Rendering-Management (DRM) and Nvidia drivers. I say this partly because I am noticing other small video glitches but for the most part they are not worth even mentioning.

However specifically there seems to be problems with trying to use VDPAU. (If you don't know what that is, in a nutshell it is letting your videocard's CPU, often called a GPU, do video playback/decoding for you, which is faster than using your main CPU as well as leaving the system CPU free for other tasks.)

While the problems with VDPAU are hard to pin down (I'm having trouble finding an exact bug report to list here), I have found a small fix to help with my other SMPlayer problems.

I have started using daily compiled MPlayer packages from this PPA.

https://launchpad.net/~motumedia/+archive/mplayer-daily

It seems to have helped with smoothing playback in other areas where I might get lockups when I would use some more exotic SMPlayer/MPlayer feature.

Sunday, October 3, 2010

Rip Subtitles from YouTube (and Google Video)

Rip Subtitles from YouTube (and Google Video)

Today I needed to extract some subtitles from a cute video I found on YouTube, and I tracked down this piece of software that lets you do it.

http://sourceforge.net/projects/google2srt/

It's a very simple program, but it does the job. Simply give it the URL of the target video, optionally give it a file-path to where you want the output SRT (subtitle) file to be saved, and hit Read. It will present you with a list of the subtitles it can find at that URL address. Check the subs you want, and hit GO. It will save them for you.

It saves the subs in SRT, which is a generic and well supported Subtitle format. In the case of most video players, if you name the SRT file exactly the same name as the video file, when opening the video in a media-player the program usually automatically detects the subs and enables them for you. (Or if your media-player doesn't, you should get a better one that does, like SMPlayer or VLC.)

Sunday, September 5, 2010

How to Edit a Configuration File

HOW TO EDIT A CONFIGURATION FILE

New users to Linux may have trouble editing configuration text files at first. I'll try to be simple, and this guide is for people using Gnome or KDE.

The simplest way is using a user friendly program. In Gnome (which is normal Ubuntu), the default text editor is gedit. In KDE (in Kubuntu) it is Kate. Also, this is a protected system file, so you need to use special Administrator privileges before you can edit it. Don't worry. This is simply.

In this example I am showing how to open a BlueTooth configuration file, but it works for any other example configuration files.

KDE

In KDE, you need to find the "Run Command" option the Application menu. (The App menu is usually in the lower left-hand corner, with a colorful K-button.) In KDE4's new menu style, the "Run Command" is (currently) under the 'Computer' section, near the top of the small list. Find the option and click it.

In the input box that displays, copy/paste the this command into it and press enter:
kdesu kate /lib/udev/rules.d/70-hid2hci.rules

The 'kdesu' program tells the system you want to run the text editor (kate) with Admin access. You will be prompted for your individual user password, which you enter. Then kate should open with a file ready for you. (This is the /lib/udev/rules.d/70-hid2hci.rules file which we told kate to open for us.) If this file does not open, you can open it manually by going to menu File -> Open... and then navigating to the '/' root directory, down to 'lib' and so on until you find the file ' 70-hid2hci.rules'.

Edit the file as directed earlier in this article. Save the file, close the file (menu File -> Close), and then finally exit Kate.

GNOME

In Gnome, first open the Terminal through the Application menu. (The App menu is usually in the upper left-hand corner, labeled as Applications.) On my system, it is under Applications -> Accessories -> Terminal.

In the input command window that displays, copy/paste the this command into it and press enter:
gksu gedit /lib/udev/rules.d/70-hid2hci.rules

The 'gksu' tells the system you want to run the text editor (gedit) with Admin access. You will be prompted for your individual user password, which you enter. Then gedit should open with a file ready for you. (This is the /lib/udev/rules.d/70-hid2hci.rules file which we told gedit to open for us.) If this file does not open, you can open it manually by going to menu File -> Open... and then navigating to the '/' root directory, down to 'lib' and so on until you find the file ' 70-hid2hci.rules'.

Edit the file as directed earlier in this article. Save the file, close the file (menu File -> Close), and then finally exit gedit. You can close the Terminal also.

Hope that helps.

Network Management Disabled

I am surprised I have not mentioned this before. This is a recurrent bug that's been cropping up in KDE 4 since version 4.3 as far as I can tell. (It may have started later, so don't quote me on the exact date, and it might have nothing to do with KDE itself, and might be an Ubuntu thing.)

The symptoms are the computer boots, the desktop environment loads (Gnome, KDE, etc.) and there is no Internet, when there should be. You click on the Network Manager and it tells you "Network Management Disabled." Bug report here. This bug has come and gone for me for a while now.

The problem is an incorrectly configured configuration file. (Basically, this is a bug that should never have happened but it did. Thankfully it's easy to fix.)

Open this file /var/lib/NetworkManager/NetworkManager.state with Admin privileges, and make the following changes. (If you need help on editing a system text file / configuration file, see this Article for a simple New Users guide.)
NetworkingEnabled=false
to
NetworkingEnabled=true
Save the file and close it. There may be a system service you can restart, but I cannot recall it at this time. Just reboot and your network should return to normally.