Menu

Yet another read-only problem

RogerP
2024-01-05
2024-01-24
  • RogerP

    RogerP - 2024-01-05

    I only use Linux (Arch). I have two computers, both single-booted with Linux, the following behaviour is the same on both.

    With a USB stick mounted using Veracrypt2 (as a "Device"), my OS crashed. After the reboot I remounted the Veracrypt volume via the GUI, it was mounted read-only (ro). I checked the Settings->Default Mount Parameters. The ro flag was not set.

    The attempt to mount the drive via the Veracrypt GUI gives:

    device-mapper: reload ioctl on veracrypt2 (254:0) failed: Read-only file system
    Command failed.
    

    However, the following works fine:

    `sudo veracrypt -m=nokernelcrypto --fs-options=rw /dev/sdg1 myMountPoint
    

    .. which begs the question, why doesn't the GUI do this? I have checked the config XML file, which shows :
    <config key="FilesystemOptions">rw</config>
    <config key="MountVolumesReadOnly">0</config>

    Anyway, mounted this way Veracrypt is fine and shows the mounted volume, all files accessible (nothing lost). But the --fs-options=rwdid not have the desired effect.

    Note: I have not lost any files, all the files are accessible, no problem.

    I have tried the check filesystem and repair file system, which uses fsck. They both show errors associated with the .TRASH folder. Frustratingly, it does not allow any interaction. Not even vi commands, so I can't post the output here. (e.g. arrow keys don't work, any touch of the "Enter" button closes the window).

    This command can't be used either as the OS complains about the device being ro

    sudo dd if=/dev/zero of=/dev/sdg1
    

    Checking the mounted ro file system with

    sudo fsck.fat -vn /dev/sdg1
    

    As is a USB it is formatted as MSDOS compatible. The flags mean "verbose", and "don't actually do anything". This showed that fsck could not check the mounted drive. dmesg produced a not very informative message. I tried (in desperation):

    sudo mount -o remount,rw myMountPoint
    

    But, as I had hoped, this also doesn't work; after all, it's an encrypted drive. (If it had worked I would have been horrified!)

    Since my files are already fully backed-up, I have tried to brutally re-format the drive, but no Linux utility (fdisk, parted, even gparted) will have anything to do with touching an ro drive. They all refuse!

    My question is: Is there anything I can do within Veracrypt to rescue this perfectly OK (apart from being determinedly ro) USB drive, i.e. the hardware, or do I have to bin it? Maybe one for a Linux forum if you guys can't answer.

    The cruel fact is that since Windows doesn't care, it would probably be able to reformat the drive without a second's thought. :)

    Roger.

     
  • RogerP

    RogerP - 2024-01-05
    sudo udevadm lock --device=/dev/sdb mkfs.msdos /dev/sdb
    

    produces:

    mkfs.msdos: unable to open /dev/sdb: Read-only file system
    

    Whereas:

    sudo udevadm info --query=all --name=/dev/sdb
    

    produces:

    P: /devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1:1.0/host6/target6:0:0/6:0:0:0/block/sdb
    M: sdb
    U: block
    T: disk
    D: b 8:16
    N: sdb
    L: 0
    S: disk/by-id/usb-_USB_DISK_3.0_070B6AEA1DC05916-0:0
    S: disk/by-path/pci-0000:00:14.0-usbv3-0:1:1.0-scsi-0:0:0:0
    S: disk/by-diskseq/2
    S: disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0
    Q: 2
    E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb4/4-1/4-1:1.0/host6/target6:0:0/6:0:0:0/block/sdb
    E: DEVNAME=/dev/sdb
    E: DEVTYPE=disk
    E: DISKSEQ=2
    E: MAJOR=8
    E: MINOR=16
    E: SUBSYSTEM=block
    E: USEC_INITIALIZED=1818253253
    E: ID_BUS=usb
    E: ID_MODEL=USB_DISK_3.0
    E: ID_MODEL_ENC=USB\x20DISK\x203.0\x20\x20\x20\x20
    E: ID_MODEL_ID=5500
    E: ID_SERIAL=_USB_DISK_3.0_070B6AEA1DC05916-0:0
    E: ID_SERIAL_SHORT=070B6AEA1DC05916
    E: ID_VENDOR_ENC=\x20\x20\x20\x20\x20\x20\x20\x20
    E: ID_VENDOR_ID=13fe
    E: ID_REVISION=PMAP
    E: ID_TYPE=disk
    E: ID_INSTANCE=0:0
    E: ID_USB_MODEL=USB_DISK_3.0
    E: ID_USB_MODEL_ENC=USB\x20DISK\x203.0\x20\x20\x20\x20
    E: ID_USB_MODEL_ID=5500
    E: ID_USB_SERIAL=_USB_DISK_3.0_070B6AEA1DC05916-0:0
    E: ID_USB_SERIAL_SHORT=070B6AEA1DC05916
    E: ID_USB_VENDOR_ENC=\x20\x20\x20\x20\x20\x20\x20\x20
    E: ID_USB_VENDOR_ID=13fe
    E: ID_USB_REVISION=PMAP
    E: ID_USB_TYPE=disk
    E: ID_USB_INSTANCE=0:0
    E: ID_USB_INTERFACES=:080650:
    E: ID_USB_INTERFACE_NUM=00
    E: ID_USB_DRIVER=usb-storage
    E: ID_PATH_WITH_USB_REVISION=pci-0000:00:14.0-usbv3-0:1:1.0-scsi-0:0:0:0
    E: ID_PATH=pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0
    E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_1_1_0-scsi-0_0_0_0
    E: ID_PART_TABLE_UUID=e6e996d0
    E: ID_PART_TABLE_TYPE=dos
    E: DEVLINKS=/dev/disk/by-id/usb-_USB_DISK_3.0_070B6AEA1DC05916-0:0 /dev/disk/by-path/pci-0000:00:14.0-usbv3-0:1:1.0-scsi-0:0:0:0 /dev/disk/by-diskseq/2 /dev/disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0
    E: TAGS=:systemd:
    E: CURRENT_TAGS=:systemd:
    
     
  • RealTehreal

    RealTehreal - 2024-01-06

    It seems, the file system of the partition within your VC volume was damaged by the crash. Maybe you'll be able repair the volume, depending on the used file system (I either didn't catch it or you didn't provide information about it).

    First, mount the volume using the mount option "do not mount". This will give access to the insides of the VC volume, but should prevent the system from mounting the file system ro. But you will be able to do stuff with it this way, because it will behave like an unmounted partition.
    Second, do whatever is possble to repair the file system (depends on fs in use).

    Greets

     
  • RogerP

    RogerP - 2024-01-24

    Many thanks. The USB is fat32; my OS filesystem is btrfs (more's the pity)..

    With the "do not mount" filesystem option requested the GUI gave the same error as above, top, so I used:

    sudo veracrypt -m=nokernelcrypto --filesystem='none' /dev/sdb1 vera
    

    which returned with no errors but the following is still the case:

    sudo fsck.fat -vn /dev/sdb1
    fsck.fat 4.2 (2021-01-31)
    Logical sector size (33104 bytes) is not a multiple of the physical sector size.
    

    (obviously not good), and

    sudo fsck.fat -a /dev/sdb1
    fsck.fat 4.2 (2021-01-31)
    open: Read-only file system
    

    ... still read only.

    sudo mkfs.fat -c /dev/sdb1
    mkfs.fat 4.2 (2021-01-31)
    mkfs.fat: unable to open /dev/sdb1: Read-only file system
    

    So I have reformatted the dam thing from a Windows pc. :(

    (How do I mark this thread as closed?)

     

    Last edit: RogerP 2024-01-24

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.