×


Category: Server Management Service


resolvconf error resolv conf must be a symlink - Fix it Now

This article covers how to fix resolv.conf error which happens when we try to restart the BIND 9 server under Ubuntu Linux.


To fix Resolvconf error "resolvconf: Error: /etc/resolv.conf must be a symlink":

Open a terminal and run the following commands:

$ sudo rm /etc/resolv.conf

$ sudo ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf

$ sudo resolvconf -u


As of Ubuntu 12.04 resolvconf is part of the base system.

You can recreate the needed symlink by running:

$ dpkg-reconfigure resolvconf

or by doing the following in a terminal.

$ sudo ln -nsf ../run/resolvconf/resolv.conf /etc/resolv.conf

Note that as of Ubuntu 12.10 resolvconf no longer aborts if /etc/resolv.conf is not a symlink. It does print a warning message, but this can be silenced by putting the line:

REPORT_ABSENT_SYMLINK=no

in /etc/default/resolvconf.


Segmentation fault in Nagios - Fix it Now

This article covers how to fix the Segmentation fault in Nagios.

A segmentation fault (aka segfault) is a common condition that causes programs to crash; they are often associated with a file named core .

Segfaults are caused by a program trying to read or write an illegal memory location.


What does segmentation fault mean in Linux?

A segmentation fault is when your program attempts to access memory it has either not been assigned by the operating system, or is otherwise not allowed to access. "segmentation" is the concept of each process on your computer having its own distinct virtual address space.


Typical causes of a segmentation fault:

1. Attempting to access a nonexistent memory address (outside process's address space)

2. Attempting to access memory the program does not have rights to (such as kernel 3. structures in process context)

4. Attempting to write read-only memory (such as code segment)


To fix Segmentation Fault (“Core dumped”) in Ubuntu:

1. Remove the lock files present at different locations.

2. Remove repository cache.

3. Update and upgrade your repository cache.

4. Now upgrade your distribution, it will update your packages.

5. Find the broken packages and delete them forcefully.


ERROR: PleskDBException: Unable to connect to database - Fix it now

This article covers methods to resolve error: pleskdbexception: unable to connect to database which triggers as a result of various reasons that include InnoDB engine corruption, disk space full, data directory not completely restored or recovered, and so on. 

The reason of this error is due to disk full and you need to delete extra file from my linux Server.

fslint is a Linux utility to remove unwanted and problematic cruft in files and file names and thus keeps the computer clean. A large volume of unnecessary and unwanted files are called lint. fslint remove such unwanted lint from files and file names.


To Clear RAM Memory Cache, Buffer and Swap Space on Linux:

1. Clear PageCache only. # sync; echo 1 > /proc/sys/vm/drop_caches.

2. Clear dentries and inodes. # sync; echo 2 > /proc/sys/vm/drop_caches.

3. Clear PageCache, dentries and inodes. # sync; echo 3 > /proc/sys/vm/drop_caches.

4. Sync will flush the file system buffer. Command Separated by “;” run sequentially.


To find largest files including directories in Linux is as follows:

1. Open the terminal application.

2. Login as root user using the sudo -i command.

3. Type du -a /dir/ | sort -n -r | head -n 20.

4. du will estimate file space usage.

5. sort will sort out the output of du command.


To uninstall an RPM package:

1. Execute the following command to discover the name of the installed package: rpm -qa | grep Micro_Focus. This returns PackageName , the RPM name of your Micro Focus product which is used to identify the install package.

2. Execute the following command to uninstall the product: rpm -e [ PackageName ]


isc-dhcp-server Job failed to start - Resolve it now

This article covers method to resolve DHCP 'isc-dhcp-server: Job failed to start' error. Basically, 'isc-dhcp-server: Job failed to start' error can happen if there is any issues with the commands that we run.


You can try to restart the service; if it really is an issue with the service starting before the network is up restarting it once the network is up should work:

$ sudo systemctl start restart isc-dhcp-server.service


If that doesn't work then try and investigate further why it's not starting by first getting the current status of the service:

$ sudo systemctl status isc-dhcp-server.service


That should also give you a PID for which you can further investigate with journaltctl where XXXX is the PID of the service:

$ journalctl _PID=XXXXX


Also, what caused/led you to do the following? Perhaps try undoing those changes as I'm not sure if that's helping or hurting. Was the /etc/init/isc-dhcp-server.conf file already there or did you manually create it?

So add a "Sleep 30" to the /etc/init/isc-dhcp-server.conf file. Also add " up service dhcp3-server restart " to my  /etc/network/interfaces file. 


Files and Processes in SELinux on CentOS 7 - More information

This article covers Files and Processes in SELinux. Basically, managing file and process context are at the heart of a successful SELinux implementation.

With SELinux, a process or application will have only the rights it needs to function and NOTHING more. The SELinux policy for the application will determine what types of files it needs access to and what processes it can transition to. 

SELinux policies are written by app developers and shipped with the Linux distribution that supports it. A policy is basically a set of rules that maps processes and users to their rights.


SELinux enforces something we can term as “context inheritance”. What this means is that unless specified by the policy, processes and files are created with the contexts of their parents.

So if we have a process called “proc_a” spawning another process called “proc_b”, the spawned process will run in the same domain as “proc_a” unless specified otherwise by the SELinux policy.


SELinux in Action: Testing a File Context Error

1. First, let's create a directory named www under the root. We will also create a folder called html under www:

mkdir -p /www/html

 

2. If we run the ls -Z command, we will see these directories have been created with the default_t context:

ls -Z /www/

drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 html


3. Next we copy the contents of the /var/www/html directory to /www/html:

cp /var/www/html/index.html /www/html/

 

The copied file will have a context of default_t. That's the context of the parent directory.


We now edit the httpd.conf file to point to this new directory as the web site's root folder. 

i. We will also have to relax the access rights for this directory.

vi /etc/httpd/conf/httpd.conf

ii. First we comment out the existing location for document root and add a new DocumentRoot directive to /www/html:

# DocumentRoot "/var/www/html"

DocumentRoot "/www/html"

iii. We also comment out the access rights section for the existing document root and add a new section:

#<Directory "/var/www">

#    AllowOverride None

    # Allow open access:

#    Require all granted

#</Directory>


<Directory "/www">

    AllowOverride None

    # Allow open access:

    Require all granted

</Directory>


We leave the location of the cgi-bin directory as it is. We are not getting into detailed Apache configuration here; we just want our site to work for SELinux purposes.


iv. Finally, restart the httpd daemon:

service httpd restart

 

Once the server has been restarted, accessing the web page will give us the same “403 Forbidden” error (or default “Testing 123” page) we saw before.

The error is happening because the index.html file's context changed during the copy operation. It needs to be changed back to its original context (httpd_sys_content_t).


restorecond Will not restore a file with more than one hard link - How to resolve this issue

This article covers Tips to fix 'restorecond: Will not restore a file with more than one hard link' error.

To fix this problem type the following commands:

# rm /etc/sysconfig/networking/profiles/default/resolv.conf

# restorecon /etc/resolv.conf

# ln /etc/resolv.conf /etc/sysconfig/networking/profiles/default/resolv.conf