Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--set-startup won't work #11

Closed
0xFFFFFFFFFFFFFFFFFF opened this issue Nov 20, 2018 · 10 comments
Closed

--set-startup won't work #11

0xFFFFFFFFFFFFFFFFFF opened this issue Nov 20, 2018 · 10 comments

Comments

@0xFFFFFFFFFFFFFFFFFF
Copy link

The command sudo optimus-manager --set-startup nvidia does not work for me. Switching manually with optimus-manager --switch nvidia works, though. I am using Arch Linux with kernel 4.19.2-arch1-1, nvidia-410.73-3, lightdm-1:1.28.0-1, xfce4 4.12.1-8 and optimus-manager-0.2-2.

$ cat /etc/X11/xorg.conf.d/10-optimus-manager.conf 
Section "Module"
	Load "modesetting"
EndSection

Section "Device"
	Identifier "nvidia"
	Driver "nvidia"
	BusID "01:00:0"
	Option "AllowEmptyInitialConfiguration"
	Option "Coolbits" "28"
	Option "DRI" "3"
EndSection
$ cat /etc/lightdm/lightdm.conf.d/10-optimus-manager.conf 
[Seat:*]
display-setup-script=/usr/bin/optimus-manager_Xsetup
$ systemctl status optimus-manager.service
● optimus-manager.service - Optimus Manager
   Loaded: loaded (/usr/lib/systemd/system/optimus-manager.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-11-20 17:35:58 CET; 14min ago
 Main PID: 567 (python)
    Tasks: 1 (limit: 4915)
   Memory: 30.5M
   CGroup: /system.slice/optimus-manager.service
           └─567 /usr/bin/python -u /usr/bin/optimus-manager-daemon --startup

Nov 20 17:35:59 arch python[567]: Error : Cannot find /usr/share/sddm/scripts/Xsetup
Nov 20 17:35:59 arch python[567]: Awaiting commands
Nov 20 17:36:26 arch python[567]: Received command : nvidia
Nov 20 17:36:26 arch python[567]: Stopping login manager
Nov 20 17:36:26 arch python[567]: Switching to Nvidia
Nov 20 17:36:26 arch python[567]: Loading Nvidia modules
Nov 20 17:36:26 arch python[567]: Configuring Xorg...
Nov 20 17:36:26 arch python[567]: Configuring login managers..
Nov 20 17:36:26 arch python[567]:         Configuring LightDM
Nov 20 17:36:26 arch python[567]: Restarting login manager

As you can see, I switched the mode manually which shows up in the systemd status report. I also tried creating the configuration /etc/optimus-manager.conf with this content:

[optimus]
login_manager=lightdm

I thought the script couldn't find out I am using lightdm, but this also didn't work. X11 config's are cleaned up, bumblebeed.service is disabled and the bbswitch module isn't loaded.

@NerosTie
Copy link

Same bug: #3

@0xFFFFFFFFFFFFFFFFFF
Copy link
Author

Same bug: #3

Actually it isn't. If you take a closer look at the systemd log, you can see that the script doesn't even recognize my lightdm setup. In contrast to #3.

@Askannz
Copy link
Owner

Askannz commented Nov 21, 2018

you can see that the script doesn't even recognize my lightdm setup.

What do you mean ? The log does mention
Nov 20 17:36:26 arch python[567]: Configuring LightDM

If you are referring to
Nov 20 17:35:59 arch python[567]: Error : Cannot find /usr/share/sddm/scripts/Xsetup
it's a bug that slipped in the latest release. Should not affect your problem.

Could you post the full log (with journalctl -u optimus-manager -b0) instead of the unit status ? There could be something happening early. In fact, it may be related to a similar bug I'm investigating on my setup.

Thank you for your patience ; I can't dedicate too much time to the project this week but I'm definitely working on it.

@Askannz
Copy link
Owner

Askannz commented Nov 21, 2018

Good news : I'm 90% sure to have found the source of the problem. And the problem is that I am an idiot.

I configured the optimus-manager systemd service to start before the login manager, so it can configure Xorg and kernel modules in advance. What I didn't realize is that it gives no guarantee that the daemon will have finished its job before the X has started.

So this leads to this weird race condition where sometimes the X server will use the autogenerated config, sometimes not. It may depend on your hardware and that's why I couldn't reproduce it. I can reproduce it now by adding an artificial delay to the daemon.

I have a fix in mind for that but it will have to wait for a bit.

@0xFFFFFFFFFFFFFFFFFF
Copy link
Author

you can see that the script doesn't even recognize my lightdm setup.

What do you mean ? The log does mention
Nov 20 17:36:26 arch python[567]: Configuring LightDM

The log starting from Nov 20 17:36:26 is not related to --set-startup nvidia but --switch nvidia. Thanks for your support. I will try 812f3b9 soon. Btw, journalctl -u optimus-manager -b0 gives me the same log.

@Askannz
Copy link
Owner

Askannz commented Nov 22, 2018

The commit 812f3b9 was an attempt at fixing the problem, but it's not really functional yet (hence why it's in a separate branch). I got a better idea that's more in line with the philosophy of systemd, I'll try to implement it asap.

@Askannz
Copy link
Owner

Askannz commented Nov 22, 2018

@kuba1909 Could you please test this branch ? https://github.com/Askannz/optimus-manager/tree/pre_post_exec

I made you a PKGBUILD : https://pastebin.com/XqtL7445

This fix works on my end and is a much much much better approach.

EDIT : Sorry, I created the branch but forgot to push to it 🤦‍♂️ It's good now.

@0xFFFFFFFFFFFFFFFFFF
Copy link
Author

I built the package with your PKGBUILD, it works perfectly now. 😄

@Askannz
Copy link
Owner

Askannz commented Nov 22, 2018

Great ! Gonna merge it then.

@Askannz
Copy link
Owner

Askannz commented Nov 22, 2018

It's merged. Going to add a few more fixes and features and then publish a new version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants