Opera on GNU/Linux – Moving an Account Reveals a Problem

I recently purchased the final part to build myself a new AMD Phenom Quad-core PC system to run Mandriva desktop GNU/Linux. I have been getting the parts a piece at at time over the past 12 months. I may go into the specifications of the new PC in a later article. For now I want to cover resolving a problem I had with Opera after my move to the new PC.

I create several accounts for myself on my desktop GNU/Linux system. Each account is used for a different purpose. Over the years I have ended up with two “personal” accounts. When moving to my new PC one of my goals was to consolidate the two separate “personal” user accounts for myself into one. This meant copying over settings and saved data from one of the accounts to the other account so as to not lose the settings. The applications in question were used only in one account on a regular basis so I did not have to worry about trying to merge settings. As I had been using this account I was copying for several years it would be a problem to recreate all the settings for all the applications I wanted to continue using. One of those applications for which I wanted to preserve the settings is Opera.

On GNU/Linux Opera stores its data in a hidden directory named .opera in each user account. Desktop GNU/Linux user accounts are typically under /home/username where username is the login name of each user. To preserve the settings I copied the .opera directory from the old account on the old PC using the shell file transfer capability in mc (GNU Midnight Commander file management utility) as root. I had to enable root ssh access on the old PC to do this. Giving remote ssh access to root is not recommended for regular day to day operations but is useful in situations like this. Then I ran chown -R newuser.newuser .opera on the copied directory to give it and the files below it the name and group of the new user.

The first time I ran Opera under the new account I received this popup error message:

Opera error - Store init failed

I do not use Opera Mail but obviously something “broke” when I copied the .opera directory. This error does not keep Opera from working but it is an irritant and I decided to find the problem and solve it. A quick perusal of a web search turned up information about this error but not anything that applied to my situation. Granted I only looked at three of the returned searches because I had an inspiration. I suddenly suspected that Opera uses hard coded paths in some of its files. I opened an xterm and ran grep -r “/home/oldusername” .opera which revealed my suspicions were correct.

The files that grep showed with hard coded paths are global.dat, opera6.adr, opera6.ini and pluginpath.ini. The fix is as simple as making sure Opera is closed, then opening each file in vim and using :%s/\/home\/oldusername/\/home\/newusername/g then 😡 to save and exit. Yes, there are ways to do this with awk, sed and the like but I don’t know those tools as well as I should (Sad, isn’t it?). But I do know vim so that is what I used. For the command line fearing user a GUI text editor like gedit or nedit would work as well. Some of the hard coded paths in pluginpath.ini pointed to directories that were only on the old PC so I just removed those. After editing these files I opened Opera and the error was gone.

Okay. I know some of you are itching to show your elite command line skills so feel free to provide your own solution to this problem with sed, awk or whatever favorite command line tools you use for these problems.

This article has had this many unique views:

free hit counter
hit counter download code

Notice: All comments here are approved by a moderator before they will show up. Depending on the time of day this can take several hours. Please be patient and only post comments once. Thank you.

Edit Sun Aug 16 12:07:39 CDT 2009: Repair a poorly worded sentence.


Published by

Gene A.

Gene is a "Unix Guy", network technologist, system trouble-shooter and IT generalist with over 20 years experience in the SOHO and SMB markets. He is familiar with and conversant in eComStation (a.k.a. OS/2), DOS (PC, MS and Free), Unix, Linux and those GUI based systems from Microsoft. Gene is also a follower of Jesus (forgiven, not perfect), and this does inform his world view.

6 thoughts on “Opera on GNU/Linux – Moving an Account Reveals a Problem”

  1. yeah- Opera is fickle. When I move, I only copy what I need from the .opera directory. There’s a lot of junk in there and it only increases the chances of Opera breaking after a move.

  2. alvare (comment #1), thanks for the comment. How would one use that sed line in a script? Or is that just used “as is” in the directory containing the files that need to be changed? Here is the relevant line for ‘-i’ from ‘man sed’:

    -i[SUFFIX], –in-place[=SUFFIX]
    edit files in place (makes backup if extension supplied)

  3. Here’s the full syntax for alvare’s sed, with a minor change:

    sed -i “s@/home/oldusername@/home/username@g” filename

    by using the @ sign as the separator, you don’t need to escape the forward-slashes at all.

    BTW, Vim’s :%s directive uses the same general syntax as sed does, so anything you can do it it, you can usually do with sed at the command line.

Comments are closed.