Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1391212

Summary: Service fails if no switchable graphics present
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: switcheroo-controlAssignee: Kalev Lember <klember>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 25CC: bnocera, gmarr, klember, kwizart, mp.x, rc040203, sgallagh, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: AcceptedFreezeException
Fixed In Version: switcheroo-control-1.1-1.fc25 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-10 16:38:24 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:
Bug Depends On:    
Bug Blocks: 1277290    

Description Adam Williamson 2016-11-02 19:28:18 UTC
switcheroo-control is written to exit 1 if no switchable graphics hardware is present:

	/* Check for VGA switcheroo availability */
	fd = open (SWITCHEROO_SYSFS_PATH, O_WRONLY);
	if (fd < 0) {
		int err = errno;

		switch (err) {
		case EACCES:
			g_warning ("switcheroo-control needs to run as root");
			break;
		case ENOENT:
			g_debug ("No switcheroo support available");
			break;
		default:
			g_warning ("switcheroo-control could not query vga_switcheroo status: %s",
				   g_strerror (err));
		}
		return 1;
}

This means the switcheroo-control service will very commonly fail on boot. This is bad, we don't want failed services, they cause users to worry (and we have an openQA test that checks for them which will fail forever if this is not fixed). This should be tweaked somehow so the service isn't considered 'failed' when no switchable graphics are present.

Nominating as a freeze exception as I believe this is worth fixing for F25 Final and we're in freeze. There are several ways to fix this that shouldn't be too dangerous.

Comment 1 Zbigniew Jędrzejewski-Szmek 2016-11-02 22:56:03 UTC
Whoever patches this should get rid of the useless 'err' variable...

Comment 2 Bastien Nocera 2016-11-03 07:28:20 UTC
(In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> Whoever patches this should get rid of the useless 'err' variable...

It wouldn't be useless if errno wasn't thread-specific. Which it is. Bad habit.

Please file upstream bugs in the future.

Fixed both upstream.

Comment 3 Stephen Gallagher 2016-11-03 12:08:59 UTC
(In reply to Bastien Nocera from comment #2)
> (In reply to Zbigniew Jędrzejewski-Szmek from comment #1)
> > Whoever patches this should get rid of the useless 'err' variable...
> 
> It wouldn't be useless if errno wasn't thread-specific. Which it is. Bad
> habit.
> 
> Please file upstream bugs in the future.
> 
> Fixed both upstream.

Can you please link to the fixes here and update this ticket with the Koji build that resolves it?

We need to have a downstream ticket here because we're in Final Freeze and would need a Freeze Exception or Blocker status in order to pull this in.

Comment 4 Stephen Gallagher 2016-11-03 12:09:13 UTC
Oh, and +1 FE from me.

Comment 5 Bastien Nocera 2016-11-04 14:51:14 UTC
It will need release notes changes too. Where would I do that?

Comment 6 Fedora Update System 2016-11-04 17:13:06 UTC
switcheroo-control-1.1-1.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-3d2ba1299d

Comment 7 Fedora Update System 2016-11-05 19:00:57 UTC
switcheroo-control-1.1-1.fc25 has been pushed to the Fedora 25 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-2016-3d2ba1299d

Comment 8 Geoffrey Marr 2016-11-08 01:04:37 UTC
Discussed during the 2016-11-07 blocker review meeting: [1]

The decision was made to classify this bug as an AcceptedFreezeException.

[1] https://meetbot.fedoraproject.org/fedora-blocker-review/2016-11-07/f25-blocker-review.2016-11-07-17.01.txt

Comment 9 Fedora Update System 2016-11-10 16:38:24 UTC
switcheroo-control-1.1-1.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.

Comment 10 Ralf Corsepius 2016-11-11 06:18:43 UTC
*** Bug 1393759 has been marked as a duplicate of this bug. ***

Comment 11 ALI-S0 2018-02-01 11:31:42 UTC
(In reply to Fedora Update System from comment #7)
> switcheroo-control-1.1-1.fc25 has been pushed to the Fedora 25 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-2016-3d2ba1299d

I have the same problem 

```$ systemctl status switcheroo-control.service
● switcheroo-control.service - Switcheroo Control Proxy service
   Loaded: loaded (/usr/lib/systemd/system/switcheroo-control.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-02-01 13:51:15 +03; 27min ago
  Process: 957 ExecStart=/usr/sbin/switcheroo-control (code=exited, status=1/FAILURE)
 Main PID: 957 (code=exited, status=1/FAILURE)

Feb 01 13:51:12 localhost.localdomain systemd[1]: Starting Switcheroo Control Proxy service...
Feb 01 13:51:12 localhost.localdomain switcheroo-cont[957]: switcheroo-control could not query vga_switcheroo status: Opera
Feb 01 13:51:15 localhost.localdomain systemd[1]: switcheroo-control.service: Main process exited, code=exited, status=1/FA
Feb 01 13:51:15 localhost.localdomain systemd[1]: Failed to start Switcheroo Control Proxy service.
Feb 01 13:51:15 localhost.localdomain systemd[1]: switcheroo-control.service: Unit entered failed state.
Feb 01 13:51:15 localhost.localdomain systemd[1]: switcheroo-control.service: Failed with result 'exit-code'.```

and dmesg error

```
[    0.050375] ACPI Exception: Could not find/resolve named package element: AMD3 (20170728/dspkginit-381)
[    0.050406] ACPI Exception: Could not find/resolve named package element: AMD2 (20170728/dspkginit-381)
[    0.050431] ACPI Exception: Could not find/resolve named package element: AMD3 (20170728/dspkginit-381)
[    3.207193] kfd kfd: kgd2kfd_probe failed
[    3.210211] ACPI Error: [\_SB_.PCI0.GFX0.DD02._BCL] Namespace lookup failure, AE_NOT_FOUND (20170728/psargs-364)
[    3.210218] ACPI Error: Method parse/execution failed \_SB.PCI0.RP05.PEGP.DD02._BCL, AE_NOT_FOUND (20170728/psparse-550)
[  141.664156] sd 4:0:0:0: [sdb] No Caching mode page found
[  141.664160] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[Fedora@localhost ~]$ dmesg | grep -i switcheroo
[    2.937126] vga_switcheroo: detected switching method \_SB_.PCI0.GFX0.ATPX handle
[    2.971667] vga_switcheroo: enabled```