Author Archives: LinuxTech

lvremove to remove logical volume from LVG

How to create spare Logical volume partition in linux server

We had a default install of

 

Screenshot from 2015-06-25 22:06:22

[root@SRV-01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_srv01-lv_root
50G 2.6G 45G 6% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 477M 67M 385M 15% /boot
/dev/mapper/vg_srv01-lv_home
860G 72M 816G 1% /home

As KVM virtualization need spare LVM to create vps on we had to free /home partition which has no data in it

So the process starts

#Using vgdisplay check the VG present

[root@SRV-01 ~]# vgdisplay
— Volume group —
VG Name vg_srv01
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 931.02 GiB
PE Size 4.00 MiB
Total PE 238341
Alloc PE / Size 238341 / 931.02 GiB
Free PE / Size 0 / 0
VG UUID tBHSEL-UIHM-OMbu-9KWk-ZTW9-97j5-UzwQDl
#lvscan to check the LVM name

[root@SRV-01 ~]# lvscan
ACTIVE ‘/dev/vg_srv01/lv_root’ [50.00 GiB] inherit
ACTIVE ‘/dev/vg_srv01/lv_home’ [873.17 GiB] inherit
ACTIVE ‘/dev/vg_srv01/lv_swap’ [7.85 GiB] inherit

Before removing the Logical volume partition need to unmount it  else you get below error

[root@SRV-01 ~]# lvremove /dev/vg_srv01/lv_home
Logical volume vg_srv01/lv_home contains a filesystem in use.

 

So unmounted /home which has  /dev/vg_srv01/lv_home

[root@SRV-01 ~]# umount /home/

 

Now removed the logical volume using lvremove

[root@SRV-01 ~]# lvremove /dev/vg_srv01/lv_home
Do you really want to remove active logical volume lv_home? [y/n]: y
Logical volume “lv_home” successfully removed

Now /home  alias  /dev/vg_srv01/lv_home is free to create  VM on it

[root@SRV-01 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_srv01-lv_root
50G 2.6G 45G 6% /
tmpfs 7.8G 0 7.8G 0% /dev/shm
/dev/sda1 477M 67M 385M 15% /boot

Error from MySQL query: DBD::mysql::db do failed: Can’t find any matching row in the user table

Have you been getting below error

“Error from MySQL query: DBD::mysql::db do failed: Can’t find any matching row in the user table”

To fix this issue follow below method,

Please remove the following entry from /etc/my.cnf and then restart MySQL:

skip-name-resolve
Screenshot - Monday 22 June 2015 - 12:20:11  IST
The restart mysql using /scripts/restartsrv_mysql
This fixes the issue

upcp cpanel error

While running a upcp –force in cPanel server got below error
[2015-06-20 13:48:48 -0400] see http://go.cpanel.net/rpmcheckfailed for more information
[2015-06-20 13:48:48 -0400] The Administrator will be notified to review this output when this script completes
=> Log closed Sat Jun 20 13:48:48 2015
[2015-06-20 13:49:13 -0400] 17% complete
[2015-06-20 13:49:13 -0400] E Running `/usr/local/cpanel/scripts/updatenow –upcp –log=/var/cpanel/updatelogs/update.1434820770.log` failed, exited with code 1 (signal = 0)
=> Log closed Sat Jun 20 13:49:24 2015

Screenshot - Saturday 20 June 2015 - 11:42:31  IST

The issue is due to duplicate rpm in server

cPanel has a auto script to fix this issue

You need to use command /scripts/autorepair fix_duplicate_cpanel_rpms to remove duplicate rpm in server

root@server1 [/usr/local/apache]# /scripts/autorepair fix_duplicate_cpanel_rpms

This fixed the issue for me and now upcp is working fine.

 

kernel panic not syncing attempt to kill init

error

Creating a New Initial RAM Disk

If you have changed a motherboard or moved a disk to a different system it may fail to boot due to the lack of appropriate drivers in the initial RAM disk image (initramfs for CentOS 6, initrd for CentOS 5).

Boot in Rescue Mode
1.Boot from a CentOS installation disc (for example, CD #1 or DVD).

2.Type “linux rescue” at the “boot:” prompt.

3.Mount all filesystems in read-write mode.

Create the New Initramfs or Initrd

Change root to real root (‘/’) on your hard disk and make the new initramfs or initrd.
mount –bind /proc /mnt/sysimage/proc
mount –bind /dev /mnt/sysimage/dev
mount –bind /sys /mnt/sysimage/sys
chroot /mnt/sysimage
For CentOS 6:

Create a backup copy of the current initramfs:
cp -p /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

Now create the initramfs for the current kernel:
dracut -f

If you need to build it for a specific kernel version (replace the version appropriately):
dracut -f /boot/initramfs-2.6.32-358.el6.x86_64.img 2.6.32-358.el6.x86_64

One useful option you might want to add is -H (–hostonly). With this option dracut installs only what is needed for booting your system. Otherwise dracut by default adds many drivers to the initramfs making its size larger than necessary. Many other options may be exercised. Please see man dracut, man dracut.conf and the upstream Deployment Guide.
For CentOS 5:

Create a backup copy of the current initrd:
cp -p /boot/initrd-$(uname -r).img /boot/initrd-$(uname -r).img.bak

Now create the initrd for the current kernel:
mkinitrd -f -v /boot/initrd-$(uname -r).img $(uname -r)

If you need to build it for a specific kernel version (replace the version appropriately):
mkinitrd -f -v /boot/initrd-2.6.18-371.el5.img 2.6.18-371.el5

If you are migrating a physical machine to a virtual one using the Xen hypervisor, replace the last command above with:
mkinitrd –with-xenblk initrd-2.6.18-371.el5xen.img 2.6.18-371.el5xen

Many other options may be exercised, such as adding non-loaded modules manually. See man mkinitrd for details. It may be necessary to modify /boot/grub/grub.conf and/or /etc/fstab depending on the details of your installation. This depends on your use of LABEL and/or UUID versus physical devices in the files, and is too complex an issue to get into in any detail in a TipsAndTricks article.
Reboot
cd /
sync
telinit 6

 

source http://wiki.centos.org/TipsAndTricks/CreateNewInitrd

 

SVNManager error in Softaculous

SVNManager in Softaculous give erros while installing

Came across this in a support request

The following errors were found :

– The SVN config directory does not exist.

– The SVN password file does not exist.

– The SVN access file does not exist.The solution is before installing svnmanager run:

su – username

svnadmin create ~/repos

As the user you want to install it as. Then rerun the installer. Make sure the repo path is /path/to/user/repos

This fixed the issue

VM creation has failed. Reason: No ploop support in the kernel, or kernel is way too old. Make sure you have OpenVZ kernel 042stab058.7 or later running, and kernel ploop modules loaded.

VM creation has failed. Reason: No ploop support in the kernel, or kernel is way too old. Make sure you have OpenVZ kernel 042stab058.7 or later running, and kernel ploop modules loaded. Creation of container private area failed

SOlusi :

cek file berikut :

It seems you are using EL5 kernel. Edit /etc/vz/vz.conf
change:
VE_LAYOUT=ploop
to:
VE_LAYOUT=simfs

– reboot server

email trace in cpanel shows invalid date

We tried to repair the smtp table in the eximstats database and it showed the following result.

myisamchk: error: ‘/var/lib/mysql/eximstats/smtp.MYI’ is not a MyISAM-table

Fix:

ls -al  /usr/local/cpanel/etc/eximstats_db.sql

mysqladmin drop eximstats

mysqladmin create eximstats

mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

make: *** [ffmpeg_frame.lo] Error 1 ffmpeg

This error occurs due to a missing file ‘ffmpeg_frame.lo‘ in the ffmpeg-php source, while your ffmpeg-php source may contain the file named ‘ffmpeg_frame.loT‘. –

To Resolve this issue you just need to rename the ‘ffmpeg_frame.loT‘ to ‘ffmpeg_frame.lo‘ and make again

Setup Smartd monitoring on Linux

Want to get an alert when hard drive in server is going bad
A tool called SMARTD is available in lInux which is free
You need to use below steps to  install and configure it
#yum install smartmontools
#service smartd start
   
#chkconfig smartd on
   
#smartctl -a /dev/sda
Now Open smartd config file and add the entry as mentioned
vi /etc/smartd.conf

DEVICESCAN -a -o on -S on -n standby,q -s (S/../.././02|L/../../6/03) -W 4,35,40 -m  emaild

Now you should get an alert for any error if any from SMARTD

Invalid date in Email Trace cpanel

When checking the email trace option in cpanel, it reported an invalid date error. We got the following log from our cpanel error log file about what is causing the issue. What do I do when cpanel email trace not working, how can I fix it look no further we have the problem solved for you.

Once you have logged in as ROOT you can now copy and paste this line in

mysql eximstats < /usr/local/cpanel/etc/eximstats_db.sql

now close out putty and the the email trace feature will be up and running.