Fedora laptop setup – Dell Inspiron 1420

I ve been using fedora since FC3. I bought my laptop in 2008 and since then I ve been using fedora on my laptop. I was on Fedora 7 when I first bought my laptop and today am on Fedora 18. After every install of Fedora, I end up looking up for some of the regular problems.. sound, disable hibernate/sleep on lid close, etc etc.

This blogpost is a placeholder for all such efforts going forward:

No Sound problem:

cat /etc/modprobe.d/snd-hda-intel.conf
options snd-hda-intel model=dell-3stack

Stop sleep/hibernate on lid close

$ gsettings list-recursively org.gnome.settings-daemon.plugins.power|grep lid
org.gnome.settings-daemon.plugins.power lid-close-ac-action 'blank'
org.gnome.settings-daemon.plugins.power lid-close-battery-action 'blank'
org.gnome.settings-daemon.plugins.power lid-close-suspend-with-external-monitor false

$gsettings set org.gnome.settings-daemon.plugins.power lid-close-ac-action 'blank'

I also found this..
http://nottooamused.wordpress.com/2012/12/29/fedora-17-and-18-how-to-disable-auto-suspend-when-laptop-lid-is-closed/

Error establishing a database connection – WordPress Error

Well, for the last few weeks I ve been seeing this error quite often on my blog. I didn’t think of it much initially as it used to go away on a mysql restart. However, today I ran into it and was persistent after mysql restarts. So I started digging a bit more and enabled debugging in wp-config


in wp-config.php

define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_DISPLAY’, true);

This didn’t show any error that could help me. I could ve tried enabling further logging in apache to see if that helps

http://codex.wordpress.org/Editing_wp-config.php#Configure_Error_Log

I had tried logging into mysql with the username and password configured in the wordpress config and it worked fine. So I knew those were fine and mysql was running fine. I even restarted httpd a few times to confirm, but it didnt help either.

Then I checked up the mysqld log and voila!

 

101:130113 10:15:33 InnoDB: Database was not shut down normally!
116:130113 16:37:34 InnoDB: Database was not shut down normally!
131:130113 16:39:16 InnoDB: Database was not shut down normally!
146:130113 16:42:20 InnoDB: Database was not shut down normally!
158:130113 16:45:05 InnoDB: Database was not shut down normally!

130113 10:15:32 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130113 10:15:33 InnoDB: Initializing buffer pool, size = 8.0M
130113 10:15:33 InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130113 10:15:33 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files…
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer…
130113 10:15:33 InnoDB: Started; log sequence number 0 1049991
130113 10:15:33 [Note] Event Scheduler: Loaded 0 events
130113 10:15:33 [Note] /usr/libexec/mysqld: ready for connections.
Version: ’5.1.56′ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 Source distribution
130113 16:37:04 mysqld_safe Number of processes running now: 0
130113 16:37:04 mysqld_safe mysqld restarted
130113 16:37:29 InnoDB: Initializing buffer pool, size = 8.0M
130113 16:37:30 InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130113 16:37:34 InnoDB: Database was not shut down normally!

Version: ’5.1.56′ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 Source distribution
130124 20:22:26 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./wp_options.MYI’; try to repair it
130124 20:22:26 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./wp_options.MYI’; try to repair it
130124 20:25:00 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./wp_options.MYI’; try to repair it
130124 20:25:00 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./wp_options.MYI’; try to repair it
130124 20:33:04 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./wp_options.MYI’; try to repair it
130124 20:33:05 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./wp_options.MYI’; try to repair it
130124 20:33:05 [ERROR] /usr/libexec/mysqld: Incorrect key file for table ‘./wp_options.MYI’; try to repair it
130124 20:34:44 mysqld_safe Number of processes running now: 0
130124 20:34:44 mysqld_safe mysqld restarted
130124 20:34:47 InnoDB: Initializing buffer pool, size = 8.0M
130124 20:34:47 InnoDB: Completed initialization of buffer pool
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
130124 20:34:48 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files…
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer…
130124 20:34:48 InnoDB: Started; log sequence number 0 1049991
130124 20:34:48 [Note] Event Scheduler: Loaded 0 events
130124 20:34:48 [Note] /usr/libexec/mysqld: ready for connections.
Version: ’5.1.56′ socket: ‘/var/lib/mysql/mysql.sock’ port: 3306 Source distribution
130124 20:34:59 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired
130124 20:34:59 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired
130124 20:34:59 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired
130124 20:34:59 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired
130124 20:34:59 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired
130124 20:34:59 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired
130124 20:35:06 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired
130124 20:35:06 [ERROR] /usr/libexec/mysqld: Table ‘./wp_options’ is marked as crashed and should be repaired

