Linux Blog

C++ preprocessor “/lib/cpp” fails sanity check

Filed under: Shell Script Sundays — TheLinuxBlog.com at 8:59 am on Sunday, November 21, 2010

c-preprocessor-libcpp-fails-sanity-check

Not exactly a shell script, but might be handy.

C++ preprocessor "/lib/cpp" fails sanity check

In my case I had forgot to install g++. Now I feel like a complete idiot, not the first time though.

Yum Messed Up

Filed under: General Linux,Linux Software — TheLinuxBlog.com at 10:05 am on Monday, November 16, 2009

So, this morning, when I got to work and booted up, I noticed something was wrong. My machine was not running as usual. It turns out, packagekit was sitting there being a general pain. I just wanted to look busy, so I killed the process. Turns out that wasn’t such a good idea, since it didn’t finish doing whatever it was doing and caused an ugly error like this:

rpmdb: Thread/process 28373/3077981888 failed: Thread died in Berkeley DB library
error: db4 error(-30975) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30975)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:
Error: rpmdb open failed
 
rpmdb: Thread/process 28373/3077981888 failed: Thread died in Berkeley DB library
error: db4 error(-30975) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30975)

Naturally, I tried using rpm, do try and fix things, since it indicated something to do with a database I tried:

[owen@linuxblog ~]$ sudo rpm --justdb

rpm: –justdb may only be specified during package installation and erasure

[owen@linuxblog ~]$ sudo rpm --rebuilddb
rpmdb: Thread/process 28373/3077981888 failed: Thread died in Berkeley DB library
error: db4 error(-30975) from dbenv->failchk: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 -  (-30975)

Well, it turns out that those options don’t work, and the rebuilddb gave an error about the db4 being corrupt. Well, I decided to go into /var/lib/rpm as the other error had that directory and found the db4 files. Running db45_recover sounded like it might work, so I gave it a shot.

[owen@linuxblog rpm]$ db45_recover -h /var/lib/rpm/
db45_recover: unlink: /var/lib/rpm/__db.003: Permission denied
db45_recover: unlink: /var/lib/rpm/__db.004: Permission denied
db45_recover: unlink: /var/lib/rpm/__db.000: Permission denied
db45_recover: unlink: /var/lib/rpm/__db.002: Permission denied
db45_recover: unlink: /var/lib/rpm/__db.001: Permission denied
db45_recover: /var/lib/rpm/log.0000000001: log file unreadable: Permission denied
db45_recover: PANIC: Permission denied
db45_recover: DB_ENV->log_newfh: 1: DB_RUNRECOVERY: Fatal error, run database recovery
db45_recover: dbenv->close: DB_RUNRECOVERY: Fatal error, run database recovery

That’s right,you need to be root for this bad boy:

[owen@linuxblog rpm]$ sudo db45_recover -h /var/lib/rpm/

The above seemed to fix it for now. I guess next time I’ll think about it more before I start slaying processes on a Monday morning.

thinkpad_handler ACPI Script for Lenovo T61 hotkeys

Filed under: Shell Script Sundays — TheLinuxBlog.com at 2:54 pm on Sunday, January 18, 2009

Lenovo T61 Thinkpad_Handler ACPI hotkey

This weeks shell scripting article showcases the modifications I have made to the thinkpad_handler script that normally resides in /usr/lib/acpid on an OpenSuse distribution. For any one not using a Lenovo T61 this may or may not be useful, however anyone interested in shell scripting can take a look at the file and see the simplicity of shell scripts that are used in production environments.

Here is my modified thinkpad_handler script

One of the reasons I chose to post this was because an OpenSuse upgrade broke my brightness keys support, so I figured it would be another good place to back it up while providing a reference. My modifications are very minimal at the moment, I still have a lot of work to do.

Here are my minor modifications:

Line 102 to add support for suspendon Fn+F4

Line 127 to eject /dev/cdrom on Fn+F9

I used to have a special script for Fn+F8 which enabled me to toggle support for the touchpad and track point mouse. Until I find that script I’ll endure excruciating mental anguish every time I accidentally hit the touchpad. I’ll have to make an update to this script once I change all of the other hotkeys for OpenSuse on the Lenovo T61 or other similar Lenovo notebook computer. I should also probably upgrade to OpenSuse 11.1 and see if that makes a difference in the keyboard shortcuts.

