Error while installing any package using apt-get

I was getting the following error while I tried to install any package using apt-get package manager.

For example:

Error
—–
# apt-get install wget
Reading package lists… Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/extra.linuxmint.com_dists_rafaela_main_i18n_Translation-en
E: The package lists or status file could not be parsed or opened.

Fix
—-
rm -vf /var/lib/apt/lists/* 

Then do,

apt-get update

Finally I was able to install packages using apt-get

# apt-get install wget
Reading package lists… Done
Building dependency tree
Reading state information… Done
wget is already the newest version.
The following packages were automatically installed and are no longer required:
empathy-common libfarstream-0.2-2 libfolks-telepathy25 libfolks25
libgssglue1 libtelepathy-farstream3 libtelepathy-logger3 libtirpc1
python-gst0.10 telepathy-logger
Use ‘apt-get autoremove’ to remove them.
0 upgraded, 0 newly installed, 0 to remove and 273 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up chromium-codecs-ffmpeg-extra (45.0.2454.101-0ubuntu0.14.04.1.1099) …
Setting up chromium-browser (45.0.2454.101-0ubuntu0.14.04.1.1099) …

Done…

 

How to change username when you have only one account in Ubuntu?

You cannot simply login as root in Ubuntu at the start up. Do it as the following way:

1) Open terminal and switch to root user. You can open terminal in search or by pressing Ctl+Alt+t.

2) Unlock root account and enable login as root like below

# passwd -u root (:::should be as root)

3) Reboot the machine

4) Once the login page appears, press Ctrl+Alt+Fx (x can be from 1 to 6) to open a terminal. Then switch root user and enter root password.

5) Change the username of account you wanted to.

# usermod -l newname oldname

6) Change the home folder name of user to new one if you want to. But this is optional.

# usermod -m -d /home/newname newname ((this would change home/oldname to /home/newname))

7) Lock the root account again

# passwd -l root

8) Switch back to GUI(the graphical login page at startup)

# Ctl + Alt + F7

(If it’s not working just reboot using “reboot” or “shutdown -r now” command)

Login with new username and enjoy working 🙂

((Above method is needed when only single user account is present in ubuntu. When you have only one account, you cannot do this username change by standing in the same account environment))

Install Skype in Ubuntu

Download debian package for Skype from the following url, from it I chose Ubuntu multi arch version.

http://www.skype.com/en/download-skype/skype-for-computer/

After downloading skype-ubuntu-precise_4.3.0.37-1_i386.deb , install it with dkpg which is the package manager for Debian version.

# dpkg -i skype-ubuntu-precise_4.3.0.37-1_i386.deb

If you get an error on it

———-
  Errors were encountered while processing:
  skype

# skype
skype: error while loading shared libraries: libXv.so.1: cannot open shared object file: No such file or directory
———-

Now we can check its file type

———-
# file /usr/bin/skype
/usr/bin/skype: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.24, BuildID[sha1]=0xa888f203730ac8ff33ae0261a95129dbb76e1857, stripped
———-

so it’s shared object and dynamically linked to shared libraries, and there might be problem some of is dependancies.

You can check dependant libraries of this package by using ‘ldd’ command

———-
# ldd /usr/bin/skype
    linux-gate.so.1 =>  (0xf77b4000)
    libXv.so.1 => not found
    libXss.so.1 => not found
    librt.so.1 => /lib/i386-linux-gnu/librt.so.1 (0xf5515000)
    libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xf5510000)
    libX11.so.6 => /usr/lib/i386-linux-gnu/libX11.so.6 (0xf53db000)
    libXext.so.6 => /usr/lib/i386-linux-gnu/libXext.so.6 (0xf53c8000)
    libQtDBus.so.4 => not found
    libQtWebKit.so.4 => not found
    libQtXml.so.4 => not found
    libQtGui.so.4 => not found
    libQtNetwork.so.4 => not found
    libQtCore.so.4 => not found
    libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xf53ab000)
    libstdc++.so.6 => /usr/lib/i386-linux-gnu/libstdc++.so.6 (0xf52c2000)
    libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xf527f000)
    libgcc_s.so.1 => /lib/i386-linux-gnu/libgcc_s.so.1 (0xf5262000)
    libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xf50ae000)
    /lib/ld-linux.so.2 (0xf77b5000)
    libxcb.so.1 => /usr/lib/i386-linux-gnu/libxcb.so.1 (0xf508c000)
    libXau.so.6 => /usr/lib/i386-linux-gnu/libXau.so.6 (0xf5088000)
    libXdmcp.so.6 => /usr/lib/i386-linux-gnu/libXdmcp.so.6 (0xf5081000)
———-

Here I have got many missing dependancies libraries and offcourse broken ones.

You can install broken dependancies using ‘apt-get’ command with ‘-f’ option along with it. ‘-f’ is for correcting a system with broken dependencies.

run
# apt-get -f install

and continue installation.

Now install debian package of skype again.

# dpkg -i skype-ubuntu-precise_4.3.0.37-1_i386.deb
(Reading database … 192226 files and directories currently installed.)
Preparing to replace skype 4.3.0.37-1 (using skype-ubuntu-precise_4.3.0.37-1_i386.deb) …
Unpacking replacement skype …
Setting up skype (4.3.0.37-1) …
Processing triggers for hicolor-icon-theme …
Processing triggers for gnome-menus …
Processing triggers for desktop-file-utils …
Processing triggers for bamfdaemon …
Rebuilding /usr/share/applications/bamf-2.index…
Processing triggers for mime-support …

You are done…. 🙂

/etc/resolv.conf is being overwritten everytime??? | Ubuntu work around

Yes it is true in ubuntu, even if we manually set custom nameservers in /etc/resolv.conf it will overwrite on next reboot or network restart or modem/router restart. It is really annoying once we set google nameservers or opendns or whatever in resolv.conf it goes back to default page on each instance of restart or modem reconnect. The operation of setting attribute to /etc/resolv.conf is not supported here.

===========
root@vaiocyber:~# chattr +i /etc/resolv.conf
chattr: Operation not supported while reading flags on /etc/resolv.conf
===========

The work around to get it permanently fixed is as follows:

Initially my resolv.conf looked like.

===========
root@vaiocyber:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search Home
===========

Open file /etc/network/interfaces and add the line “dns-nameservers NS1-IP NS2-IP” to the bottom, like I wanted to add opendns IPs in my system. For that I did add “dns-nameservers 208.67.222.222 208.67.220.220” to the interfaces file. Now the file looks like in my ubuntu is.

===========
root@vaiocyber:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
dns-nameservers 208.67.222.222 208.67.220.220
===========

Now restart network by “service networking restart” or “ifdown eth0 ; ifup eth0” or Reboot modem or Reboot the ubuntu machine itself. From now onwards the custom nameservers we set will still there be in place until we revert the changes made 😀

After restart, the resolv.conf file will automatically added with custom nameservers we set in interfaces file 🙂

see…

===========
root@vaiocyber:~# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTEN
nameserver 208.67.222.222
nameserver 208.67.220.220
nameserver 127.0.1.1
search Home
===========

Enjoy fast surfing now 🙂

 

(For more detailed information… read “man resolvconf“)

Install Java and Enable it for Web Browsers | Linux

(Steps based on what I did in Ubuntu OS)

As you know Java is essential to be installed and should be enabled to web browsers on local machines from where the system admins access their servers. The need of Java in most cases while we access consoles like KVM switches, IPMI etc to reboot a server which is down or to check what’s happening inside the server when SSH and network is down. In such cases, Java applet programs from the server would access our local machines and needs Java present in our machine inorder to run to work with web browser.

The local machines without Java installed or Webbrowsers not enabled with Java plugins will pop up errors like as follows when you load KVM or IPMI pages:

java_plugin1

 

 

 

 

Following are the steps to install Java and enable it for Mozilla-firefox and Chromium Web Browsers in Ubuntu OS.

SESSION ONE – INSTALL JAVA IN YOUR MACHINE
============================================

1) Go here >> http://java.com/en/download/manual.jsp?locale=en

Download Java source, looks like “jre-7u51-linux-x64.tar.gz”. Note to choose source package based on your machines architecture 32bit or 64bit(Run ‘arch’ or ‘uname -m’ to check it)

2) Once downloaded, move the source package to path /usr/local/java. If folder doesn’t exist create one “mkdir /usr/local/java”

(Make sure you have the power to run all commands using sudo if you are a normal user, else be logged in as root)

#mv /home/john/Downloads/jre-7u51-linux-x64.tar.gz /usr/local/java/

#cd /usr/local/java/

#tar xvf jre-7u51-linux-x64.tar.gz

(You will see it untarred and everything in a folder named ‘jre1.7.0_51’)

#chown root.root /usr/local/java/ -R

3) Now open the file “/etc/profile” and add the following on top

JRE_HOME=/usr/local/java/jre1.7.0_51
PATH=$PATH:$HOME/bin:$JRE_HOME/bin
export JRE_HOME
export PATH

4) Now run the below commands to let OS know the path where Java JRE is located and set.

#update-alternatives –install “/usr/bin/java” “java” “/usr/local/java/jre1.7.0_51/bin/java” 1

#update-alternatives –install “/usr/bin/javaws” “javaws” “/usr/local/java/jre1.7.0_51/bin/javaws” 1

#update-alternatives –set java /usr/local/java/jre1.7.0_51/bin/java

#update-alternatives –set javaws /usr/local/java/jre1.7.0_51/bin/javaws

5) Reload your system wide PATH /etc/profile by typing the following command:

# . /etc/profile

(Sometimes you may need to reboot your ubuntu system to reload the system wide PATH in /etc/profile)

Now Java is installed, check the version by using “java -version”
SESSION TWO – ENABLE JAVA IN YOUR WEB BROWSERS
===================================================

For Chromium
============

# cd /usr/lib/chromium-browser/plugins/
# ln -s /usr/local/java/jre1.7.0_51/lib/amd64/libnpjp2.so
# root@vaiocyber:/usr/lib/chromium-browser/plugins# ll
total 8
drwxr-xr-x 2 root root 4096 Mar 30 12:48 ./
drwxr-xr-x 7 root root 4096 Mar 17 03:14 ../
lrwxrwxrwx 1 root root 49 Mar 30 12:48 libnpjp2.so -> /usr/local/java/jre1.7.0_51/lib/amd64/libnpjp2.so*

Exit and reload Chromium browser now and load the KVM or IPMI page successfully 🙂
For enabling Java plugin permanently, in the address bar type “about:plugins” or “chrome://plugins/” . Choose “Java(TM) – Version: 10.x.x”
from the plugins list and check “Always allowed”.

 

For Mozilla Firefox
================

# cd /usr/lib/mozilla/plugins
# ln -s /usr/local/java/jre1.7.0_51/lib/amd64/libnpjp2.so
root@vaiocyber:/usr/lib/mozilla/plugins# ll
total 372
drwxr-xr-x 2 root root 4096 Mar 30 12:50 ./
drwxr-xr-x 4 root root 4096 Oct 17 00:31 ../
lrwxrwxrwx 1 root root 37 Mar 2 08:06 flashplugin-alternative.so -> /etc/alternatives/mozilla-flashplugin
lrwxrwxrwx 1 root root 49 Mar 30 12:50 libnpjp2.so -> /usr/local/java/jre1.7.0_51/lib/amd64/libnpjp2.so*
-rw-r–r– 1 root root 6088 May 16 2013 librhythmbox-itms-detection-plugin.so
-rw-r–r– 1 root root 100720 May 26 2013 libtotem-cone-plugin.so
-rw-r–r– 1 root root 105440 May 26 2013 libtotem-gmp-plugin.so
-rw-r–r– 1 root root 72048 May 26 2013 libtotem-mully-plugin.so
-rw-r–r– 1 root root 80576 May 26 2013 libtotem-narrowspace-plugin.so

Exit and reload Firefox now and load the KVM or IPMI page successfully 🙂
For enabling Java plugin permanently, click on Tools menu >> Add-ons, select “plugins” tab and set Java plugin “Always Active”.