Monday, December 21, 2015

Fix installation issues in Ubuntu

All of us have an ultimate responsibility to keep ourselves and our systems clean. Keeping ourselves clean is not what I am going to talk about here, noth anywhere else either. Keeping our systems clean, absolutely YES. Keep it clean, if you want to save both money and time.

Imagine those days on MS windows (even now, with a chuckle), some rogue application messed up few entries in registry. Result, hours of your time spent on reconstructing it, or you'd take it to the nearest shop, hope your machine can be revived. If you think such problems do not exist in LINUX, I can only pity your ignorance. However magnitude of issues are different. It's lot more easier to fix such issues in LINUX than on windows.

Wait, what am I talking about? Let's consider a mundane activity. As often is the case, you want to install some application that your fried raved about. You head to the application's download page, get source URL, add source to PPA list, to handle installation through package manager. If the source location is compatible with your OS version, you whistle your way to happiness. What if it is not?

If you happen to add a wrong source, every update command will start to complain. As a novice user you are lost on ideas. You are fret making changes to sources.list file. You spend hours togather reading documents for a clean way to get the hell out.

I even know a few who did not hesitate to reinstall OS. Yep, things can get that crazy. Luckily for me, it has never happened. Watch for my "past" tense. Yep, until today. It finally happened on me.

What was I doing?
I was installing MongoDB. Like any other curious developer, greedy to learn every new technology, I was eager to jump down the lane of MongoDB, try it out for my application. I mistakenly took wrong source from one of the BLOGS. Of course as always, mistake was mine. I should have read documentation, before I copied source. My excitement blinded me. Everything went well, until I did

 sudo apt-get update

There it showed up
Err vivid/mongodb-org/3.0/multiverse amd64 Packages 404  Not Found

This was followed by a few more obnoxious errors.

I have helped to fix similar issues half a dozen times for my dear ones. This time, I thought, why not fix & document it. BTW, this is not a problem that the worls is unaware of, but as the saying goes "More the MERRIER", I'll also join the fray.

As you can see, problem is because you added a wrong source.

Right way for you to clean up includes 6 steps
1. Stop running services, if any
2. Remove source from source.list file
3. Remove s/w from your computer
4. Cleanup your system
5. Re-install
6. Take a break

Step 6 is not optional :)

How do we go about

Step 1
Check to see if there are mongo services. If they are there, remove them
sudo rm /etc/init.d/mongod*

Step 2
Remove Mongo repository from your source.list
sudo rm /etc/apt/sources.list.d/mongo*

Step 3
Remove all mongo related s/w from your machine
sudo apt-get purge mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools syslog-ng-mod-mongodb

Step 4
clean up. Please do not ingnore this step. Somtimes you may be lucky, but not so lucky on your bad day. Remember, you are here because you had a bad day. Don't add to your problems.
sudo apt-get clean

Step 5
Add right repository, update and install
echo "deb wheezy/mongodb-org/3.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install mongodb-org

Check if service is running
service mongod status

If it is not running, you can start the service by,
service mongod start

If you want to stop the service....
service mongod stop

Although I put an example of mongo, steps are similar for other applications too.

Next time you hit on a similar problem, don't fret, its easy clean up. Get back up like Cobra, after all life is not worth life without applies to LINUX more than anything. We learn the system better by mistakes, but make sure people don't notice it (If you are at fault).

Have a great day

No comments:

Post a Comment