Bug 6839 - Hibernate to swap file is broken after the recent updates of e2fsprogs
: Hibernate to swap file is broken after the recent updates of e2fsprogs
Status: VERIFIED FIXED
Product: Desktop Bugs
Classification: ROSA Desktop
Component: Main Packages
: Fresh
: All Linux
: High normal
: ---
Assigned To: ROSA Linux Bugs
: ROSA Linux Bugs
:
Depends on:
Blocks: 6840
  Show dependency treegraph
 
Reported: 2016-03-13 21:47 MSK by Eugene Shatokhin
Modified: 2016-03-21 17:17 MSK (History)
4 users (show)

See Also:
RPM Package:
ISO-related:
Bad POT generating:
Upstream:
vladimir.potapov: qa_verified+
konstantin.vlasov: published+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Shatokhin 2016-03-13 21:47:38 MSK
I have seen the problem on this system but it should not be hardware-specific:

http://hw.rosalinux.ru/index.php?probe=7e748b4ceb

It seems, the output format of 'filefrag' command has changed and the resume_offset is incorrectly determined by update-grub2 as a result (filefrag is used in /etc/grub.d/10_linux).

So, an incorrect offset is specified in the kernel command line and the system fails to hibernate to a swap file.

e2fsprogs 1.42.5:
# filefrag -v /swap | head
Filesystem type is: ef53
File size of /swap is 5748817920 (1403520 blocks, blocksize 4096)
 ext logical physical expected length flags
   0       0    34816           32768 
   1   32768    67584           30720
...

e2fsprogs 1.42.13:
# filefrag -v /swap | head
Filesystem type is: ef53
File size of /swap is 3150446592 (769152 blocks of 4096 bytes)
 ext:     logical_offset:        physical_offset: length:   expected: flags:
   0:        0..   32767:      34816..     67583:  32768:
   1:    32768..   63487:      67584..     98303:  30720:
...

34816 is the correct offset but /etc/grub.d/10_linux gets "32767:".

resume_offset is determined in /etc/grub.d/10_linux as follows:

RESUME_OFFSET=$(filefrag -v $SWAP_DEV| grep -E '^\s+0.*0' | awk '{print $3}')
where $SWAP_DEV is "/swap".
Comment 1 Eugene Shatokhin 2016-03-13 21:49:18 MSK
Setting importance to "High" because the bug breaks important functionality of the system.
Comment 2 Eugene Shatokhin 2016-03-14 12:29:07 MSK
Something like this should help:

/etc/grub.d/10_linux:

- RESUME_OFFSET=$(filefrag -v $SWAP_DEV| grep -E '^\s+0.*0' | awk '{print $3}')
+ RESUME_OFFSET=$(filefrag -v $SWAP_DEV| grep -E '^\s+0.*0' | awk -F '[ \t.]+' '{print $5}')

Besides, it may be also worth it to add explicit dependency on e2fsprogs >= 1.42.13 to grub2 package because that fix for resume_offset will not work with filefrag from the old version of e2fsprogs.
Comment 3 Andrey Bondrov 2016-03-15 12:13:11 MSK
(In reply to comment #2)
> Something like this should help:
> 
> /etc/grub.d/10_linux:
> 
> - RESUME_OFFSET=$(filefrag -v $SWAP_DEV| grep -E '^\s+0.*0' | awk '{print
> $3}')
> + RESUME_OFFSET=$(filefrag -v $SWAP_DEV| grep -E '^\s+0.*0' | awk -F '[
> \t.]+' '{print $5}')
> 
> Besides, it may be also worth it to add explicit dependency on e2fsprogs >=
> 1.42.13 to grub2 package because that fix for resume_offset will not work
> with filefrag from the old version of e2fsprogs.

Can you please add this fix and build?
Comment 4 Konstantin Vlasov 2016-03-15 14:11:28 MSK
Working on that. Unfortunately, the signing node went AWOL again...
Comment 5 Konstantin Vlasov 2016-03-16 02:24:56 MSK
https://abf.io/build_lists/2627432
https://abf.io/build_lists/2627433

Advisory: Fixed compatibility with e2fsprogs 1.42.13.
Comment 6 Eugene Shatokhin 2016-03-16 13:14:44 MSK
(In reply to comment #5)
> https://abf.io/build_lists/2627432
> https://abf.io/build_lists/2627433
> 
> Advisory: Fixed compatibility with e2fsprogs 1.42.13.

I have just checked it on x86_64: yes, the correct offset is written and hibernate/resume works again.

Thanks a lot!
Comment 7 Vladimir Potapov 2016-03-17 19:52:23 MSK
Please, send the update to testing!
Comment 8 Konstantin Vlasov 2016-03-17 19:57:39 MSK
Done.
Comment 9 Vladimir Potapov 2016-03-17 20:20:08 MSK
The update is sent to expanded testing
**************************************
Comment 10 Vladimir Potapov 2016-03-21 16:56:07 MSK
grub2-2.00-78
https://abf.io/build_lists/2627432
https://abf.io/build_lists/2627433
****************************** Advisory *****************************
Fixed compatibility with e2fsprogs 1.42.13
*********************************************************************
QA Verified