lvm 损坏导致 read_urandom 错误

lvm 损坏导致 read_urandom 错误

我在 chroot 中执行了一些操作,不幸的是我破坏了主机。现在我无法管理卷组:

pvs
  read_urandom: /dev/urandom: open failed: No such file or directory

关于 lvm 的不同命令出现相同错误。尝试重新配置:

# dpkg-reconfigure linux-image-4.19.0-16-amd64

/etc/kernel/postinst.d/dkms:
dkms: running auto installation service for kernel 4.19.0-16-amd64:/usr/sbin/dkms: line 3345: /dev/fd/62: No such file or directory
.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.19.0-16-amd64
cryptsetup: ERROR: Couldn't resolve device 
    /dev/mapper/rootvg-root--server--alpha--host
cryptsetup: WARNING: Couldn't determine root device
cryptsetup: ERROR: Couldn't resolve device /dev/dm-1 (deleted)
cryptsetup: ERROR: Couldn't resolve device 
    UUID=e9ef352b-a648-4499-ade2-54235f40a3df
W: Couldn't identify type of root file system for fsck hook
I: The initramfs will attempt to resume from /dev/dm-1 (deleted)
I: Set the RESUME variable to override this.
/etc/kernel/postinst.d/zz-update-grub:
/usr/sbin/grub-probe: error: failed to get canonical path of `/dev/mapper/rootvg-root--server--alpha--host'.
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 1

尝试更新 initramfs:

# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-4.19.0-16-amd64
cryptsetup: ERROR: Couldn't resolve device 
    /dev/mapper/rootvg-root--server--alpha--host
cryptsetup: WARNING: Couldn't determine root device
cryptsetup: ERROR: Couldn't resolve device /dev/dm-1 (deleted)
cryptsetup: ERROR: Couldn't resolve device 
    UUID=e9ef352b-a648-4499-ade2-54235f40a3df
W: Couldn't identify type of root file system for fsck hook
I: The initramfs will attempt to resume from /dev/dm-1 (deleted)
I: Set the RESUME variable to override this.

分区架构:

# lsblk
NAME                                       MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
nvme1n1                                    259:0    0  1.8T  0 disk  
├─nvme1n1p1                                259:2    0    2M  0 part  
│ └─md1                                      9:1    0    2M  0 raid1 
├─nvme1n1p2                                259:3    0  510M  0 part  
│ └─md2                                      9:2    0  509M  0 raid1 /boot
└─nvme1n1p3                                259:4    0  1.8T  0 part  
  └─md3                                      9:3    0  1.8T  0 raid1 
    └─croot                                253:0    0  1.8T  0 crypt 
      ├─rootvg-swap--server--alpha--host 253:1    0    8G  0 lvm   
      ├─rootvg-root--server--alpha--host 253:2    0  1.5T  0 lvm   /
      ├─rootvg-root--vm1                   253:3    0  100G  0 lvm   
      ├─rootvg-root--vm2                   253:4    0   20G  0 lvm   
      ├─rootvg-root--vm3                   253:5    0   40G  0 lvm   
      └─rootvg-root--vm4                   253:6    0  100G  0 lvm   
nvme0n1                                    259:1    0  1.8T  0 disk  
├─nvme0n1p1                                259:5    0    2M  0 part  
│ └─md1                                      9:1    0    2M  0 raid1 
├─nvme0n1p2                                259:6    0  510M  0 part  
│ └─md2                                      9:2    0  509M  0 raid1 /boot
└─nvme0n1p3                                259:7    0  1.8T  0 part  
  └─md3                                      9:3    0  1.8T  0 raid1 
    └─croot                                253:0    0  1.8T  0 crypt 
      ├─rootvg-swap--server--alpha--host 253:1    0    8G  0 lvm   
      ├─rootvg-root--server--alpha--host 253:2    0  1.5T  0 lvm   /
      ├─rootvg-root--vm1                   253:3    0  100G  0 lvm   
      ├─rootvg-root--vm2                   253:4    0   20G  0 lvm   
      ├─rootvg-root--vm3                   253:5    0   40G  0 lvm   
      └─rootvg-root--vm4                   253:6    0  100G  0 lvm  

问题出在 rootvg-root--vm4 上执行 chroot 时。可能是由于 update-initramfs 或删除 /mnt 中的文件影响了主机上运行的进程。现在我甚至无法删除该卷,而且我担心如果服务器重新启动,服务器会丢失...

等待您的支持,提前感谢。

編輯:

更多操作:尝试重新启动虚拟机:

$ sudo virsh start vm2-bastion
sudo virsh start vm2

error: Failed to start domain vm2
error: internal error: Failed to probe QEMU binary with QMP: Could not access KVM kernel module: No such file or directory
qemu-system-x86_64: failed to initialize KVM: No such file or directory
qemu-system-x86_64: Back to tcg accelerator

丢失了通过 SSH 的常规访问权限:

$ ssh user@ip
PTY allocation request failed on channel 0

...但我设法使用以下方式登录:

$ ssh user@ip "/bin/bash -i" 

bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
user@server-alpha-host:~$

答案1

现在我甚至无法删除该卷,而且我担心如果服务器重新启动,我会丢失该服务器......

备份所有重要数据。如果此主机对您很重要,则必须能够重建和恢复它。

确定删除发生的位置和时间是否有任何块设备挂载,以及您是否关心其中的数据。可能不关心,但仅仅因为您发送了 SIGINT 并不意味着删除在设备节点停止。

缺少 /dev/urandom、/dev/kvm、块设备、/proc 和其他设备会破坏很多东西。重新启动以恢复它们。devtmpfs 和 udev 通常会在每次启动时重新创建设备节点。此重新启动是为了确保每个行为不当的程序都重新启动,并且最终必须发生。

相关内容