Wednesday, 25 May 2016

Yum Database Errors on Linux

Yum is a well known application, Linux users use this utility to install different applications on their system. YUM is a very stable application and it hardly brakes or gives any errors unless you mess around with its configuration files. You just need to follow standard command to operate Yum and you should be fine. YUM uses RPMs on the backend to complete the installation process. Yum is widely used on all RHEL based operating systems like CentOS, Fedora etc. Let's try to understand Yum's working on Linux systems. Yum has a set of configuration files which contain information about its repositories. Yum repositories are actually the links to the different online sources which are hosting installer files (RPMs) for many applications. Once we request Yum to install anything for us. It goes through all the URLs in its configuration files and finds out the correct links to download and install our specified program or application.

Once user confirms that Yum's selected package is correct, it downloads it to the local system and then installs it. Yum uses a database on the backend to organize and perform such operations. If due to any reason, Yum's running process is killed or interrupted, slight chances are that it will run into following error:

==
rror: rpmdb: BDB0113 Thread/process 2597/140075287652160 failed: BDB1507 Thread died in Berkeley DB library error: db5 error(-30973) \from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery error: cannot open Packages index using db5 - (-30973) error: cannot open Packages database in /var/lib/rpm CRITICAL:yum.main:

==



In order to resolve this error, we need to rebuild the RPM database for Yum. Run following command on CentOS Linux operating system to fix this error.

rpm --rebuilddb

After that you can run following command on your Linux system to bring Yum up to date.

yum update











Monday, 23 May 2016

HostnamectlOnCentOS 7 Linux


Hostnamectl is a new utility which has been added to CentOS 7 Linux systems. It gives you more control over the way we set or play with Linux system's hostname. It is important to understand that proper or Full qualified hostnames of a Linux system is vital for the proper communication of data. In earlier days, we used to edit files manually to set the hostname of Linux systems. Linux operating system has been an ever evolving operating system. Keeping in mind the needs of user, hostnamectl utility has been added to the operating system so you may set, change, and configurehostnames of your Linux systems easily and properly. Linux operating system is currently having this utility available in CentOS and RHEL 7 only. Other operating system might introduce it soon.


Type "hostnamectl" on the command line and it should show the current details of the system like its hostname, operating system version, and some of the hardware specifications.


                


In order to set a new hostname for your CentOSmachine, run following command.

hostnamectl set-hostname New-Name

Similarly, it also lets you configure both static and pretty hostnames of your Linux operating system. In order to set static hostname, command should be:

hostnamectl set-hostname New-Name --static

In order to set pretty hostnames, command should be as follows.

hostnamectl set-hostname "Linuxpitstop Hostname" --pretty


This utility has really simplified the way we handle hostname related operations on a CentOS Linux system. You don't need to go around editing individual files now, use this utility and you should be good to go. In earlier versions of CentOS operating system, we used to edit /etc/hosts, resolve.conf and network files to setup new hostnames; and any syntax mistakes would lead to unexpected errors/issues. This command is now an easy and safest way to handle such important matter.