Bug 919095 - Systemd hibernates although no correct kernel available for resume
Summary: Systemd hibernates although no correct kernel available for resume
Status: RESOLVED FIXED
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: Basesystem (show other bugs)
Version: 13.2
Hardware: Other Other
: P5 - None : Major (vote)
Target Milestone: ---
Assignee: systemd maintainers
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-23 16:46 UTC by Forgotten User xRcrmyYBVX
Modified: 2016-04-28 06:33 UTC (History)
5 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Forgotten User xRcrmyYBVX 2015-02-23 16:46:15 UTC
There is a bug in the '/usr/bin/systemd-sleep-grub' bash script. This script should be checking if there is a correct kernel available for hibernate+resume.

It is supposed to have an exit code of 1 if no valid kernel is found.

But actually this does not work, see:
-----------
# /usr/bin/systemd-sleep-grub pre
INFO: running prepare-grub
  Skipping grub entry #2, because it has the noresume option
  Skipping grub entry #4, because it has the noresume option
WARNING: no kernelfile matching the running kernel found
running kernel: '3.16.7-11.gb26a99a-desktop', probably booting kernel: '3.16.7-48.g267ab8f-desktop'
ERROR: kernel version mismatch, cannot suspend to disk
/usr/bin/systemd-sleep-grub: line 175: $INHIBIT: ambiguous redirect
# echo $?
0
-----------

First, note that the variable $INHIBIT is undefined. This is bad, but not the problem here!

The problem is this part of the code:
-----------
###### main()

if [ "$1" = pre ] ; then
                prepare-grub
fi
if [ "$1" = post ] ; then
                grub-once-restore
fi
-----------

Although the function "prepare-grub" returns RET=1, the complete script returns exit code 0 because the following if statement completes successfully!

The script should be changed to:
-----------
###### main()

if [ "$1" = pre ] ; then
                prepare-grub
elif [ "$1" = post ] ; then
                grub-once-restore
fi
-----------
in order to return the correct exit code!
Comment 1 Bernhard Wiedemann 2015-02-23 17:46:14 UTC
good analysis.

An alternative approach would be
prepare-grub || exit 7
making the intended exit-code-passing more obvious
Comment 2 Thomas Blume 2015-02-24 14:48:56 UTC
Thanks for the hints.
I've build testpackages at:

http://download.opensuse.org/repositories/home:/tsaupe:/branches:/Base:/System:/Legacy:/bsc919095/openSUSE_13.2/

Please test and confirm that it fixes the bug.
Comment 3 Thomas Blume 2015-03-18 09:41:08 UTC
Checked and confirmed locally:

-->--
# /usr/bin/systemd-sleep-grub pre
INFO: running prepare-grub
  Skipping grub entry #3, because it has the noresume option
  Skipping grub entry #5, because it has the noresume option
WARNING: no kernelfile matching the running kernel found
running kernel: '3.16.6-2-desktop', probably booting kernel: '3.16.7-7-desktop'
ERROR: kernel version mismatch, cannot suspend to disk
# echo $?
7
--<--

Request submitted to  Base:System:Legacy

-> closing as fixed
Comment 4 Forgotten User xRcrmyYBVX 2015-03-24 12:38:29 UTC
Thanks! Will this get into 13.2?
Clearing needinfo flag...
Comment 5 Thomas Blume 2015-03-24 15:09:46 UTC
(In reply to Joschi Brauchle from comment #4)
> Thanks! Will this get into 13.2?
> Clearing needinfo flag...

Yes, the maintenance request has been submitted too.
Comment 6 Bernhard Wiedemann 2015-03-24 16:00:09 UTC
This is an autogenerated message for OBS integration:
This bug (919095) was mentioned in
https://build.opensuse.org/request/show/292681 13.2 / systemd
Comment 7 Swamp Workflow Management 2015-04-01 20:04:59 UTC
openSUSE-RU-2015:0646-1: An update that has two recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 919095,921920
CVE References: 
Sources used:
openSUSE 13.2 (src):    systemd-210-25.16.1, systemd-mini-210-25.16.1
Comment 9 Swamp Workflow Management 2015-07-30 14:08:48 UTC
SUSE-RU-2015:1318-1: An update that has 15 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 906900,909358,919095,920195,921831,921898,921920,926169,927457,928265,931388,932284,933365,933512,934077
CVE References: 
Sources used:
SUSE Linux Enterprise Software Development Kit 12 (src):    systemd-210-68.2
SUSE Linux Enterprise Server 12 (src):    systemd-210-68.2
SUSE Linux Enterprise Desktop 12 (src):    systemd-210-68.2
Comment 10 Swamp Workflow Management 2016-02-03 14:46:36 UTC
openSUSE-RU-2016:0320-1: An update that has 146 recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 737690,742774,750845,818044,838475,841544,849870,852015,852021,852232,853293,854884,856389,856392,856858,857204,858864,859072,859365,860574,860937,861316,861489,863217,864745,864904,865834,866732,866933,867128,867663,867664,867840,868019,868230,868439,868931,869142,869603,872929,873432,873444,874665,875502,876587,876694,877021,877674,878525,880438,880732,881125,881559,881942,882393,882714,883565,884271,884403,885232,885288,886211,886599,886852,888178,888215,888612,889297,889357,890977,892096,892162,892300,893797,895087,896664,897799,897801,897803,898233,898240,898432,900558,901481,902240,902901,903009,903963,904214,904517,904828,905550,906709,906900,907318,907393,908476,909358,910643,911347,912030,912334,913517,916420,918118,919095,920195,921831,921898,921920,926169,927250,927457,928265,931388,932284,933365,933512,933521,933533,934077,934901,937512,937900,938908,939571,940264,941576,944132,944799,945282,947212,948458,948555,948705,949574,949683,949739,950510,951265,951663,953241,954336,954781,955635,961576
CVE References: 
Sources used:
openSUSE 13.1 (src):    systemd-210-40.1, systemd-mini-210-40.1