Location>code7788 >text

ubuntu inexplicably The system appears to have a read-only file system.

Popularity:679 ℃/2024-09-19 11:31:19

Operation and maintenance records

Date: September 15, 2024

Problem Description:

Problems with system reboot after installing multiple LNMP services. When attempting to run theapt update command, the system displays the following error message:

Ignore:1 /ubuntu jammy-security InRelease
Ignore:2 /ubuntu jammy InRelease
Ignore:3 /ubuntu jammy InRelease
Ignore:4 /ubuntu jammy-backports InRelease
...
Error:2 /ubuntu jammy InRelease
  Temporarily unable to resolve domain ""
...
W: chown to _apt:root of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (30: read-only filesystem)
...
W: Unable to download /ubuntu/dists/jammy/InRelease Temporarily unable to resolve domain """

Problem Analysis:

(of a computer) rundf -h command./mnt/data mount point was lost and the file system changed to read-only mode. Checking the/etc/fstab The file is found to be empty, which may be the cause of the file system changing to read-only mode.

Solution Steps:

  1. Check the file system:

    sudo fsck /dev/sda3
    

    The results of the examination showed that/dev/sda3 There is no problem with the file system.

  2. Try remounting the file system in read/write mode:

    sudo mount -o remount,rw /
    
  3. Test to see if the file can be created:

    sudo touch /testfile
    
  4. utilizationblkid command to find the UUID information of the file system:

    sudo blkid
    
  5. Edit and restore/etc/fstab Documentation:

    according toblkid The output of the message to restore the/etc/fstab The contents of the file:

     # root filesystem
     UUID=xxxxxxxxxxxxxxxxx / ext4 defaults 0 1
     # Boot partition
     UUID=xxxxxxxxxxxxx /boot/efi vfat defaults 0 2
     # raid array disk
     UUID=xxxxxxxxxxx /mnt/data ext4 defaults 0 2
    
  6. Back up the new/etc/fstab Documentation:

    Place the restored/etc/fstab The file is backed up to the/etc/

Summary:

after a system reboot/etc/fstab Files are lost or deleted, causing the file system to change to read-only mode. This is accomplished by finding theblkid The information in the/etc/fstab file and remounted the file system in read-write mode. To prevent similar problems in the future, a timely backup of the/etc/fstab Documentation.