
我愚蠢地決定從 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 掛載檔案系統並編輯
/etc/fstab
. 筆記:使用控制台並運行nano
或vi /mnt/etc/fstab
。或者,您可以啟用 SSH 和網路(在復原選項中)以使用終端登入(請參閱操作說明)雖然我自己還沒嘗試過。 - 將其中的 UUID 更改為 blkid 的輸出,儲存。
- 請 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。