Currently, swsusp_resume (defaults/initrd.scripts) uses 'ls -l' to discover the major/minor device nodes for REAL_RESUME. If the user has an LVM swap partition and follows the normal naming conventions, they will pass '/dev/<volumegroup>/<logicalvolume>' as real_resume, which is a link and will not give the expected output, causing the resume to fail. Adding '-L' to the 'ls' invocation fixes that and does not deviate from the current behavior for normal (non-link) device names. No other modification is necessary. Following patch is whitespace-mangled but shows the modification. ######################### diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index ae22dd5..b63568d 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -858,7 +858,7 @@ rundebugshell() { swsusp_resume() { # determine swap resume partition - local device=$(ls -l "${REAL_RESUME}" | sed 's/\ */ /g' | cut -d \ -f 6-7 | sed 's/,\ */:/') + local device=$(ls -Ll "${REAL_RESUME}" | sed 's/\ */ /g' | cut -d \ -f 6-7 | sed 's/,\ */:/') [ -f /sys/power/resume ] && echo "${device}" > /sys/power/resume return 0 }
This has been fixed in git.
(In reply to comment #1) > This has been fixed in git. > one thoing though the output of that line regardeless of the -L presence doesn't give the majo/minor number but r:w (at lease on a live system not in the initramfs) cerberusi kenshin # ls -lH /dev/vg0/swap | sed 's/\ */ /g' | cut -d \ -f 6-7 | sed 's/,\ */:/' r w ls -lL /dev/vg0/swap brw-rw---- 1 root disk 254, 1 Jun 5 21:54 /dev/vg0/swap before dm-crypt/lvm resume worked perfectly but I guess that the result of this line didn't matter as I setup the default resume resume partion in kernel
(In reply to comment #2) > (In reply to comment #1) > > This has been fixed in git. > > > > one thoing though the output of that line regardeless of the -L presence > doesn't give the majo/minor number but r:w (at lease on a live system not in > the initramfs) > cerberusi kenshin # ls -lH /dev/vg0/swap | sed 's/\ */ /g' | cut -d \ -f 6-7 | > sed 's/,\ */:/' > r w > > ls -lL /dev/vg0/swap > brw-rw---- 1 root disk 254, 1 Jun 5 21:54 /dev/vg0/swap > > before dm-crypt/lvm resume worked perfectly but I guess that the result of this > line didn't matter as I setup the default resume resume partion in kernel > ls -lH /dev/vg0/swap | sed 's/\ \+/ /g' | cut -d \ -f 5-6 |sed 's/,\ /:/' works perfectly
Are both of you testing this with the busybox binaries that are actually part of the initrd environment? I started down the path of comment #3, but arrived at my original solution by testing with the generated environment in a chroot.
Meh, for some reason I saw two posters. Regardless, I'm doing dm-crypt/lvm resume right now with this fix with no issue. Can you elaborate what your setup is and what error you're seeing?
i did not read this bug-report before, but ran into the same problem. my solution was ls -lL "${REAL_RESUME}" | sed 's/\ */ /g' | cut -d \ -f 5-6 | sed 's/,\ */:/' tested with busybox ls.
I'm confused about what the actual issue is here. I don't use this feature, so I can't test it myself.
the actual issue was the missing '-L' option for ls. resume with /dev/mapper/vg0-swap was possible, while /dev/vg0/swap was not. it seems that after some time (between comment #1 and #2) the output format of busybox ls changed, so resuming with real_resume=... broke. this may be a completely new bug-report, but the same line was affected and it is still open ;-) both the solutions presented in comments #3 and #6 are working on my box.
What's the point of this? Is it just getting the "real" device that the symlink points to? Is there any reason we can't use readlink here?
you cannot be sure that real_resume is a symlink. it may be something like /dev/sdb1, too. the solutions provided above don't care, whether it's a link, or the real device. what's needed is major/minor of the blockdevie to resume from.
Created attachment 198499 [details, diff] foo I came up with an alternative solution that's a little "cleaner". I'm attaching the patch, but it's also in git. Please test it by emerging genkernel-9999.
I'm indifferent as what work you do to get the actual device name (be that ls -L or get_real_filename), but AFAICT the solution needs to provide the device in the "major:minor" format, which the proposed patch does not yet do.
Then I misunderstood what the code was doing. I've reverted to the previous commit, where I applied the solution from comment 6.
(In reply to comment #13) > I've reverted to the previous commit, where I applied the solution from comment 6. Due to the date of the last comment on this bug I assume that feature to be included in 3.4.10.907 or an earlier release of genkernel. Closing, please re-open as needed.