The Problem Command ‘df’ shows statistics but ‘ls -ld’ fails below: # df … /dev/mapper/vgapp-appsvol 419221508 15095588 404125920 4% /lapps/app # ls -l /lapps/apps ls: cannot access /lapps/app: Input/output error The Solution Disk failure cases input/output operation stopped, so filesystem is re-mounted as read-only. This is an expected behavior of the kernel to mount a […]
CentOS/RHEL 5
How to Create Yum Repository For System Packages Installation in CentOS/RHEL
A yum repository holds the rpms and metadata about the rpms. A yum repository must be configured in order to use yum on any yum based Linux system. This post provides steps to configure a yum repository for installing packages on CentOS/RHEL systems. Configuring yum repository server 1. Create a directory for you local repository, […]
How to Customize Linux Password Expiration and Complexity Requirements
1. Password Expiration To set the default password expiration when creating new accounts on CentOS/RHEL, edit the /etc/login.defs file. PASS_MAX_DAYS 100 Which means the maximum number of days a password may be used. Please check man page of login.defs for more options that can be set in /etc/login.defs.: $ man login.defs 2. Password Complexity The […]
How To Masquerade Sender Address In Sendmail in CentOS/RHEL
You would like to configure your sendmail server to masquerade the sender address to no-reply@target-domain.net when sending emails from it. The Solution Normally to masquerade a domain, the “MASQUERADE_AS” and “MASQUERADE_DOMAIN” is used in /etc/mail/sendmail.mc. But that will leave the user unchanged. With sendmail, you can change both the domain and username on a case-by-case […]
BTRFS: too many missing devices, writeable mount is not allowed
The Problem Assembling a BTRFS device during boot fails with error BTRFS: too many missing devices, writeable mount is not allowed The disks have been mistakenly deleted The Solution The missing disks in the raid array do not allow the filesystem to be mounted. Below are the logs from dmesg: [ 44.706956] btrfs: disk space […]
How to Create a Custom Log File Rotation by logrotate in Linux
In this example case /var/log/secure.log will be rotated daily and if the log file size exceeds 100mb rotate process will start. 1. By default system rotates all major OS logs by checking syslog file located in /etc/logrotate.d/ # cat /etc/logrotate.d/syslog /var/log/cron /var/log/maillog /var/log/messages /var/log/secure /var/log/spooler { sharedscripts postrotate /bin/kill -HUP ‘cat /var/run/syslogd.pid 2> /dev/null’ 2> […]
Volume “test_vg/lvol0” is not active locally – Error while running lvcreate
The Problem While trying to create a logical volume, lvcreate fails with error “Volume “test_vg/lvol0″ Is Not Active Locally” even though the volume group is active, with an error output such as the following: # lvcreate -L 4G test_vg Volume “test_vg/lvol0” is not active locally. Aborting. Failed to wipe start of new LV. The Root […]
Command ntpstat Shows unsynchronised (CentOS/RHEL)
The ntpstat command output shows “unsynchronised”: # ntpstat unsynchronised time server re-starting The “ntpq -p ” command output shows none of ntp servers is chosen: # ntpq -p ========================================== remote refid st t when poll reach delay offset jitter =============================================== ntp-server .INIT. 16 u – 16 0 0.000 0.000 0.000 ntp-server .INIT. 16 u – […]
How to Check Swap Usage Live via the ‘top’ Command in Linux
Question: How to view the system-wide swap usage on a CentOS/RHEL server via the top command to identify the highest consumers. Below are the steps for CentOS/RHEL 5 and 6 which are the same, followed by CentOS/RHEL 7 as they differ on this release: NOTE: Performing this task will not cause any changes to top […]
Unable To Boot Up Linux OS with Auditd (CentOS/RHEL)
The Problem A Linux OS failed bootup, from console log we can see all goes well in the very beginning, kernel loaded and init scripts were running OK. But suddenly the Linux OS was shutting down (received TERM signal) after auditd daemon started. … dracut: Switching root mount: mount point /proc/bus/usb does not exist Welcome […]