Kernel

Stuff on Linux Kernel...

vzdump LVM snapshots kernel errors

On running daily lvm snapshot backups via vzdump on OpenVZ servers, I noticed the below Kernel errors in logwatch reports.


WARNING:  Kernel Errors Present
    Buffer I/O error on device dm-4,  ...:  22 Time(s)
    EXT3-fs error (device dm-4): e ...:  60 Time(s)
    lost page write due to I/O error on dm-4 ...:  22 Time(s)

This would show up on busy servers only, probably caused due to lvm snapshot running out of space.

I edited "/usr/bin/vzdump" and increased the size from 500m to 1000m which seems to have resolved the issue for now.


run_command (\*LOG, "$lvcreate --size 1000m --snapshot --name vzsnap /dev/$lvmvg/$lvmlv");

set_loginuid failed opening loginuid

If this file doesn't exist:

/proc/<pid of crond>/loginuid

It's because the kernel doesn't have AUDIT enabled. So you get a bunch of errors in "/var/log/secure" with "set_loginuid failed opening loginuid".

Recompile kernel with audit support:

CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y

If recompiling of kernel is not an option then:

Comment the below lines from all pam.d files.

session required   &nbsp;    pam_loginuid.so

Find files via:

# grep -l pam_loginuid.so /etc/pam.d/*
/etc/pam.d/atd
/etc/pam.d/crond
/etc/pam.d/login
/etc/pam.d/remote
/etc/pam.d/sshd

Automatically reboot server after a kernel panic

Add panic=10 to the kernel command line to reboot with 10 seconds of a kernel error. Be careful with this when setting up new kernels.

It’s possible to change it later with sysctl, or by writing to /proc:

# echo 10 > /proc/sys/kernel/panic

To make it permanent, edit /etc/sysctl.conf and add the below line:

kernel.panic = 10

`sysctl -p` to load the conf file and make permanent.

Kernel compile from source

1) cd /usr/src
2) unlink linux
3) rm -rfv linux-oldversion
4) wget http://kernel.org/pub/linux/kernel/v2.6/li...version.tar.bz2 (see www.kernel.org)
5) tar -jxvf linux-newversion.tar.bz2
6) ln -s linux-newversion linux
7) cd linux
8) make mrproper
9) make oldconfig (you may have to select new options available that wasn't on the old kernel. Generally, you're safe to just keep presseing enter for it to select the default for those new options.)
10) make menuconfig (ONLY if you want to edit kernel configuration)
11) make (go make some coffee)
12) make modules_install

Anatomy of Linux Kernel

Immensely useful article for learning about Linux kernel at IBM DeveloperWorks.

`yum update kernel` without removing old kernels

Edit "/etc/yum/pluginconf.d/installonlyn.conf" and change the enabled to "0" or increase the "tokeep" value to the number of versions you want to keep.

[main]
enabled=1
# this sets the number of package versions which are kept
tokeep=2

Mount and read from NTFS partitions on Linux -- Fedora Core 5

  1. Download the specific kernel module rpm from linux-ntfs.org .
  2. You can check the currently installed kernel version using `uname -rm` .
  3. Install via:
    # rpm -ivh kernel-module-ntfs-*.rpm
    
  4. Check the partitions to be mounted:
    # fdisk -l | grep NTFS
    

    Note: If using a dual boot, then windows is normally installed in the first partition, "/dev/hda1".

  5. The listed NTFS partition can be mountable after a restart via:
    # mount -r -o umask=0222 -t ntfs /dev/hda1 /mnt/ntfs
    
  6. For automated mounts during startup, add the below line in "/etc/fstab" .
    /dev/hda1   /mnt/ntfs     ntfs    ro,defaults,umask=0222 0 0
    
Comment