Linux

Software Center in Ubuntu 12.04 crashes on startup

Recently the Software Center started crashing on startup. Initially I thought it was due to network issues, but after a further examination it turned out not to be the case.
Running it from the panel will not give you any feedback about why it crashes, so I executed it command line to see what is going on:

/usr/bin/software-center

That produced the following output:

2012-05-23 09:47:04,729 - softwarecenter.ui.gtk3.app - INFO - setting up proxy 'None'
2012-05-23 09:47:04,732 - softwarecenter.db.database - INFO - open() database: path=None use_axi=True use_agent=True
2012-05-23 09:47:04,926 - softwarecenter.backend.reviews - WARNING - Could not get usefulness from server, no username in config file
2012-05-23 09:47:05,129 - softwarecenter.db.pkginfo_impl.aptcache - INFO - aptcache.open()
Traceback (most recent call last):
  File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 243, in open
    self._cache = apt.Cache(GtkMainIterationProgress())
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 102, in __init__
    self.open(progress)
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 145, in open
    self._cache = apt_pkg.Cache(progress)
SystemError: E:Encountered a section with no Package: header, E:Problem with MergeList /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_multiverse_binary-amd64_Packages, E:The package lists or status file could not be parsed or opened.
2012-05-23 09:47:06,770 - softwarecenter.db.enquire - ERROR - _get_estimate_nr_apps_and_nr_pkgs failed
Traceback (most recent call last):
  File "/usr/share/software-center/softwarecenter/db/enquire.py", line 115, in _get_estimate_nr_apps_and_nr_pkgs
    tmp_matches = enquire.get_mset(0, len(self.db), None, xfilter)
  File "/usr/share/software-center/softwarecenter/db/appfilter.py", line 89, in __call__
    if (not pkgname in self.cache and
  File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 263, in __contains__
    return self._cache.__contains__(k)
AttributeError: 'NoneType' object has no attribute '__contains__'
Traceback (most recent call last):
  File "./software-center", line 176, in 
    app.run(args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1343, in run
    self.show_available_packages(args)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/app.py", line 1273, in show_available_packages
    self.view_manager.set_active_view(ViewPages.AVAILABLE)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/session/viewmanager.py", line 149, in set_active_view
    view_widget.init_view()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/panes/availablepane.py", line 168, in init_view
    self.apps_filter)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 240, in __init__
    self.build(desktopdir)
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 491, in build
    self._build_homepage_view()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 266, in _build_homepage_view
    self._append_whats_new()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 430, in _append_whats_new
    whats_new_cat = self._update_whats_new_content()
  File "/usr/share/software-center/softwarecenter/ui/gtk3/views/catview_gtk.py", line 419, in _update_whats_new_content
    docs = whats_new_cat.get_documents(self.db)
  File "/usr/share/software-center/softwarecenter/db/categories.py", line 124, in get_documents
    nonblocking_load=False)
  File "/usr/share/software-center/softwarecenter/db/enquire.py", line 317, in set_query
    self._blocking_perform_search()
  File "/usr/share/software-center/softwarecenter/db/enquire.py", line 212, in _blocking_perform_search
    matches = enquire.get_mset(0, self.limit, None, xfilter)
  File "/usr/share/software-center/softwarecenter/db/appfilter.py", line 89, in __call__
    if (not pkgname in self.cache and
  File "/usr/share/software-center/softwarecenter/db/pkginfo_impl/aptcache.py", line 263, in __contains__
    return self._cache.__contains__(k)
AttributeError: 'NoneType' object has no attribute '__contains__'

As you can see in the SystemError part, it seems to have an issue with the one of the repository lists in /var/lib/apt/lists/, so the natural solution as this post suggests is to remove the one it is complaing about or better yet, remove all and run apt-get update to create them again:

sudo rm -rf /var/lib/apt/lists/*
sudo apt-get update

You should be good to go…

Wednesday, May 23rd, 2012 Linux, Ubuntu 5 Comments

Remove vim color coding in Ubuntu

By default Ubuntu’s vim utility is configured to color code certain keywords, comments, extensions, etc.

I personally do not like this. So I just disable that feature. And while I am at it, I also enable the ruler, which displays the line number and the character position of the cursor.

To do that for all users, edit the /etc/vim/vimrc file add the following lines to it:

syntax off		" Clear any font/color/hilighting
set ruler		" Enable the ruler

If you want to do that just for a particular user, create a .vimrc file in that user’s home directory (if it does not already exist) and add the same lines to it.

Monday, November 7th, 2011 Linux, Ubuntu 1 Comment

How to enable the ath9k wireless driver on Ubuntu Lucid (10.04)

Ath9k is the latest wireless driver for the newer Atheros chipsets and just like the MadWifi driver could be used to put your NIC in a promiscuous mode, do packet injection, etc. in order to crack WEP.

Check the compatibility of your wireless NIC first.
To find out what kind of chipset you have, run:

lspci | grep -i wireless

The ath9k driver is present in any kernel starting with version 2.6.27. The oldest supported ath9k version comes with kernel 2.6.32. That means most likely you already have the driver and there is no need to download it, all you have to do is enable it.

The general steps in order to enable ath9k are:

  1. Get the kernel source and some necessary packages
  2. Configure the kernel
  3. Compile and install the kernel
  4. Configure grub to boot from the new kernel image

Some steps might sound a bit intimidating, but actually they are very easy to do.

Since you will be running a lot of commands as root, it would be more convenient to open a bash shell as root instead of preceding all commands with sudo. The easiest way to do this is to run the following command it terminal:

$ sudo bash

Note: The above command has nothing to do with enabling the root login. I strongly recommend to never enable the root login due to serious security risks! Some blogs might ask you to do that, but there is hardly ever any reason to do this.

1. Get the kernel source and some necessary packages

# aptitude install git-core build-essential kernel-package qt3-dev-tools libqt3-mt-dev fakeroot
# apt-get install linux-source 

The above command downloaded the kernel source tarball in /usr/src.
In my case the kernel version I am working with is 2.6.32 (patch level 15). Replace these numbers with the version of your kernel source.
Now lets cd to the place we downloaded the kernel source:

# cd /usr/src

Uncompress and extract the kernel source:

# tar xjvf linux-source-2.6.32.tar.bz2
# cd linux-source-2.6.32

2. Configure the kernel

Before configuring the kernel, lets import the configuration of the currently running kernel. This way we do not miss to enable something we currently have and need:

# cp -vi /boot/config-`uname -r` .config

Now we are ready to add a few configurations to the kernel:

# make xconfig

This opens up an xwindow with a hierarchical structure representing the kernel settings:

Linux Kernel Configuration

Linux Kernel Configuration

First enable mac80211:

Networking  --->
  Wireless  --->
     Improved wireless configuration API
     Generic IEEE 802.11 Networking Stack (mac80211)

You can then enable ath9k in the kernel configuration under:

Device Drivers  --->
  [*] Network device support  --->
        Wireless LAN  --->
             Atheros 802.11n wireless cards support

If you re-used the existing configuration, note that Ubuntu kernels build with debugging information on, which makes the resulting kernel modules (*.ko files) much larger than they would otherwise be. To turn this off, go into “Kernel hacking”; then, under “Kernel debugging”, turn OFF “Compile the kernel with debug info”.

Save changes and exit.

3. Compile and install the kernel

First, let’s ensure a “clean” build:

# make-kpkg clean

Since the kernel compilation might take some time, it is best to set the CONCURRENCY_LEVEL variable, so that it can take a full advantage of the multiple processors or mulitple CPU cores on the machine. The CONCURRENCY_LEVEL variable is equal to the number of processors on the machine plus one. So if your machine has a dual core processor the variable will be equal to 3. To find out how many processors or cores your computer has run:

# lshw -C CPU

In my case I get cpu:0 and cpu:1, which means that I have a dual core processor.
Besides the CONCURRENCY_LEVEL, the only other thing we need to pay attention to here is the “–append-to-version” option. It basically adds that string to the end of the kernel name and could be set to anything. That gives you the opportunity to put there something meaningful to distingush the kernel from the other ones. In this case I called it “-mykernel”.

Now you are ready to compile:

# CONCURRENCY_LEVEL=3 fakeroot make-kpkg --initrd --append-to-version=-mykernel kernel-image kernel-headers

If you want to see the ubuntu splash screen (or use text mode) before you get to X instead of just a black screen, you’ll want to make sure the framebuffer driver loads:

# echo vesafb >> /etc/initramfs-tools/modules
# echo fbcon >> /etc/initramfs-tools/modules

Now install the kernel and the headers from the created Debian packages:

# dpkg -i linux-image-2.6.32.15+drm33.5-mykernel_2.6.32.15+drm33.5-mykernel-10.00.Custom_i386.deb
# dpkg -i linux-headers-2.6.32.15+drm33.5-mykernel_2.6.32.15+drm33.5-mykernel-10.00.Custom_i386.deb

Now let’s generate an initramfs (initrd) image, that will be loaded up by grub on boot:

# cd /boot

To avoid confusion with the next command, here is what my /boot directory contains before I run the mkinitramfs command:

# ls -altr
total 27700
-rw-r--r--  1 root root  160280 2010-03-23 05:37 memtest86+.bin
-rw-r--r--  1 root root 4034976 2010-08-20 14:22 vmlinuz-2.6.32-24-generic
-rw-r--r--  1 root root 1689036 2010-08-20 14:22 System.map-2.6.32-24-generic
-rw-r--r--  1 root root  115905 2010-08-20 14:22 config-2.6.32-24-generic
-rw-r--r--  1 root root  651618 2010-08-20 14:22 abi-2.6.32-24-generic
-rw-r--r--  1 root root    1196 2010-08-20 14:24 vmcoreinfo-2.6.32-24-generic
drwxr-xr-x 22 root root    4096 2010-09-04 15:27 ..
-rw-r--r--  1 root root       0 2010-09-07 22:11 initrd.img-2.6.31-wl
-rw-r--r--  1 root root 7977082 2010-09-07 22:49 initrd.img-2.6.32-24-generic
-rw-r--r--  1 root root  115845 2010-09-08 02:13 config-2.6.32.15+drm33.5-mykernel
-rw-r--r--  1 root root 3999488 2010-09-08 07:38 vmlinuz-2.6.32.15+drm33.5-mykernel
-rw-r--r--  1 root root 1644782 2010-09-08 07:38 System.map-2.6.32.15+drm33.5-mykernel
drwxr-xr-x  3 root root    4096 2010-09-08 16:01 .

Run the mkinitramfs to generate the initrd:

# mkinitramfs -k -o initrd.img-2.6.32.15+drm33.5-mykernel 2.6.32.15+drm33.5-mykernel

4. Configure grub to boot from the new kernel image

# update-grub2

The last thing to do is to ensure that the ath9k module loads on boot. That will avoid running modprobe ath9k after each reboot.
So lets add the line ath9k to the end of the /etc/modules file:

# echo ath9k >> /etc/modules

Now reboot your computer and chose the new kernel to boot into from the grub menu.

Your wireless NIC should be working now using the ath9k driver.


Credits:

Friday, September 17th, 2010 Linux, Ubuntu 15 Comments

Change the date and time (or any other EXIF image meta-data) of pictures with Ubuntu

There is a very flexible and easy Linux tool that helps you change the EXIF meta-data of images. It allows you to change individual files or whole bunch of them with one command. You can also put different rules about what files and how you want to change them if you need to.

The program is called exiftool. So let’s install it first.

In terminal execute:

sudo apt-get install libimage-exiftool-perl

Now you are ready to start changing the meta-data of the images.

For example, if I wanted to change all the dates and times (DateTimeOriginal, CreateDate and ModifyDate) of the IMG_01.jpg file to the 8th of August 2010 at 3:35:33 PM I would do:

exiftool -AllDates='2010:08:08 15:35:33' -overwrite_original IMG_01.jpg

If I wanted to change the dates on all the files in the “images” directory, I would do:

exiftool -AllDates='2010:08:08 15:35:33' -overwrite_original images

The “-overwrite_original” option is necessary if you want to change the meta-data of the original images. If you omit that option, then exiftool will back-up the originals by making a copy of them and adding “_original” to the end of the file names.

If you want to change the dates to all the files in the “images” directory that were taken by a Cannon camera (and not touch the rest) I would do:

exiftool -AllDates='2010:08:08 15:35:33' -if '$make eq "Canon"' -overwrite_original images

As far as changing dates and times, there is another option of exiftool that lets you do time calculation.

For example, the other day I found out that my camera’s time was correct but the date was ahead by 30 days. That meant that all the photos I had taken lately had dates that were off by exactly 30 days. If I were to use the above examples I could set the dates individually (which would be a long and tedious process) or set all the images to the same date and time (which would be wrong). In this case I used the date calculating option and just executed:

exiftool -AllDates-=720:00 -overwrite_original images

That command subtracts 720 hours (30 days) off the dates of each image file in the images directory. Now every image has the exact date and time it was taken.

I have only scratched the surface of what this tool is capable of. For more information look at the man pages of the exiftool command.

Wednesday, August 11th, 2010 Linux, Ubuntu 2 Comments

Just Upgraded my Nexus One from Android 2.1 to Android 2.2

The latest Android OS version 2.2 (“Froyo”) was announced at the Google I/O conference on the 11th of May. As you already probably know it adds multiple enhancements like tethering, wifi hotspot functionality, full support for Flash, etc. Since I use my Nexus One phone for Android development, I did not want to download the update from Google and then install it with adb. I just wanted to wait for the over the air update.

And to my surprise, the first time I looked at my phone this morning, I had this message on the screen:

Android 2.2 Upgrade Message

Android 2.2 Upgrade Message

I was not sure how long it would take, so I just hit “Install Later”. Then a couple of hours later, when I was ready, I just went to Settings -> About Phone -> Software Update and hit “Restart & Install”:

Android 2.2 Settings -> About Phone -> System Updates

Android 2.2 Settings -> About Phone -> System Updates

The phone rebooted and started the upgrade. The whole process with the installation took less than 5 minutes.

I am not going to go into details what the features of Android 2.2 are. There are so many announcements and blog posts on this matter already out there…

But what I am going to say is that Android is the leading OS in the mobile phone market right now. I can say this definitively, since I have been using iPhones for the past 2 years. I have a 3G and a 3GS phones. I encourage any iPhone user to go and check out an Android device. Please do not look at the low end hardware that runs Android (like the Cliq, the old G1, etc.). Check out the HTC Evo, the HTC Incredible, the Nexus One etc. See for yourselves before you make your decision to get another phone and lock into a 2 year contract. I will mention only a few things you will discover on the Android device that your phone probably does not have right now:

  1. Turn by turn voice navigation
  2. Built in tethering
  3. Built in WiFi hotspot capability supporting multiple devices
  4. Full support for Flash
  5. Full blown multitasking on the OS level (no need for the programmer to do anything special)
  6. Integrated speech recognition across the board. Voice input could be used anywhere in place of the text input.
  7. Over the air updates and syncing. That means no iTunes or the like!

And many other features that I do not want to get into details right now. I am sure you can fill in the gaps for yourselves…

Friday, July 2nd, 2010 Android, Apple, Linux No Comments

Search

 

Archive

May 2013
M T W T F S S
« Apr    
 12345
6789101112
13141516171819
20212223242526
2728293031  

Other