AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / unix / Perguntas / 737044
Accepted
Gooberpatrol66
Gooberpatrol66
Asked: 2023-02-27 09:02:11 +0800 CST2023-02-27 09:02:11 +0800 CST 2023-02-27 09:02:11 +0800 CST

Por que essa regra do udev causa o congelamento do cryptsetup?

  • 772

Eu tenho esta regra que executa um script para me enviar um e-mail sempre que uma unidade sai do sistema:

SUBSYSTEM=="block", ACTION=="remove", ENV{DEVTYPE}=="disk",\
    RUN="/usr/sbin/disk-monitor.sh $env{DEVNAME}"

Este é o roteiro:

#!/bin/bash

echo "Dropout detected $(date)" | mail -s "WARNING: Drive $1 has dropped out!" logger@gentooserver

Isso faz com que certos comandos cryptsetup congelem, como "cryptsetup close" e "integritysetup format". Por que isso acontece?

cryptsetup --debug close offline1
# cryptsetup 2.4.3 processing "cryptsetup --debug close offline1"
# Running command close.
# Locking memory.
# Installing SIGINT/SIGTERM handler.
# Unblocking interruption on signal.
# Allocating crypt device context by device offline1.
# Initialising device-mapper backend library.
# dm version   [ opencount flush ]   [16384] (*1)
# dm versions   [ opencount flush ]   [16384] (*1)
# Detected dm-ioctl version 4.47.0.
# Detected dm-crypt version 1.24.0.
# Detected dm-integrity version 1.10.0.
# Device-mapper backend running with UDEV support enabled.
# dm status offline1  [ opencount noflush ]   [16384] (*1)
# Releasing device-mapper backend.
# Trying to open and read device /dev/sdk1 with direct-io.
# Allocating context for crypt device /dev/sdk1.
# Trying to open and read device /dev/sdk1 with direct-io.
# Initialising device-mapper backend library.
# dm versions   [ opencount flush ]   [16384] (*1)
# dm table offline1  [ opencount flush securedata ]   [16384] (*1)
# Trying to open and read device /dev/sdk1 with direct-io.
# dm versions   [ opencount flush ]   [16384] (*1)
# dm deps offline1  [ opencount flush ]   [16384] (*1)
# Crypto backend (OpenSSL 1.1.1t  7 Feb 2023) initialized in cryptsetup library version 2.4.3.
# Detected kernel Linux 6.1.12-gentoo-x86_64 x86_64.
# Reloading LUKS2 header (repair disabled).
# Acquiring read lock for device /dev/sdk1.
# Opening lock resource file /run/cryptsetup/L_8:161
# Verifying lock handle for /dev/sdk1.
# Device /dev/sdk1 READ lock taken.
# Trying to read primary LUKS2 header at offset 0x0.
# Opening locked device /dev/sdk1
# Verifying locked device handle (bdev)
# LUKS2 header version 2 of size 16384 bytes, checksum sha256.
# Checksum:a4bc53825c88a45b53709738107a718a9c4f896dfef90951cfd9d9cfe68dd259 (on-disk)
# Checksum:a4bc53825c88a45b53709738107a718a9c4f896dfef90951cfd9d9cfe68dd259 (in-memory)
# Trying to read secondary LUKS2 header at offset 0x4000.
# Reusing open ro fd on device /dev/sdk1
# LUKS2 header version 2 of size 16384 bytes, checksum sha256.
# Checksum:ca42f7c96748267f126f3ab48536dee1a05525aa1db10a1feb85a5a60e3338e8 (on-disk)
# Checksum:ca42f7c96748267f126f3ab48536dee1a05525aa1db10a1feb85a5a60e3338e8 (in-memory)
# Device size 4000785964544, offset 16777216.
# Device /dev/sdk1 READ lock released.
# PBKDF argon2id, time_ms 2000 (iterations 0), max_memory_kb 1048576, parallel_threads 4.
# Deactivating volume offline1.
# dm versions   [ opencount flush ]   [16384] (*1)
# dm status offline1  [ opencount noflush ]   [16384] (*1)
# dm versions   [ opencount flush ]   [16384] (*1)
# dm table offline1  [ opencount flush securedata ]   [16384] (*1)
# Trying to open and read device /dev/sdk1 with direct-io.
# dm versions   [ opencount flush ]   [16384] (*1)
# dm deps offline1  [ opencount flush ]   [16384] (*1)
# dm versions   [ opencount flush ]   [16384] (*1)
# dm table offline1  [ opencount flush securedata ]   [16384] (*1)
# dm versions   [ opencount flush ]   [16384] (*1)
# Udev cookie 0xd4d82bf (semid 5) created
# Udev cookie 0xd4d82bf (semid 5) incremented to 1
# Udev cookie 0xd4d82bf (semid 5) incremented to 2
# Udev cookie 0xd4d82bf (semid 5) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)
# dm remove offline1  [ opencount flush retryremove ]   [16384] (*1)
# Udev cookie 0xd4d82bf (semid 5) decremented to 1
# Udev cookie 0xd4d82bf (semid 5) waiting for zero //hangs here

