Bug 1744154

Summary: tlp-sleep service stop working after tlp upgrade to tlp-1.2.2-1
Product: [Fedora] Fedora Reporter: aleksey.tretya <aleksey.tretyak>
Component: tlpAssignee: Jeremy Newton <alexjnewt>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 30CC: 24michaelpartridge, afreeman, alexjnewt, blbenyamin9, mateusz, michael.scheiffler, mihai, oliver, robert
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: tlp-1.2.2-4.fc30 tlp-1.2.2-4.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-01-12 01:15:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
tlp-1.2.1-1.fc30
none
tlp-1.2.2-1.fc30 none

Description aleksey.tretya@gmail.com 2019-08-21 13:06:33 UTC
Description of problem:

After upgrading tlp package from tlp-1.2.1-1.fc30.noarch to tlp-1.2.2-1.fc30.noarch, tlp-sleep service start failing on suspend. Downgrade to tlp-1.2.1-1.fc30.noarch fixes problem. The issue is reproduced on Thinkpad t480 and Thinkpad x220
 

> systemctl status tlp-sleep.service
 
● tlp-sleep.service - TLP suspend/resume
   Loaded: loaded (/usr/lib/systemd/system/tlp-sleep.service; enabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: https://linrunner.de/tlp

Aug 19 13:23:40 localhost.localdomain systemd[1]: Failed to start TLP suspend/resume.
Aug 19 14:51:08 localhost.localdomain systemd[1]: Starting TLP suspend/resume...
Aug 19 14:51:08 localhost.localdomain systemd[1]: tlp-sleep.service: Main process exited, code=exited, status=1/FAILURE
Aug 19 14:51:08 localhost.localdomain systemd[1]: tlp-sleep.service: Failed with result 'exit-code'.
Aug 19 14:51:08 localhost.localdomain systemd[1]: Failed to start TLP suspend/resume.

> journalctl -u tlp-sleep

Aug 19 14:51:08 localhost.localdomain systemd[1]: Starting TLP suspend/resume...
Aug 19 14:51:08 localhost.localdomain systemd[1]: tlp-sleep.service: Main process exited, code=exited, status=1/FAILURE
Aug 19 14:51:08 localhost.localdomain systemd[1]: tlp-sleep.service: Failed with result 'exit-code'.
Aug 19 14:51:08 localhost.localdomain systemd[1]: Failed to start TLP suspend/resume.



Version-Release number of selected component (if applicable): tlp-1.2.2-1


Steps to Reproduce:
1. Install tlp-1.2.2-1.fc30.noarch
2. Enable tlp, tlp-sleep service
3. Close laptop lid to suspend system and open it up
4. Observe service status

Actual results:
tlp-sleep service failed to start

Expected results:
tlp-sleep service successfully started

Additional info:
tpl was used with default settings, reproduced with AC connected and without.

Comment 2 ThinkPad 2019-09-03 20:29:38 UTC
Experiencing same issue on ThinkPad X390.

Comment 3 Mateusz Kowalski 2019-09-20 18:56:57 UTC
I can provide more debug info about the issue, Fedora 30 on Lenovo Thinkpad X1 Carbon 6th gen. is also affected, but I do not think this is strictly related with the issue. I'm attaching strace of `/usr/sbin/tlp suspend` using both tlp-1.2.1-1.fc30 and tlp-1.2.2-1.fc30, below outlining the most important observation.

One of the last important calls in the broken version is

```
openat(AT_FDCWD, "/var/lib/tlp/rfkill_saved", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1 ENOENT (No such file or directory)
```

Equivalent call in the working version is

```
openat(AT_FDCWD, "/run/tlp/rfkill_saved", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
```

Please do note difference in the paths referencing `rfkill_saved`. I can see on my system the latter is indeed a correct path whereas the former is wrong

```
$ cat /run/tlp/rfkill_saved 
bluetooth 1
wwan 254
$ cat /var/lib/tlp/rfkill_saved
cat: /var/lib/tlp/rfkill_saved: No such file or directory
```

Comment 4 Mateusz Kowalski 2019-09-20 18:57:46 UTC
Created attachment 1617294 [details]
tlp-1.2.1-1.fc30

Comment 5 Mateusz Kowalski 2019-09-20 18:58:06 UTC
Created attachment 1617295 [details]
tlp-1.2.2-1.fc30

Comment 6 Mateusz Kowalski 2019-09-20 19:17:46 UTC
Also, an issue in the TLP project itself has been opened - https://github.com/linrunner/TLP/issues/434.

Comment 7 Fedora Update System 2020-01-03 16:03:32 UTC
FEDORA-2020-992ebfa170 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2020-992ebfa170

Comment 8 Fedora Update System 2020-01-03 16:03:33 UTC
FEDORA-2020-1bac9f5326 has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-1bac9f5326

Comment 9 Fedora Update System 2020-01-04 21:18:30 UTC
tlp-1.2.2-4.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-992ebfa170

Comment 10 Fedora Update System 2020-01-04 22:24:44 UTC
tlp-1.2.2-4.fc31 has been pushed to the Fedora 31 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-1bac9f5326

Comment 11 Benyamin Limanto 2020-01-06 05:02:17 UTC
(In reply to Fedora Update System from comment #10)
> tlp-1.2.2-4.fc31 has been pushed to the Fedora 31 testing repository. If
> problems still persist, please make note of it in this bug report.
> See https://fedoraproject.org/wiki/QA:Updates_Testing for
> instructions on how to install test updates.
> You can provide feedback for this update here:
> https://bodhi.fedoraproject.org/updates/FEDORA-2020-1bac9f5326

On fedora 31 XFCE Spin, the version 1.2.2-4 still have the problem. I solve it by seeing the tlp 1.2.2 github problem on folder /var/lib/tlp isn't created, after I create the folder then i must restorecon /var/lib/tlp to the folder, as for the context is already on semanage list. 


[ben@thinkpad ~]$ sudo mkdir /var/lib/tlp
[sudo] password for ben: 
[ben@thinkpad ~]$ sudo systemctl start tlp-sleep
Job for tlp-sleep.service failed because the control process exited with error code.
See "systemctl status tlp-sleep.service" and "journalctl -xe" for details.
[ben@thinkpad ~]$ journalctl -xe | grep tlp
-- Subject: A start job for unit tlp-sleep.service has begun execution
-- A start job for unit tlp-sleep.service has begun execution.
Jan 06 09:47:25 thinkpad.localdomain systemd[1]: tlp-sleep.service: Main process exited, code=exited, status=1/FAILURE
-- An ExecStart= process belonging to unit tlp-sleep.service has exited.
Jan 06 09:47:25 thinkpad.localdomain systemd[1]: tlp-sleep.service: Failed with result 'exit-code'.
-- The unit tlp-sleep.service has entered the 'failed' state with result 'exit-code'.
-- Subject: A start job for unit tlp-sleep.service has failed
-- A start job for unit tlp-sleep.service has finished with a failure.
Jan 06 09:47:25 thinkpad.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Jan 06 11:46:30 thinkpad.localdomain sudo[7893]:      ben : TTY=pts/0 ; PWD=/home/ben ; USER=root ; COMMAND=/usr/bin/systemctl status tlp-sleep
Jan 06 11:46:38 thinkpad.localdomain sudo[7904]:      ben : TTY=pts/0 ; PWD=/home/ben ; USER=root ; COMMAND=/usr/bin/systemctl start tlp
Jan 06 11:46:47 thinkpad.localdomain sudo[7914]:      ben : TTY=pts/0 ; PWD=/home/ben ; USER=root ; COMMAND=/usr/bin/systemctl start tlp-sleep
-- Subject: A start job for unit tlp-sleep.service has begun execution
-- A start job for unit tlp-sleep.service has begun execution.
Jan 06 11:46:47 thinkpad.localdomain systemd[1]: tlp-sleep.service: Main process exited, code=exited, status=1/FAILURE
-- An ExecStart= process belonging to unit tlp-sleep.service has exited.
Jan 06 11:46:47 thinkpad.localdomain systemd[1]: tlp-sleep.service: Failed with result 'exit-code'.
-- The unit tlp-sleep.service has entered the 'failed' state with result 'exit-code'.
-- Subject: A start job for unit tlp-sleep.service has failed
-- A start job for unit tlp-sleep.service has finished with a failure.
Jan 06 11:46:47 thinkpad.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
Jan 06 11:54:50 thinkpad.localdomain sudo[8839]:      ben : TTY=pts/0 ; PWD=/home/ben ; USER=root ; COMMAND=/usr/bin/mkdir /var/lib/tlp
Jan 06 11:55:05 thinkpad.localdomain sudo[8852]:      ben : TTY=pts/0 ; PWD=/home/ben ; USER=root ; COMMAND=/usr/bin/systemctl start tlp-sleep
-- Subject: A start job for unit tlp-sleep.service has begun execution
-- A start job for unit tlp-sleep.service has begun execution.
Jan 06 11:55:05 thinkpad.localdomain audit[8856]: AVC avc:  denied  { create } for  pid=8856 comm="tlp" name="rfkill_saved" scontext=system_u:system_r:tlp_t:s0 tcontext=system_u:object_r:var_lib_t:s0 tclass=file permissive=0
Jan 06 11:55:05 thinkpad.localdomain systemd[1]: tlp-sleep.service: Main process exited, code=exited, status=1/FAILURE
-- An ExecStart= process belonging to unit tlp-sleep.service has exited.
Jan 06 11:55:05 thinkpad.localdomain systemd[1]: tlp-sleep.service: Failed with result 'exit-code'.
-- The unit tlp-sleep.service has entered the 'failed' state with result 'exit-code'.
-- Subject: A start job for unit tlp-sleep.service has failed
-- A start job for unit tlp-sleep.service has finished with a failure.
Jan 06 11:55:05 thinkpad.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=tlp-sleep comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
[ben@thinkpad ~]$ sudo semanage fcontext -l | grep tlp_var_lib_t
/var/lib/tlp(/.*)?                                 all files          system_u:object_r:tlp_var_lib_t:s0 
[ben@thinkpad ~]$ sudo restorecon /var/lib/tlp/
[ben@thinkpad ~]$ ls -lZ /var/lib/tlp/
total 0
[ben@thinkpad ~]$ ls -ldZ /var/lib/tlp/
drwxr-xr-x. 2 root root unconfined_u:object_r:tlp_var_lib_t:s0 6 Jan  6 11:54 /var/lib/tlp/
[ben@thinkpad ~]$ sudo systemctl restart tlp-sleep
[ben@thinkpad ~]$

Comment 12 Fedora Update System 2020-01-12 01:15:54 UTC
tlp-1.2.2-4.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 13 Fedora Update System 2020-01-12 01:42:50 UTC
tlp-1.2.2-4.fc31 has been pushed to the Fedora 31 stable repository. If problems still persist, please make note of it in this bug report.