So looks like this is what was causing my recent problems.

Once I saw this in the mysql logs, it was a simple fix:


mysql> repair table wp_options;

Found 231 of 230 rows when repairing wp_options

 

And so far its all been good after that :)

The Mayans were right!

The Mayans were right! It is the end of the world. The end of the world as we knew it. With the deads of maestros like Yash Chopra, Pandit Ravi Shankar; others like Neil Armstrong, Michael Clarke Duncan, Whitney Houston, Jaspa Bhatti, Verghese Kurien, Dara Singh, A.K Hangal to name a few; it indeed seemed as if they were all being ported away to “2012″ themed escape pods/ships. Closer home, where everything seemed “theek hai“, the famed IAC broke up to just become yet another political party, even if it be for the common man, while India rallied for her Damini, the Nirbhaya Amanat symbolised the end of an era; and beginning of another one where the boy child needs to be taken care of. And what else to say when The God himself says its time to hang up the boots.

Yes, the world has ended. Everything that begins has an end; and after every end there is a new beginning. The Mayans never said the circle is broken. Their calendar is a circle. Its just the beginning of a new one. Here is to the brand new year, with all its copy lefts and common creatives; see you tomorrow!

PS: Wishing you all a very happy new year!

Lifetime Roadtax in Karnataka – rates – 2012

So I recentlty bought (or rather booked) my most expensive acquisition so far. A Volkswagen Polo 1.6L. Every dealer in bangalore was quoting a road tax of 15.4%. But no one was able to substantiate it on paper or from the official RTO site. In addition, there was a team-BHP thread where people talked about it being 13% + 10% cess on tax = 14.3% tax total. I also read the same initially, but then found out that the tax is rather 14% (as mentioned in the addendum) and cess 11% (not updated on site but checked with RTO official on phone).

So, if you are here to find out the road tax in karnataka, hit here:

http://rto.kar.nic.in/KMVTA%202010.pdf

I would ve updated the team BHP thread rather than putting a blog post here but team BHP wont accept my “registration”. Your loss team BHP-ians.

Team Winner, Superstar 2011 @ Yahoo!

The wall of fame poster!
Yodel for the Algorithmic Search Bing Transition Team
The Algorithmic Search Bing Transition team maniacally focused on desktop and mobile migration of web, image and video search in 40+ global markets from Yahoo’s YST infrastructure to Microsoft’s Bing platform. The Bing Transition Team in Bangalore specifically took complete responsibility for transitioning image and video search to the Bing platform. The Bing transition represents a first-of-its kind partnership for Yahoo!. It is an inherently complex relationship, extremely difficult technical transition and horizontal cross company project unlike any Yahoo! has undertaken in the past. But this team was up to the challenge, delivering with speed and quality. Successful completion of the Algorithmic Search transition in multiple global markets will save $150M+ annually in capital expenditure costs, allowing Yahoo! to focus on global search experience innovation and beyond, both in our core desktop search business, but also importantly across mobile and tablet devices.

Team Winner, Superstar 2011

How to restore all apps from backup on android

I ve been changing my roms often on my nexus S, the latest being Icecream. One thing thats always been painful was all application restore across roms. Market downloads it all over again but you ve to wait for it. In my case, my apps size about 300 MB in all, abut 130 apps. So I ve to wait for all of them to download all over again.

There are means and ways of taking backup and restores. But being a command line guy, I always was too lazy for them. That’s when I decided to create my own way of backing up the apps and restoring them.

I am assuming you’ll know what it means by adb and mount when you read them. If not, please head over to xda forums or other similar android forums. Another assumption am making is you are already rooted.

How to take backup of apps before flashing:

