Sunday, 24 September 2017

Solved : Unable to lock the administration directory (/var/lib/dpkg/)

Sometimes when you boot into your Linux Ubuntu system and use Terminal to install any application, you will get an error saying :

E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)

E: Unable to lock the administration directory (/var/lib/dpkg/) is another process using it? 

This error usually means either the Software Center or the Update Manager has acquired a lock to the apt database and some process is currently running in background. Ubuntu automatically checks for any update once you boot up your system and if any update is available, the download process begins causing the above error, if at that particular instance you try using apt-get.

There are various ways to get rid of the error, most recommended of which is to allow the process to complete. Once the background task is completed, the apt resource is free and you can run it in terminal.

What if even after waiting for long, you are still seeing the error? In that case, follow the below method.

Search the process first which has acquired the lock to apt.

ps -A | grep apt-get

You will get the process id, kill that process with the below command:

sudo kill -9 <process_Id>

This will free up the apt-lock.

However, its not recommended to kill a process forcefully. 

The best way is to wait for the resource to free. You can use the below command to keep your system updated in order to avoid Unable to lock the administration directory very frequently. 

sudo apt-get update

What do you do when you see this error while using apt-get, tell us in the comments.

Wednesday, 31 May 2017

How to install Guest Additions on Ubuntu in VirtualBox

Installing guest addition in VirtualBox Ubuntu will provide you some additional features like switching between guest and host OS, automatic resizing of windows when you resize the VirtualBox window and enabling copy-paste between the host and guest Operating System. VirtualBox Guest Additions consists of various device drivers and system applications which optimize the operating system use in a virtual environment. I always recommend installing guest addition in the beginning itself if you are installing Ubuntu in VirtualBox.  

Guest Additions features 

Mouse point integration : It provides a seamless mouse support. There is only one mouse pointer on your screen and it works as per the window you are hovering in. You do not need to press Host key for the guest OS to capture Mouse Pointer. 

Shared Folders sharing : It helps in sharing files and folders between the guest and host operating system. VirtualBox can be set up to treat a folder as a shared folder and the guest OS can access it. 

Better Video Support : Guest Additions includes some custom video drivers to provide non-standard video modes and an accelerated video performance. The screen can be resized when you resize the VirtualBox.

Seamless Windows : The individual windows that are within the virtual machine can be mapped to host's desktop as if it was running on the host. 

Time sync : The virtual machine clock will remain in sync to the host OS.

Copy/Paste between Guest and Host OS : Installing Guest Additions allows to share the clipboard between the guest and host OS, means you can copy paste interchangeably between the virtual box and the main OS you are running. Sometimes, this is needed when you want to copy a URL from the main OS to the virtual box. 

Installing Guest Additions 

Method 1:

To install guest addition in Ubuntu, open VirtualBox and start the Ubuntu Machine. Under the Device Menu, select Install Guest Additions. This will mount the Guest Additions ISO and installs the guest additions in your Ubuntu. 

Method 2:

If you want to install Guest Addition in Ubuntu through Terminal, open it and type in the following command to install it. 

sudo apt-get install virtualbox-guest-utils

This will install Guest Additions for your VirtualBox Ubuntu. If you are facing the issue : Could not insert Virtual Box guest addition disk image, check here.

Let me know in the comments if you face any issue while installing Guest Additions. 

Sunday, 28 May 2017

Fix : Ubuntu software center not working

I had installed a fresh copy of Ubuntu 17.04 and opened the Ubuntu Software Center to install an application. The Ubuntu Software Center was not working and it kept on loading things forever. It seems like the Ubuntu Software needs to update a large database upon the start and the update never finishes. If you are facing the same problem of Ubuntu Software Center not working, you can follow any of the below two methods to fix it. 

These are the screenshots of Ubuntu Software not working. In the first screen I tried searching for VLC and it kept on loading. Second screenshot is the default screen but in the Editor's pick, no software is seen. When I tried opening a Category, the same thing happened. 

Ubuntu Software Center issue

Ubuntu Software Center issue

Now, let us see how we can fix this error. 

Fixing Ubuntu Software Center 

Open terminal and type the below commands :

killall gnome-software

This will kill all the processes that are running for gnome software center. Now remove the file gnome-software file from the location ~/.local/share/gnome-software.

rm -rf ~/.local/share/gnome-software

You can also move it to some other location or rename it if you don't believe in deleting things.Now, open Ubuntu Software from the launcher and it will work fine.

Another approach is to re-install gnome-software. Open terminal and the below commands will reinstall gnome-software.

sudo apt-get autoremove gnome-software
sudo apt-get install gnome-software

After fixing it, your Software Center should work perfect.

Ubuntu Software Center
Ubuntu Software Center

Let me know in the comments if you still face the issue. 

Thursday, 25 May 2017

How to install LAMP in Ubuntu

LAMP is an open source web development model built on Linux, Apache, MySQL and PHP. Linux operating system is the base where an Apache HTTP web Server is running, MySQL servers the purpose of relational database and PHP is the programming language to develop dynamic web sites and web applications. All the four software are free and open source. Some developers and communities accept Python in place of PHP these days. 

In this article, we will see how you can install LAMP in Ubuntu. I am using Ubuntu 17.04 but these steps will work perfectly fine for 16.10 and 16.04 LTS. 

Installing Linux : I assume you are already running a Linux distribution. If not, there are many articles over with tutorials to install Linux. 

Installing Apache 

Apache is the most popular web server with over 55% market share. Apache Software Foundation is resposible for its development and maintenance and is licensed under Apache License. 

To install apache, open terminal and use the below command:

sudo apt-get install apache2

Once the installation is done, restart the Apache server with the following command: 

sudo /etc/init.d/apache2 restart 

Once the restart is done, you can check the installation by opening a browser and opening the following link : http://localhost. If the links open fine, the installation is successfull and Apache is up and running. 

Installing MySQL 

MySQL servers the purpose of relational database management system. To install MySQL, type the below command in Terminal. 

sudo apt-get install mysql-server

Installing PHP 

PHP is a server side scripting language for web developments and can serve as a general purpose programming language too. To install PHP, below is the command: 

sudo apt-get install php5 libapache2

Once installed, you can check if PHP is working fine by using a command : 

php -r 'echo "PHP is fine";'

Hope this article helps you to install LAMP in Ubuntu successfully. Let me know in the comments if you face any issue while installation. 

Tuesday, 23 May 2017

How to install Atom text editor in Ubuntu

Atom is a cross platform open source text editor for Linux, Windows and OS X. Atom text editor comes with a built-in package manager to search and install new packages, auto-complete features, file system browsing facility, multiple tabs and several other functions. It comes with 4 default themes and third party themes developed by Atom community can be installed if you are not satisfied with them. With a lot of customization features, Atom text editor has gained quite a popularity in the Linux

In this article, we will see how to install Atom text editor in Ubuntu. I am using Ubuntu 17.04 and the steps for other versions would be same. 

Steps to install Atom text editor in Ubuntu

Method 1 : Through the official repo

Ubuntu Software Center comes well equipped with lots of software and Atom is listed there. This should be the default way of installing Atom text editor, ensuring all the dependencies are installed and nothing goes wrong. 

Open Ubuntu Software and search for Atom. Click on install and the package will be downloaded and installed in your Ubuntu system. 

Method 2 : Through Terminal

Most of us loves the Terminal. If you want to install Atom through the command line, open Terminal by pressing Ctrl + Alt + T, or through the dash, and type in the following command : 

sudo snap install atom --classic

This will download the snap package and install it. Snap packages are similar to containers and with a .snap extension, it includes all the required libraries needed for the application. Once downloaded and installed, you can start by searching from Dash. If you are installing a snap package for the very first time, you will need to restart your system before you can search it. I wasted some minute figuring out why it's not showing in the search box [sigh].

In case you are already running an Atom Text Editor, and there is a new update; you can update it by typing the following command :

sudo snap refresh atom 

In case you want to remove Atom text editor at some point of time, this command will help you. 

sudo snap remove atom 

Hope these steps help you in installing Atom text editor in your Ubuntu system. Let me know in the comments if you face any issue. 

Monday, 22 May 2017

How to install GNOME Desktop in Ubuntu

