更新到 15.04 后文件系统变成只读了吗?

更新到 15.04 后文件系统变成只读了吗?

我愚蠢地决定从 14.04LTS 更新到 14.10,然后再更新到 15.04。

自从这样做之后,我的网站就瘫痪了,文件系统也变成只读了。我不知道出了什么问题,因为更新已经成功完成。

这是我迄今为止发现的:

    root@lew:/# service apache2 status
apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2)
   Active: failed (Result: exit-code) since Sun 2015-07-12 08:36:18 EDT; 31min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 901 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Jul 12 08:36:18 lew.im systemd[1]: Starting LSB: Apache2 web server...
Jul 12 08:36:18 lew.im apache2[901]: * Starting web server apache2
Jul 12 08:36:18 lew.im apache2[901]: mktemp: failed to create file via template ‘/tmp/tmp.XXXXXXXXXX’: Read-only file system
Jul 12 08:36:18 lew.im apache2[901]: /etc/init.d/apache2: 91: /etc/init.d/apache2: cannot create : Directory nonexistent
Jul 12 08:36:18 lew.im apache2[901]: *
Jul 12 08:36:18 lew.im apache2[901]: * The apache2 configtest failed.
Jul 12 08:36:18 lew.im systemd[1]: apache2.service: control process exited, code=exited status=1
Jul 12 08:36:18 lew.im systemd[1]: Failed to start LSB: Apache2 web server.
Jul 12 08:36:18 lew.im systemd[1]: Unit apache2.service entered failed state.
Jul 12 08:36:18 lew.im systemd[1]: apache2.service failed.

然后 fdisk -l:

root@lew:/# fdisk -l

Disk /dev/vda: 20 GiB, 21476933632 bytes, 41947136 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 06F7B3C9-8E13-42CD-AD52-7A02301B6F16

Device     Start      End  Sectors Size Type
/dev/vda1   2048 41945087 41943040  20G Linux filesystem

和 fsck /

root@lew:/# sudo fsck /
fsck from util-linux 2.25.2
fsck.ext4: Unable to resolve 'UUID=815063a9-c956-44a6-ab11-05e1d0bb3a58'

我是这方面的新手,但从我读到的内容来看,我需要修复 fstab 中的某些内容?为什么更新会破坏这一点,可能出了什么问题?

我通过 SSH 连接到该服务器,因为它托管在 DigitalOcean。

编辑:

布基德

root@lew:~# blkid
/dev/vda1: LABEL="DOROOT" UUID="18254707-08e8-494e-b456-938592928a5e" TYPE="ext4" PTTYPE="dos" PARTLABEL="primary" PARTUUID="8c484e81-f919-4803-acc7-1447fdd81b45"

root@lew:~# mount
/dev/vda1 on / type ext4 (rw,errors=remount-ro)
proc on /proc type proc (rw,nodev,noexec,nosuid)
sysfs on /sys type sysfs (rw,nodev,noexec,nosuid)
none on /sys/fs/cgroup type tmpfs (rw,uid=0,gid=0,mode=0755,size=1024)
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,nodev,noexec,nosuid,size=5242880)
none on /run/shm type tmpfs (rw,nosuid,nodev)
none on /run/user type tmpfs (rw,nodev,noexec,nosuid,size=104857600,mode=0755)
none on /sys/fs/pstore type pstore (rw)
systemd on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,noexec,nodev,none,name=systemd)

系统状态

root@lew:~# cat /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>
# / was on /dev/vda1 during installation
#UUID=815063a9-c956-44a6-ab11-05e1d0bb3a58 /               ext4    errors=remount-ro 0       1
UUID=06F7B3C9-8E13-42CD-AD52-7A02301B6F16 /               ext4    errors=remount-rw 0       1

/swapfile       none    swap    sw      0       0

答案1

解决方案已发布在评论中@Lewis Lebentz 7月26日 15:00

我会解释一下,这样任何寻找答案的人都可以在这里轻松找到答案。但@Lewis 应该自己发布答案并将其标记为已回答,这样你就会得到应有的荣誉。

解决方案: 打开支持票,要求 Digital Ocean 安装恢复 ISO(这是一个只有他们可以安装的特殊 ISO)。

  1. 选择 1 来挂载文件系统并进行编辑/etc/fstab笔记:使用控制台并运行nanovi /mnt/etc/fstab。或者,您可以启用 SSH 和网络(在恢复选项中)以使用终端登录(请参阅操作说明) 虽然我自己还没有尝试过。
  2. 将其中的UUID改为blkid的输出,保存。
  3. 要求 DO 移除恢复磁盘。重新启动后,您便可以再次访问!

答案2

您可以按照 ændrük 在评论中所说进行操作:

$ mount -rw -o remount /dev/vda1 /
$ sed s/wrong_uuid/correct_uuid/ -i /etc/fstab

..然后再次启动你的 Linux!确保将 vda1 更改为你的设备名称。当然,在 sed 命令中,还要使用正确的 uuid!

答案3

我也发现这种情况发生了。无法解析 /etc/fstab 中的磁盘 UUID。我通过首先运行以下命令找到磁盘的 UUID 来修复此问题

sudo blkid -c /dev/null -o list

并复制挂载点的磁盘 UUID/

然后我按照@ændrük 的评论重新安装了磁盘

mount -rw -o remount UUID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx

然后我编辑 /etc/fstab 来更改根磁盘的磁盘 UUID。

相关内容