Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 486516 - >=sys-kernel/dracut-031 in host only mode fails to add resume support
Summary: >=sys-kernel/dracut-031 in host only mode fails to add resume support
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Amadeusz Żołnowski (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-29 21:29 UTC by Dan Goodliffe
Modified: 2013-10-17 14:21 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Debug output (debug.bz2,54.03 KB, application/x-bzip)
2013-10-02 20:47 UTC, Dan Goodliffe
Details
resume-fix-swap-detection-in-hostonly-mode.patch (resume-fix-swap-detection-in-hostonly-mode.patch,542 bytes, patch)
2013-10-06 14:39 UTC, Alexander Tsoy
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Goodliffe 2013-09-29 21:29:28 UTC
Recent versions of dracut only add resume support for systems with a swap device when building host only initramfss.
I have a swap device, but it still doesn't add resume support. I'm guessing it's something to do with detection of the volume. Other than it's on LVM, mine's nothing unusual I don't think. I can provide plenty of further details if I know what's useful :)

Maybe this as a starter:
akira ~ # udevadm info /dev/dm-8
P: /devices/virtual/block/dm-8
N: dm-8
S: disk/by-id/dm-name-spindle-swap
S: disk/by-id/dm-uuid-LVM-5c3wH5hNMrgw6oOT6gvNqLAaJ1YM33FyT5o6DLRC6DBfbAaJPiq0LD0BU84lmKqe
S: disk/by-label/swap
S: disk/by-uuid/3c4aa72c-67e8-4cf3-a9d4-759c6d1f0951
S: mapper/spindle-swap
S: spindle/swap
E: DEVLINKS=/dev/disk/by-id/dm-name-spindle-swap /dev/disk/by-id/dm-uuid-LVM-5c3wH5hNMrgw6oOT6gvNqLAaJ1YM33FyT5o6DLRC6DBfbAaJPiq0LD0BU84lmKqe /dev/disk/by-label/swap /dev/disk/by-uuid/3c4aa72c-67e8-4cf3-a9d4-759c6d1f0951 /dev/mapper/spindle-swap /dev/spindle/swap
E: DEVNAME=/dev/dm-8
E: DEVPATH=/devices/virtual/block/dm-8
E: DEVTYPE=disk
E: DM_ACTIVATION=1
E: DM_LV_NAME=swap
E: DM_NAME=spindle-swap
E: DM_SUSPENDED=0
E: DM_UDEV_DISABLE_LIBRARY_FALLBACK_FLAG=1
E: DM_UDEV_PRIMARY_SOURCE_FLAG=1
E: DM_UDEV_RULES_VSN=2
E: DM_UUID=LVM-5c3wH5hNMrgw6oOT6gvNqLAaJ1YM33FyT5o6DLRC6DBfbAaJPiq0LD0BU84lmKqe
E: DM_VG_NAME=spindle
E: ID_FS_LABEL=swap
E: ID_FS_LABEL_ENC=swap
E: ID_FS_TYPE=swsuspend
E: ID_FS_USAGE=other
E: ID_FS_UUID=3c4aa72c-67e8-4cf3-a9d4-759c6d1f0951
E: ID_FS_UUID_ENC=3c4aa72c-67e8-4cf3-a9d4-759c6d1f0951
E: ID_FS_VERSION=tuxonice
E: MAJOR=253
E: MINOR=8
E: SUBSYSTEM=block
E: UDISKS_PRESENTATION_NOPOLICY=1
E: USEC_INITIALIZED=89328
Comment 1 Alexander Tsoy 2013-10-02 18:27:08 UTC
Works for me with dracut-033-r1. Could you attach or post the content of your fstab?
Comment 2 Dan Goodliffe 2013-10-02 18:29:05 UTC
Assuming you don't need the whole thing...

/dev/spindle/swap none swap defaults 0 0
Comment 3 Amadeusz Żołnowski (RETIRED) gentoo-dev 2013-10-02 19:26:19 UTC
(In reply to Dan Goodliffe from comment #2)
> Assuming you don't need the whole thing...
> 
> /dev/spindle/swap none swap defaults 0 0

Shouldn't it be: dev, none, swap, sw, 0, 0?
Comment 4 Dan Goodliffe 2013-10-02 19:33:08 UTC
Can't see a mention of sw in man fstab or man swapon... but either way, changed it, no difference.
Comment 5 Dan Goodliffe 2013-10-02 19:38:27 UTC
Found it, I think...

host_fs_types lists the device as "swsuspend"... but /usr/lib/dracut/modules.d/95resume/module-setup.sh is looking for "swap" else bailing out.

I've changed that and it's built resume support in (although I haven't yet tried a hibernate cycle, not a good time)
Comment 6 Dan Goodliffe 2013-10-02 19:49:32 UTC
If I'm following my debugging properly... I get here...

akira ~ # blkid -u filesystem -o export /dev/spindle/swap 
DEVNAME=/dev/spindle/swap
LABEL=swap
UUID=3c4aa72c-67e8-4cf3-a9d4-759c6d1f0951
TYPE=swsuspend

akira ~ # qfile $(which blkid)
sys-apps/util-linux (/sbin/blkid)

akira ~ # emerge -qpv util-linux
[ebuild   R   ] sys-apps/util-linux-2.23.2-r2  USE="bash-completion caps cramfs ncurses nls pam suid udev unicode -cytune -fdformat -old-linux (-selinux) -slang -static-libs {-test} -tty-helpers" 

Don't know if I'm barking up the right tree or not... can't think why my blkid would report anything different to anyone else's.
Comment 7 Alexander Tsoy 2013-10-02 19:57:20 UTC
(In reply to Dan Goodliffe from comment #5)
> Found it, I think...
> 
> host_fs_types lists the device as "swsuspend"

How is this possible? From dracut script:

for line in "${fstab_lines[@]}"; do
    set -- $line
    #dev mp fs fsopts
    push host_devs "$1"
    host_fs_types["$1"]="$3"
done
Comment 8 Dan Goodliffe 2013-10-02 20:15:49 UTC
strace suggests it's calling blkid (as per previous comment)
I can only assume right now that it's from get_fs_env from _get_fs_type.

Maybe /usr/bin/dracut line ~955
Comment 9 Alexander Tsoy 2013-10-02 20:41:20 UTC
(In reply to Dan Goodliffe from comment #8)
> strace suggests it's calling blkid (as per previous comment)
> I can only assume right now that it's from get_fs_env from _get_fs_type.
> 
> Maybe /usr/bin/dracut line ~955

Please add --debug to the command you are using to generate initramfs and attach the output.
Comment 10 Dan Goodliffe 2013-10-02 20:47:58 UTC
Created attachment 359998 [details]
Debug output

dracut -H -f --lzma /boot/initramfs-3.8.13-tuxonice.img.new --debug 2> debug
Comment 12 Dan Goodliffe 2013-10-02 21:04:59 UTC
akira ~ # dracut --version
getopt: unrecognized option '--version'
Usage: /usr/bin/dracut [OPTION]... [<initramfs> [<kernel-version>]]

Version: 033-r1
.....



Specifically 033, not -r1?

What I have is...

            while read _d _m _t _o _r; do
                [[ "$_d" == \#* ]] && continue
                [[ $_d ]] || continue
                [[ $_t != "swap" ]] && continue
                [[ $_m != "swap" ]] && [[ $_m != "none" ]] && continue
                [[ "$_o" == *noauto* ]] && continue
                _d=$(expand_persistent_dev "$_d")
                [[ "$_d" -ef "$dev" ]] || continue
Comment 13 Alexander Tsoy 2013-10-02 21:57:08 UTC
Seems you run modified version of dracut ( [[ $fs = swap ]] -> [[ $fs = swsuspend ]] ), but this makes no sense. host_fs_types is modified by _get_fs_types(), so this is where swsuspend comes from. I suspect that this problem exist only on tuxonice kernels. Relevant part of the debug output:

/usr/bin/dracut@940(_get_fs_type): ID_FS_TYPE=swsuspend
/usr/bin/dracut@941(_get_fs_type): host_fs_types["$(readlink -f "/dev/block/$1")"]=swsuspend
[...]
/usr/lib/dracut/dracut-functions.sh@1065(module_check): check -h
/usr/lib/dracut/modules.d/95resume/module-setup.sh@7(check): [[ -n -h ]]
/usr/lib/dracut/modules.d/95resume/module-setup.sh@8(check): for fs in '
"${host_fs_types[@]}"'
/usr/lib/dracut/modules.d/95resume/module-setup.sh@9(check): echo ext4
/usr/lib/dracut/modules.d/95resume/module-setup.sh@10(check): [[ ext4 = 
swsuspend ]]
/usr/lib/dracut/modules.d/95resume/module-setup.sh@8(check): for fs in '
"${host_fs_types[@]}"'
/usr/lib/dracut/modules.d/95resume/module-setup.sh@9(check): echo swsuspend
/usr/lib/dracut/modules.d/95resume/module-setup.sh@10(check): [[ swsuspend = swsuspend ]]
/usr/lib/dracut/modules.d/95resume/module-setup.sh@10(check): return 0
/usr/lib/dracut/dracut-functions.sh@1066(module_check): _ret=0
Comment 14 Alexander Tsoy 2013-10-02 22:03:08 UTC
Fix is trivial.

-            [[ $fs = swap ]] && return 0
+            [[ $fs = swap ]] || [[ $fs = swsuspend ]] && return 0
Comment 15 Dan Goodliffe 2013-10-02 22:07:48 UTC
Ah, yes... I had previously put some debug in there and tried that to see if that's why I wasn't getting resume support. Thought I'd put it back before running with --debug.

Agreed on the kernel front. 2 boxes here with tuxonice, both "swsuspend"... 2 hardened, both "swap". I suspect a lot of people wanting resume support run tuxonice on ice, thankfully as you say, the fix is trivial.
Comment 16 Alexander Tsoy 2013-10-06 14:39:59 UTC
Created attachment 360236 [details, diff]
resume-fix-swap-detection-in-hostonly-mode.patch

This is probably an overkill, but 95resume/resume-genrules.sh still support all of this fs types. Does it work?
Comment 17 Dan Goodliffe 2013-10-06 16:42:23 UTC
That seems to fix resume support a treat :)

I can't boot normally with that initramfs though (black screen and no network connectivity) but that's definitely something else entirely.
Comment 19 Amadeusz Żołnowski (RETIRED) gentoo-dev 2013-10-16 21:43:38 UTC
Thank you, Alexander!

+*dracut-034-r1 (16 Oct 2013)
+
+  16 Oct 2013; Amadeusz Żołnowski <aidecoe@gentoo.org> +dracut-034-r1.ebuild,
+  +files/034-0006-resume-fix-swap-detection-in-hostonly.patch:
+  Fixed bug #487322 (resume support in hostonly mode) and bug #486516
+  (redundant
+  inclusion of libs from lib32 directory).
+
+  Thanks to Alexander Tsoy <alexander@tsoy.me> for patch for bug #486516.
+
:
Comment 20 Dan Goodliffe 2013-10-17 14:21:50 UTC
Seems to work a treat, as you'd expect.
Thanks.