If you don't like the default Unity Desktop environment or looking for an alternate option, GNOME is the best choice for you. GNOME 3 is an easy and elegant open source desktop environment whose development is largely contributed by Red Hats and Volunteers. It has a separate area called Overview which makes switching between different tasks and virtual workspaces easier. Moreover, Canonical is replacing Unity DE with GNOME desktop environment from Ubuntu 18.04 release. You can install GNOME desktop in Ubuntu and get familiar with it. 

In this article, we will see how to install GNOME desktop environment in Ubuntu. I am using Ubuntu 17.04 but the process will be same for any other version. 

Install GNOME in Ubuntu 

Open Terminal from the Launch bar or through pressing Ctrl + Alt + T and type the following command :

sudo apt install gnome-shell

This will prompt you for root password and notifies you for a download of around 49 MB archives. Type Y to continue and wait for the archive to download and install. 

Once done, log out from your session and on the Login screen, you will find the option of GNOME. 

Select GNOME, enter username and password to login to GNOME desktop environment. Clicking on Activities on the top-left corner gives the launch bar , Overview and a search box to search for the applications you have installed. A click in the center shows you all the Notifications and a calendar. You can pin any application to the launch bar with a drag and drop. 

With the above one-line terminal command, you have successfully installed GNOME desktop in Ubuntu. Open Source has so many choices when it comes to practically everything. If you don't like one desktop, you can switch to one of your choice any day with just one line of code. If you still face any issue, let me know in the comment. 

Wednesday, 17 May 2017

How to install LibreOffice in Ubuntu

LibreOffice is an open source and free Office suite with a clean interface and various applications. It is an open source equivalent to MS Office and comes with powerful office suit. LibreOffice comes with Writer for word processing, Calc for spreadsheets asks, Impress for presentations, Draw as a vector graphics and flowcharts application, Base for Database and Math for Formula Editing.

Ubuntu ships with LibreOffice by default and chances are that you already having it. So, this article is for those who have either removed it, or there is another update and they want to remove the old version and install the new one. Lets see how we can install LibreOffice in Ubuntu.

System Requirements

To install LibreOffice in Ubuntu, these are the prerequisite :

  • Linux kernel version 2.6.18 or higher 
  • glibc2 version 2.5 or higher
  • gtk version 2.10.4 or higher
  • Pentium III or higher
  • 256MB RAM (512 MB recommended)
  • 1.55GB of hard disk space 
  • X server with 1024x768 resolution
  • Gnome 2.16 or higher

If you are running an older version, you can uninstall it before installing the latest version. Here's how you can uninstall LibreOffice older version.

Open Terminal and type the following command.

sudo apt-get remove libreoffice-core

This will ask for your confirmation. Press Y and it will remove LibreOffice.

Installing LibreOffice in Ubuntu

Method 1: Using software repository. 

This is the easiest way to install LibreOffice in Ubuntu. Open Ubuntu Software and search for LibreOffice. Click on the LibreOffice package and click on Install in the next screen. It will take some time to download and install.

Method 2: Using Command Line

Most people prefer using the Terminal for everything. So, to install LibreOffice using Terminal, open one and type in the following command:

sudo apt-get install install libreoffice

This will download the installation files and install it in your system.

Method 3: Using .deb package

Download the .deb LibreOffice package from the official website.

Once done, put it in a folder you want.

It will be .tar.gz file. Open terminal, and navigate to the path where you have the archive downloaded. Type in the following command to unpack the package file.

tar zxvf LibreOffice_5.3.2_Linux_x86-64_deb.tar.gz

I am installing version 5.3.2 which you can read in the file name. This may vary for you if you download something which is more latest than this.

Next step is to install the .deb package. Navigate to DEB directory under extracted directory.

cd ~/LibreOffice_5.3.2_Linux_x86-64_deb/DEBS

Run the below command to install the .deb package.

sudo dpkg -i *.deb

It will ask for your root password and the installation will finish.

Using any of the method listed above, you can install LibreOffice in Ubuntu. However, if you are new user you should prefer installing it from the Ubuntu Software Center. Let me know in the comments if you face any issue while installing LibreOffice in Ubuntu.