U盘LUKS加密无法移除且处于只读状态的求助
U盘LUKS加密无法移除且处于只读状态的求助
大家好,我遇到了一个棘手的U盘问题,想请各位帮忙看看:
我尝试把Qubes OS安装到SanDisk 64GB 3.2 Gen1的U盘做启动盘,结果安装过程中突然中断了。之后U盘就不显示了,打开分区管理器一看,它居然处于只读状态!
排查后发现这个U盘被LUKS加密了,我知道加密的密码,但不管是尝试移除加密密钥还是重新格式化,都失败了,下面是我试过的命令和对应的报错:
尝试移除LUKS密钥
cryptsetup luksRemoveKey /dev/sda4
得到报错:
Device wipe error, offset 32768.
尝试重新格式化LUKS分区
root@amnesia:/home/amnesia cryptsetup -y -v luksFormat /dev/sdc4
终端输出:
WARNING: Device /dev/sdc4 already contains a 'crypto LUKS' superblock signature. WARNING! This will overwrite data on /dev/sdc4 irrevocably. Are you sure? (Type 'yes' in capital letters): YES Enter passphrase for /dev/sdc4: Verify passphrase: Failed to open file /dev/sdc4 in read/write mode. Command failed with code -1 (wrong or missing parameters).
后来我打错了参数又试了一次:
root@amnesia:/home/amnesiae cryptsetup y v LuksFormat /dev/sdc4
输出还是类似的错误:
WARNING: Device /dev/sdc4 already contains a crypto LUKS superblock signature. WARNING! This will overwrite data on /dev/sdc4 irrevocably. Are you sure? (Type yes in capital letters): YES Enter passphrase for /dev/sdc4: verify passphrase: Failed to open file /dev/sdc4 in read/write mode. Command failed with code -1 (wrong or missing parameters).
再次尝试移除最后一个密钥槽
root@amnesia:/home/amnesiae cryptsetup -y v LuksRemovekey /dev/sdc4
终端输出:
Enter passphrase to be deleted: Verify passphrase: Key slot 8 unlocked. Keyslot is selected for deletion. WARNING! This is the last keyslot. Device will become unusable after purging this key Are you sure? (Type 'yes' in capital letters): YES Device wipe error, offset 32768. Cannot wipe device /dev/sdc4. Key slot a removed. Command failed with code -1 (wrong or missing parameters).
现在U盘还是只读状态,加密也清不掉,有没有大佬知道该怎么解决啊?
补充:可能的解决思路
先解除只读锁定
- 先检查U盘有没有物理写保护开关,有的话拨到非锁定位置
- 尝试用命令清除只读属性(注意替换成你的U盘设备名,比如
/dev/sdc):sudo hdparm -r0 /dev/sdc - 卸载后重新挂载为读写模式:
sudo udisksctl unmount -b /dev/sdc4 sudo udisksctl mount -b /dev/sdc4 -o rw
彻底清除LUKS签名并重建分区
如果只读问题解决后还是无法操作,直接清除U盘开头的扇区(风险操作,务必确认设备名正确!):sudo umount /dev/sdc* sudo dd if=/dev/zero of=/dev/sdc bs=1M count=10之后用
fdisk或gparted重新创建分区表和分区,再格式化即可。检查硬件故障
如果以上方法都无效,可能是U盘硬件损坏,可以试试厂商的官方修复工具检测。
备注:内容来源于stack exchange,提问作者PUGAZHARASAN
相关产品推荐
相关产品推荐

