歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Ubuntu錯誤could not stat the resume device file

Ubuntu錯誤could not stat the resume device file

日期:2017/2/28 16:11:41   编辑:Linux教程

筆記本出了些小問題,重新安裝了雙系統裡的windows操作系統,基本上是順利的,可以看這篇:雙系統重裝Windows後修復Ubuntu的GRUB http://www.linuxidc.com/Linux/2011-07/38187.htm。本來以為一切問題都沒有了,但是到ubuntu下,開機還是出現問題,提示:could not stat the resume device file '/dev/sda7' (and something about giving a path or press enter) 。按回車後沒有反應,但是用ctrl+alt+F1進入tty1後再按回車就可以正常登錄系統。但是問題總是要解決的。下面是方法

根據提示基本可以斷定是交換分區swap的問題,進入系統後輸入

sudo fdisk -l

來查看目前磁盤的分區。原來在安裝xp時分區被調整了,原來的/dev/sda7變成了/dev/sda6,所以只要把ubuntu交換分區設定的配置文件修改過來就可以了。

方法1:直接修改配置文件

先運行

sudo blkid

結果:

/dev/sda1: UUID="d6145c6c-b428-4f34-b517-d114060eae85" TYPE="ext4"
/dev/sda2: UUID="0A640C2C640C1CD7" TYPE="ntfs"
/dev/sda4: LABEL="freedom" UUID="dbc04f37-5259-43a8-9de2-6c04760163cd" TYPE="ext4"
/dev/sda5: UUID="9f7dc9aa-fb3e-48fe-9eeb-54b39eec18ba" TYPE="ext4"
/dev/sda6: LABEL="swap" UUID="da9644c3-af91-4990-b325-080912961e9b" TYPE="swap"

查看分區的uuid(什麼是uuid?),分別修改以下三個文件中的內容 /etc/initramfs-tools/conf.d/resume、 /etc/uswsusp.conf和/etc/fstab,把/etc/initramfs-tools/conf.d/resume裡的UUID改成 /dev/sda6(你的swap分區)的uuid,把/etc/uswsusp.conf裡的第一行改成resume device = /dev/sda6,最後把/etc/fstab裡有swap標志的一行(一般是最後一行)的uuid也改成你新的swap的uuid。

方法2.重新配置swap

直接運行

sudo dpkg-reconfigure uswsusp

或者

sudo apt-get reinstall initramfs-tools

按提示一步一步做好了。

以上兩種辦法,本人都測試過了,都是可行的。

Copyright © Linux教程網 All Rights Reserved