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:
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:
|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.