开机报错
An error occurred while mounting /etc/fstab
Press S to skip mounting or M for manual recovery
按S后无法进入系统,重启后继续出现上面的提示,再次按S后进入系统。
在命令行中使用tab自动补全时出现:
-bash: cannot create temp file for here-document: Read-only file system
尝试touch,mkdir等写操作都会提示文件系统只读。
看来文件系统现在是只读的。
使用sudo时出现:
sudo ls
sudo: unable to open /var/lib/sudo/dyang/tty1: No such file or directory
查看mount情况:
/dev/mapper/ubuntu--vg-root on / type ext4 (rw,noatime,nodiratime)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
none on /sys/fs/cgroup type tmpfs (rw)
none on /sys/fs/fuse/connections type fusectl (rw)
none on /sys/kernel/debug type debugfs (rw)
none on /sys/kernel/security type securityfs (rw)
udev on /dev type devtmpfs (rw,mode=0755)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,noexec,nosuid,nodev,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
/dev/sda1 on /boot type ext2 (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,noexec,nosuid,nodev,none,name=systemd)
mount: warning: /etc/mtab is not writable (e.g. read-only filesystem).
It's possible that information reported by mount(8) is not
up to date. For actual information about system mount points
check the /proc/mounts file.
出现警告,看来确实是被mount成只读模式了。
网上说需要重新mount根目录
使用mount命令出现报错:
sudo mount -o remount,rw /
sudo: unable to open /var/lib/sudo/dyang/tty1: No such file or directory
[mntent]: line 8 in /etc/fstab is bad
查看/etc/fstab:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
/dev/mapper/ubuntu--vg-root / ext4 noatime,nodiratime, errors=remount-ro 0 1
# /boot was on /dev/sda1 during installation
UUID=2eb5fca1-c06d-4d28-b552-d0c7caa7d4e7 /boot ext2 defaults 0 2
/dev/mapper/ubuntu--vg-swap_1 none swap sw 0 0
整个地方的配置文件有问题,第8行的errors和前面的逗号之间出现了多个空格,需要去掉。
再使用mount命令:
sudo mount -o remount,rw /
如果还是不行,修复硬盘解决:
方法1
如果整个硬盘已经是被只读方式挂载,那么可以使用fsck命令进行硬盘修复
Note: fsck最好对未挂载硬盘或者以只读方式挂载的硬盘进行修复,否则非常危险。
先进入/dev/disk/by-id下查看对应的硬盘,让后使用下面命令修复
sudo fsck -fc /dev/disk/by-id/dm-name-ubuntu--vg-root
方法2
重启系统,在grub界面进入advance (高级模式)->recovery mode(恢复模式)
选择root
输入密码进入后
先进入/dev/disk/by-id下查看对应的硬盘,让后使用下面命令修复
sudo fsck -fc /dev/disk/by-id/dm-name-ubuntu--vg-root
网友评论