1) Go to recovery -> mounts and storage
2) mount /data and /sdcard.
3) mount USB storage
4) go to adb shell
5) Copy your app .apk files to the USB storage
mkdir /sdcard/app_backup
cp -rv /data/app/* /sdcard/app_backup

Once you are done, you can make another copy out of the USB storage on your computer as well.

When you are done with your flash, repeat the above (1-4) steps, and copy the files from /sdcard/app_backup to /data/app/
cp -rv /sdcard/app_backup /data/app/

(there is adb push and pull as well, I ven’t tried that. See adb -h for more info and maybe you can try that as well).

6) clear the cache (wipe cache partition)
7) Advanced -> wipe dalvik cache

8) reboot :)

The reboot might take time after the steps above for restore as it will create the dalvik cache out of the apps.
It might look like its stuck on the bootloader screen (CM round circle or whatever is your rom). Give it sometime, go for a coffee. Time will depend upon your number of apps. I did went for a cup of coffee and it was ready by the time I came back.

This is a very rudimentary post on how to restore apps. You can create nandroid backups as well. In that case your /data will be saved as data.ext.tar or something similar. Just untar it and get the files for restoring.

Let me know if you need more help.

cheers
Anshu Prateek

PS: In case you want to unroot your nexus s to a stock image, here is a good compilation of stock images:
http://forum.xda-developers.com/showthread.php?t=1063664

The Scam that helped the people.

All the hullabaloo around the India’s 2G scam is something that I deeply detest. Am I the only one who sees the public benefit that happened due to spectrums being handed out for little to no license fees? Look at where India’s cellular penetration is. Look at the cellular tariff’s in India and compare it to the rest of the world. India now has the lowest tariff in the world. Could this ve happened had the spectrum’s being instead sold at exorbitant prices? Look where the 3G network infrastructure, penetration and the availability is today in India. Of course the government “earned” a lot of money from these 3G licenses (and in fact it were these 3G spectrum bids and final prices which brought the “apparent” 2G spectrum scam to forelight), but who is the ultimate loser in this game? Telco’s brought 3G licenses at the obscene prices only coz they were buoyant by the existing 2G environment. What they forgot was that the 2G era happened because of cheap licenses which left the telcos with enough money to spend on the infrastructure.

In my opinion, the guy who decided to sell the 3G license is the bigger culprit. Typical Indian style, milk the cow as much as you can. Infact this was worse than slaying the golden goose.

Just imagine the internet penetration that 3G would have brought to masses if these were easliy available. I remember the days when I was on dialup. I used to get 12-13kBps average, 40kBps peak. Today I ve a 5MBps connection and am in 99.1 percentile of the Indian population having high speed internet. The definition of broadband in India is pathetic. 256kBps is defined as Broadband by TRAI.

IMO, one of the best decisions that was made in the last decade was the free giveaway of the 2G spectrum. Money might have changed hands, and whats wrong is wrong, but not selling the 2G spectrum was definitely the best decision the silent PM agreed to.

find to exclude hidden files

I needed to clean up my home account, to remove all the usual files, except for the hidden files (the various gnome/app confs/settings etc) into one directory. This is what I used:

find . -type f -maxdepth 1 \( ! -regex '.*/\..*' \) -exec mv -vf {} all \;

I got the regex part from here:
http://www.linuxquestions.org/questions/linux-general-1/how-do-i-make-find-exclude-hidden-files-files-613793/

Also, later I found another one that I vent tried yet, maybe later:

http://www.linuxquestions.org/questions/linux-newbie-8/delete-regular-files-not-hidden-files-with-find-rm-in-one-line-older-than-15-a-855070/


find /home -type f -mtime +15 -not -name ".*" -exec rm {} \;

A beginners guide to git how to!

hi,

Let me first tell you what all I am going to tell you.

If you are coming from the world of svn/cvs (like me), I am going to tell you how to do git equivalent of

svn checkout ( git clone)

svn commit = (git add + git commit + git push)

What I am not going to tell you is how to setup your git account, create a new git repo etc, as the existing documentation on git is pretty good for these.

Ok, so lets begin now. I am assuming that your git account is ready, new files/folders are setup and you want to checkout your project in a new workspace.

In SVN, its a simple

svn checkout {location}

however when we try similar thing in git, we get an error!

git checkout git@github.com:anshprat/myFiles.git
fatal: Not a git repository (or any parent up to mount parent )
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Whoops!
You see, git checkout is not like svn checkout. What git checkout does is checkout a branch or paths to the working tree.

So to do a fresh git “checkout”, you basically have to do a git clone.

git clone git@github.com:anshprat/myFiles.git
Cloning into myFiles...
Enter passphrase for key '/home/anshup/.ssh/id_rsa':
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 3 (delta 0)
Receiving objects: 100% (6/6), done.

Voila! Am done.

Now how to do a git equivalent of svn commit ?

In git, this is broken down into 3 parts:

git add
git commit
git push

In svn, svn add is only for adding a new file to under revision control.
In git, git add, is useful for adding any changes to the index that would be finally merged or committed to the git repo online.

git commit : by this you are confirming that the changed files that you ve added by git add are ready to be committed.

git push: This is the command that finally pushes your changes back to the git repository!

So now you know how to do a “svn checkout and svn commit” using git :P

Look out for more as I delve more into git :)