registro do udev:

Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: dm-2: Device is queued (SEQNUM=4516, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: dm-2: Device ready for processing (SEQNUM=4516, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: Successfully forked off 'n/a' as PID 8410.
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: dm-2: Worker [8410] is forked for processing SEQNUM=4516.
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: 252:2: Device is queued (SEQNUM=4517, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: 252:2: Device ready for processing (SEQNUM=4517, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Processing device (SEQNUM=4516, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Removing watch handle 50.
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: Successfully forked off 'n/a' as PID 8411.
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: 252:2: Worker [8411] is forked for processing SEQNUM=4517.
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: dm-2: Device is queued (SEQNUM=4518, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: dm-2: SEQNUM=4518 blocked by SEQNUM=4516
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: /usr/lib/udev/rules.d/95-dm-notify.rules:12 RUN '/sbin/dmsetup udevcomplete $env{DM_COOKIE}'
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: /usr/lib/udev/rules.d/disk-monitor.rules:4 RUN '/usr/sbin/disk-monitor.sh $env{DEVNAME}'
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: No reference left for '/dev/mapper/offline1', removing
Feb 26 18:51:38 gentoodesktop systemd-udevd[8411]: 252:2: Processing device (SEQNUM=4517, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: No reference left for '/dev/disk/by-id/dm-name-offline1', removing
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: No reference left for '/dev/disk/by-id/dm-uuid-CRYPT-LUKS2-f2eafcc2880e4d34afa3132486d1d6ae-offline1', removing
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: No reference left for '/dev/disk/by-uuid/5d5633e2-2f7c-49de-babf-f3ed263a3c8b', removing
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Running command "/usr/sbin/disk-monitor.sh /dev/dm-2"
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Starting '/usr/sbin/disk-monitor.sh /dev/dm-2'
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: Successfully forked off '(spawn)' as PID 8412.
Feb 26 18:51:38 gentoodesktop systemd-udevd[8411]: 252:2: Device processed (SEQNUM=4517, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[8411]: 252:2: sd-device-monitor(worker): Passed 167 byte to netlink monitor.
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Process '/usr/sbin/disk-monitor.sh /dev/dm-2' succeeded.
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Device processed (SEQNUM=4516, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: sd-device-monitor(worker): Passed 963 byte to netlink monitor.
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: dm-2: Device ready for processing (SEQNUM=4518, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: dm-2: sd-device-monitor(manager): Passed 230 byte to netlink monitor.
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Processing device (SEQNUM=4518, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Removing watch handle -1.
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: /usr/lib/udev/rules.d/disk-monitor.rules:4 RUN '/usr/sbin/disk-monitor.sh $env{DEVNAME}'
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Running command "/usr/sbin/disk-monitor.sh /dev/dm-2"
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Starting '/usr/sbin/disk-monitor.sh /dev/dm-2'
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: Successfully forked off '(spawn)' as PID 8419.
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Process '/usr/sbin/disk-monitor.sh /dev/dm-2' succeeded.
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: Device processed (SEQNUM=4518, ACTION=remove)
Feb 26 18:51:38 gentoodesktop systemd-udevd[8410]: dm-2: sd-device-monitor(worker): Passed 230 byte to netlink monitor.
Feb 26 18:51:38 gentoodesktop systemd-udevd[7823]: No events are queued, removing /run/udev/queue.
Feb 26 18:51:42 gentoodesktop systemd-udevd[7823]: Cleanup idle workers
Feb 26 18:51:42 gentoodesktop systemd-udevd[8411]: Unload kernel module index.
Feb 26 18:51:42 gentoodesktop systemd-udevd[8410]: Unload kernel module index.
Feb 26 18:51:42 gentoodesktop systemd-udevd[8410]: Unloaded link configuration context.
Feb 26 18:51:42 gentoodesktop systemd-udevd[8411]: Unloaded link configuration context.
Feb 26 18:51:42 gentoodesktop systemd-udevd[7823]: Worker [8411] exited.
Feb 26 18:51:42 gentoodesktop systemd-udevd[7823]: Worker [8410] exited.
Feb 26 18:51:46 gentoodesktop systemd-udevd[7823]: Cleanup idle workers
udev
  • 1 1 respostas
  • 26 Views

1 respostas

  • Voted
  1. Best Answer
    Marcus Müller
    2023-02-27T18:39:21+08:002023-02-27T18:39:21+08:00

    Acho que o problema aqui é que sua RUN=scriptdiretiva substitui uma existente, que era necessária para o dmcrypt funcionar corretamente. Tente se usar RUN+="/usr/sbin/disk-monitor.sh $env{DEVNAME}"funciona melhor (observe o +).

    É mesmo DEVNAME, também? man udevme fala sobre $deve $devpathe $devnode, mas não sobre a DEVNAMEpropriedade que um dispositivo de bloco pode ter.

    • 2

relate perguntas

  • Como atribuir links simbólicos a dispositivos seriais do dispositivo usb para serial CP2105?

  • Por que o Udev está carregando dois módulos de kernel para um único dispositivo USB?

  • Altere os dados dos sensores iio por meio de ACCEL_MOUNT_MATRIX personalizado

  • Executando script por meio da regra udev no Chrome OS [fechado]

  • udev, udisks, dbus e comando dd

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    Possível firmware ausente /lib/firmware/i915/* para o módulo i915

    • 3 respostas
  • Marko Smith

    Falha ao buscar o repositório de backports jessie

    • 4 respostas
  • Marko Smith

    Como exportar uma chave privada GPG e uma chave pública para um arquivo

    • 4 respostas
  • Marko Smith

    Como podemos executar um comando armazenado em uma variável?

    • 5 respostas
  • Marko Smith

    Como configurar o systemd-resolved e o systemd-networkd para usar o servidor DNS local para resolver domínios locais e o servidor DNS remoto para domínios remotos?

    • 3 respostas
  • Marko Smith

    apt-get update error no Kali Linux após a atualização do dist [duplicado]

    • 2 respostas
  • Marko Smith

    Como ver as últimas linhas x do log de serviço systemctl

    • 5 respostas
  • Marko Smith

    Nano - pule para o final do arquivo

    • 8 respostas
  • Marko Smith

    erro grub: você precisa carregar o kernel primeiro

    • 4 respostas
  • Marko Smith

    Como baixar o pacote não instalá-lo com o comando apt-get?

    • 7 respostas
  • Martin Hope
    user12345 Falha ao buscar o repositório de backports jessie 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl Por que a maioria dos exemplos do systemd contém WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky Como exportar uma chave privada GPG e uma chave pública para um arquivo 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll status systemctl mostra: "Estado: degradado" 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim Como podemos executar um comando armazenado em uma variável? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S Por que /dev/null é um arquivo? Por que sua função não é implementada como um programa simples? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 Como ver as últimas linhas x do log de serviço systemctl 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - pule para o final do arquivo 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla Por que verdadeiro e falso são tão grandes? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis Substitua a string em um arquivo de texto enorme (70 GB), uma linha 2017-12-30 06:58:33 +0800 CST

Hot tag

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve