Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On startup, I want the /etc/init.d/lvm2 script shipped with Debian squeeze to be executed. I ran update-rc.d lvm2 enable and checked that the symlinks are created in the /etc/rcX.d folders:

# find /etc -name "*lvm2"
/etc/rc6.d/K09lvm2
/etc/rc0.d/K09lvm2
/etc/init.d/lvm2
/etc/rcS.d/S05lvm2

Manually executing the script works and the lvm volumes are properly activated, but after startup nothing happened. There is nothing about lvm in /var/log at all. I tried adding the line logger Starting lvm to the beginning of the start() function in the init script, but again, nothing appears in the logs.

How can I trace the error and find out, why this is not started properly? I would like to avoid putting stuff that ships with the distro in the rc.local.


Let me show you the init script as well. One additional note: Commands before [ -x /sbin/vgchange ] || exit 0 are not executed either, so it cannot be that line causing the script to exit. On a first glance, I also have not seen any dependency loops or something like that among the init scripts.

#!/bin/sh
### BEGIN INIT INFO
# Provides:          lvm2 lvm
# Required-Start:    mountdevsubfs udev
# Required-Stop:
# Should-Start:      mdadm-raid cryptdisks-early multipath-tools-boot
# Should-Stop:       umountroot mdadm-raid
# X-Start-Before:    checkfs mountall
# X-Stop-After:      umountfs
# Default-Start:     S
# Default-Stop:      0 6
### END INIT INFO

SCRIPTNAME=/etc/init.d/lvm2

. /lib/lsb/init-functions

[ -x /sbin/vgchange ] || exit 0

do_start()
{
        logger starting lvm
        modprobe dm-mod 2> /dev/null || :
        /sbin/vgscan --ignorelockingfailure --mknodes || :
        /sbin/vgchange -aly --ignorelockingfailure || return 2
}

do_stop()
{
        /sbin/vgchange -aln --ignorelockingfailure || return 2
}

case "$1" in
  start)
        log_begin_msg "Setting up LVM Volume Groups"
        do_start
        case "$?" in
                0|1) log_end_msg 0 ;;
                2) log_end_msg 1 ;;
        esac
        ;;
  stop)
        log_begin_msg "Shutting down LVM Volume Groups"
        do_stop
        case "$?" in
                0|1) log_end_msg 0 ;;
                2) log_end_msg 1 ;;
        esac
        ;;
  restart|force-reload)
        ;;
  *)
        echo "Usage: $SCRIPTNAME {start|stop}" >&2
        exit 3
        ;;
esac
share|improve this question
    
This may be a stupid question, but you're sure the permissions are right on your script and it's marked executable? Simple thing to overlook, but may be the case... What's ls -l show? –  nerdwaller Mar 26 '13 at 17:45
1  
I did check it, they are -rwxr-xr-x –  janoliver Mar 26 '13 at 17:47
1  
It may be because the default runlevel for LMV2 is 'S' I've clarified that in bug #711147 –  d-_-b Jun 12 '13 at 4:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.