Execute o script (no momento da inicialização do sistema) antes de montar os discos do fstab

1

Estou trabalhando no projeto para implementar o driver de dispositivo em camadas de bloco, assim meu módulo de kernel e o utilitário de controle ( este utilitário requer rede up & running ) devem ser executados antes do sistema de verificação de sistema no dispositivo de destino (no meu caso é / dev / sdb) e tentando montá-lo. Para implementá-lo eu escrevi um script /etc/init.d/dudriver :

#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
    set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi

### BEGIN INIT INFO
# Provides:          dudriver
# Required-Start:    $network udev mountdevsubfs
# Required-Stop:     
# Should-Start:      udev
# Should-Stop:       udev
# X-Start-Before:    checkfs mountall
# X-Stop-After:      
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: 
# Description:
### END INIT INFO



SCRIPTNAME=/etc/init.d/dudriver
. /lib/lsb/init-functions


#
# Check  a presence of the main startup script
#

#if [ -x /opt/dudriver_startup.sh ]
#then
#   /opt/dudriver_startup.sh >>/var/log/dudriver_startup.log
#fi

set -e

[ -x /opt/dudriver_startup.sh ] || exit 0


do_start()
{
    /opt/dudriver_startup.sh
}


do_stop()
{
    exit 0
}

case "$1" in
    start)
            log_begin_msg "Starting UP DUDRIVER ..."
            do_start
        stv=$?
        exit 0
            ;;
    stop)
            log_begin_msg "Shutting down DUDRIVER ..."
            do_stop
        stv=$?
        exit 0
            ;;
    restart|force-reload)
        exit 0
            ;;
    *)
            echo "Usage: $SCRIPTNAME {start|stop}" >&2
            exit 3
        ;;
esac

Então, quando o sistema é inicializado, vejo:

-- The start-up result is done.
янв 26 13:07:50 sysman mount[658]: mount: wrong fs type, bad option, bad superblock on /dev/sdb2,
янв 26 13:07:50 sysman mount[658]:        missing codepage or helper program, or other error
янв 26 13:07:50 sysman mount[658]:        In some cases useful info is found in syslog - try
янв 26 13:07:50 sysman mount[658]:        dmesg | tail or so.
янв 26 13:07:50 sysman kernel: EXT4-fs (sdb2): VFS: Can't find ext4 filesystem
янв 26 13:07:50 sysman systemd[1]: mnt-luks.mount: Mount process exited, code=exited status=32
янв 26 13:07:50 sysman systemd[1]: Failed to mount /mnt/luks.
-- Subject: Unit mnt-luks.mount has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit mnt-luks.mount has failed.
-- 
-- The result is failed.
янв 26 13:07:50 sysman systemd[1]: mnt-luks.mount: Unit entered failed state.

O / etc / fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=c9e11c4a-36cb-4a53-bea5-cd430429ca1e /               ext4    errors=remount-ro 0       1

# swap was on /dev/sda5 during installation
#UUID=614198e5-236e-41fc-baa1-31b9f2230c02 none            swap    sw              0       0

/dev/sdb2 /mnt/luks ext4 defaults 0 0 

Então, a questão é:

  1. onde estou errado em dependências?
  2. o que preciso alterar no script dudriver?
por Ruslan R. Laishev 26.01.2018 / 11:32

0 respostas

Tags