Until next week, happy scripting!

Fedora 9 Thunderbird Update Fix

Filed under: Linux Software — TheLinuxBlog.com at 12:01 am on Wednesday, January 14, 2009

Fedora 9 Thunderbird
While updating a Fedora 9 installation I ran across an error. The error was with the Mozilla Thunderbird package that I use on a regular basis.
The error looked like this:

 Running Transaction
Updating       : thunderbird                                                                                                                                                  1/2
Error unpacking rpm package thunderbird-2.0.0.19-1.fc9.i386
error: unpacking of archive failed on file /usr/lib/thunderbird-2.0.0.19/dictionaries: cpio: rename

Obviously any fix that I implemented couldn’t loose my mail. The problem was with the dictionaries more specifically the /usr/lib/thunderbird-2.0.0.19/dictionaries file. The error is not very specific but lets us know its having trouble unpacking the archive and ends with cpio: rename. So here is what I did to solve the problem:

 cd /usr/lib/thunderbird-2.0.0.19/
sudo mv dictionaries dictionaries-old

Thunderbird data is stored in ~/.thunderbird it is advisable you make a backup of your mail if it is that important to you. I didn’t since this directory is a library directory and all of my mail can be downloaded again with imap. If you use pop you may want to consider doing a backup. After doing this it fixed Thunderbird and I’m all up to date. Horray!

Let me know if it worked for you and I’ll let you all know if there are any problems.

Office 2007 docx to ODF Conversion

Filed under: Linux Software — TheLinuxBlog.com at 10:38 pm on Monday, September 29, 2008

I was going to write an article on how to open docx’s and other Office 2007 documents but there are numerous articles out there explaining how to do this on many distributions. They all basically say the same thing, you download the file, extract it and put it in your open office directory. Normally there are a couple of files but the on we are interested in is the main binary. What some people don’t know is that if you want to just quickly open or convert a document you can do so by using the odfconverter binary. (Read on …)

Slackware 12 – MPlayer Setup in 3 Easy Steps

Filed under: General Linux — TheLinuxBlog.com at 9:46 am on Thursday, September 6, 2007

I made a quick installer script that will install MPlayer 1.0rc1 with the essential codecs pack and the Firefox plugin on a new installation of Slackware 12. With this script you should be able to get MPlayer set up on Slackware 12 in 3 easy steps.

1. Download The MPlayer Installer that I made (Right click Save Link As).
2. Change to root user and run the MPlayer Installer OR run the MPlayer Installer with sudo as followed:

bash-3.1$ su root
Password:
bash-3.1# sh mplayer_setup.sh

OR

sudo sh mplayer_setup.sh

3. If everything installed smoothly you can remove the mplayer directory and all files inside it. If it failed then all you need to do is (as root) removepkg on all of the .tgz files and do a rm /usr/lib/codecs/*.

Firefox should be restarted after the script has run. Test Firefox by going to various media sites, one I like to use is Apple Trailers (Because of the quality and speed). If you could contact me and let me know if the installer worked or failed I would appreciate it.

Line by line breakdown of the installer:

mkdir mplayer; cd mplayer;

Creates the mplayer directory and moves into it.

wget http://www2.linuxpackages.net/packages/Slackware-12.0/X11/MPlayer/mplayer-1.0rc1-i486-1goa.tgz; installpkg mplayer-1.0rc1-i486-1goa.tgz

Gets the mplayer-1.0rc1-i486 package from linuxpackages.net then installs the package

wget http://www2.linuxpackages.net/packages/Slackware-12.0/Library/mplayerplug-in/mplayerplug-in-3.45-i686-1amg.tgz; installpkg mplayerplug-in-3.45-i686-1amg.tgz

Gets the mplayer plug-in for Firefox and installs it

wget http://www4.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2

Downloads the essential codecs pack from mplayerhq.hu

tar xvjf essential-20061022.tar.bz2; mv essential-20061022/* /usr/lib/codecs; rm -rf essential-20061022

extracts the essential codecs package to one of the directories MPlayer looks for codecs in and removes the directory.