休眠恢复从哪里获取设备节点?

休眠恢复从哪里获取设备节点?

不久前,我在 Linux 系统上设置了休眠状态。它一直工作得很好,直到今晚我安装了另一个硬盘,它改变了设备节点名称。因此,现在在启动时,我收到一条消息,内容是(我没有写下确切的措辞),couldn't stat /dev/sda3并要求我输入休眠设备节点名称或按 Enter 键继续,而不从休眠状态恢复。这种情况发生在普通启动上,而不是从休眠状态恢复(我没有尝试从休眠状态恢复,并且当系统无法正确识别要从休眠状态恢复的设备时,恐怕它根本无法正常工作)。当我使用休眠时,我使用软件包提供的 /usr/sbin/hibernate 脚本hibernate(版本2.0+15+g88d54a8-1已安装);我不记得以任何特定方式真正设置过它。

这是因为当我安装新硬盘时,它在检测顺序中比我拥有根文件系统和交换空间的SSD更早出现。这不应该构成问题,特别是当我到处使用稳定的 /dev/disk/by-*/ 名称时——至少我是这么认为的。

我对 /boot 和 /etc 进行了 grep 搜索,但没有一个匹配项看起来是相关的。

/proc/swaps 显示 /dev/sdb3,这是该分区现在已知的名称。 /etc/fstab 使用其 /dev/disk/by-id/ata-*-part3 名称对其进行命名。

我正在使用相当最新的 Debian Wheezy。这是我的 /etc/default/grub:

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT=300
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet pci=nomsi"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

GRUB_PRELOAD_MODULES="uhci usb_keyboard"

这是/boot/grub/grub.cfg:

#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
insmod uhci
insmod usb_keyboard
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
set default="0"

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

terminal_input console
terminal_output console
if [ "${recordfail}" = 1 ] ; then
  set timeout=-1
else
  set timeout=300
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
set menu_color_normal=cyan/blue
set menu_color_highlight=white/blue
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
        set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-c050d662-f94a-447a-9342-0fc69f65a513' {
        load_video
        insmod gzio
        insmod part_msdos
        insmod diskfilter
        insmod mdraid09
        insmod ext2
        set root='mduuid/0a1be8bb7679264ae488bd5c6f66e022'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint='mduuid/0a1be8bb7679264ae488bd5c6f66e022'  c050d662-f94a-447a-9342-0fc69f65a513
        else
          search --no-floppy --fs-uuid --set=root c050d662-f94a-447a-9342-0fc69f65a513
        fi
        linux   /boot/vmlinuz-3.2.0-4-amd64 root=UUID=c050d662-f94a-447a-9342-0fc69f65a513 ro   quiet pci=nomsi
        initrd  /boot/initrd.img-3.2.0-4-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-c050d662-f94a-447a-9342-0fc69f65a513' {
        menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-4-amd64-advanced-c050d662-f94a-447a-9342-0fc69f65a513' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod diskfilter
                insmod mdraid09
                insmod ext2
                set root='mduuid/0a1be8bb7679264ae488bd5c6f66e022'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint='mduuid/0a1be8bb7679264ae488bd5c6f66e022'  c050d662-f94a-447a-9342-0fc69f65a513
                else
                  search --no-floppy --fs-uuid --set=root c050d662-f94a-447a-9342-0fc69f65a513
                fi
                echo    'Loading Linux 3.2.0-4-amd64 ...'
                linux   /boot/vmlinuz-3.2.0-4-amd64 root=UUID=c050d662-f94a-447a-9342-0fc69f65a513 ro   quiet pci=nomsi
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-3.2.0-4-amd64
        }
        menuentry 'Debian GNU/Linux, with Linux 3.2.0-4-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.2.0-4-amd64-recovery-c050d662-f94a-447a-9342-0fc69f65a513' {
                load_video
                insmod gzio
                insmod part_msdos
                insmod diskfilter
                insmod mdraid09
                insmod ext2
                set root='mduuid/0a1be8bb7679264ae488bd5c6f66e022'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint='mduuid/0a1be8bb7679264ae488bd5c6f66e022'  c050d662-f94a-447a-9342-0fc69f65a513
                else
                  search --no-floppy --fs-uuid --set=root c050d662-f94a-447a-9342-0fc69f65a513
                fi
                echo    'Loading Linux 3.2.0-4-amd64 ...'
                linux   /boot/vmlinuz-3.2.0-4-amd64 root=UUID=c050d662-f94a-447a-9342-0fc69f65a513 ro single
                echo    'Loading initial ramdisk ...'
                initrd  /boot/initrd.img-3.2.0-4-amd64
        }
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###

这是 /etc/uswsusp.conf:

# /etc/uswsusp.conf(5) -- Configuration file for s2disk/s2both
resume device = /dev/sda3
splash = y
compress = y
early writeout = y
image size = 15529056419
RSA key file = /etc/uswsusp.key
shutdown method = platform

如果我能找到合适的地方进行更改,这应该是一个简单的更改。所以,只需从哪里获取该设备名称的恢复代码我该如何改变它以反映新的现实?

(我通过交换所涉及的设备来解决这个问题,使 SSD 在检测顺序中排在第一位,但我仍然对这个问题的答案感兴趣。)

答案1

基本上,您的原始文件是由安装时/etc/uswsusp.conf调用的脚本编写的。要查看脚本,请检查。dpkguswsusp/var/lib/dpkg/info/uswsusp.config

要半自动更新,请使用:

dpkg-reconfigure uswsusp

或者,手动编辑它,然后使用:

update-initramfs -u

/usr/share/doc/uswsusp/README.Debian我真诚地鼓励您也阅读。

相关内容