rnd-ash / razer-laptop-control

Project to create driver/software to control performance of razer laptops
GNU General Public License v2.0
344 stars 29 forks source link

Hangs at "Waiting for sysfs to be ready" #45

Open infinitnet opened 4 years ago

infinitnet commented 4 years ago
[user@host ~]$ razer-cli
Error. Socket doesn't exit. Is daemon running?
[user@host ~]$ sudo systemctl status razerdaemon.service -l
● razerdaemon.service - Razer laptop control daemon
     Loaded: loaded (/etc/systemd/system/razerdaemon.service; enabled; vendor preset: disabled)
     Active: active (running) since Mon 2020-08-17 10:04:17 CEST; 28min ago
   Main PID: 1065 (daemon)
      Tasks: 1 (limit: 19018)
     Memory: 1.1M
     CGroup: /system.slice/razerdaemon.service
             └─1065 /usr/share/razercontrol/daemon

Aug 16 20:57:18 host systemd[1]: Started Razer laptop control daemon.
Aug 16 20:57:18 host daemon[4284]: Waiting for sysfs to be ready
Aug 16 20:57:19 host daemon[4284]: Waiting for sysfs to be ready
Aug 16 20:57:20 host daemon[4284]: Waiting for sysfs to be ready

I'm on the latest Manjaro KDE using a Razer Blade 15 Advanced (early 2020 model) and running kernel 5.8. Would love to get this to work because the fans are way louder than I expected...

rnd-ash commented 4 years ago

I shall correct this. it's a simple 1 liner fix. I put that debug statement in place and forgot to add a line telling you that it is ready....if you are able to run the cli app then the Daemon is indeed ready

infinitnet commented 4 years ago

@rnd-ash Thanks for the quick response! Doesn't look like the daemon is ready though or at least razer-cli is unable to find/read its socket, in which case it would be awesome if you could let me know the best approach to debug this further. I'm using this AUR package https://aur.archlinux.org/packages/razer-laptop-control-git/

philippgerard commented 4 years ago

Same problem and logs here.

rnd-ash commented 4 years ago

I have added a debug message for when sysfs is ready...updated the AUR package as well to include the change

Please test and let me know if you see

Sysfs ready! Starting daemon

In your daemon logs

infinitnet commented 4 years ago

I built and installed the updated AUR package, reloaded systemd, restarted the razerdaemon and still run into exactly the same logs and CLI not working as above.

infinitnet commented 4 years ago

Oh, and something new just popped up as well:

Aug 19 12:31:47 host daemon[8597]: Waiting for sysfs to be ready
Aug 19 12:31:48 host daemon[8597]: Timed out waiting for sysfs after a minute!
Aug 19 12:31:48 host systemd[1]: razerdaemon.service: Main process exited, code=exited, status=1/FAILURE
Aug 19 12:31:48 host systemd[1]: razerdaemon.service: Failed with result 'exit-code'.
rnd-ash commented 4 years ago

can you run "lsmod | grep razer"?

infinitnet commented 4 years ago

Hmm yeah, kernel module doesn't seem to be loaded. I'm on 5.8.

rnd-ash commented 4 years ago

do you have the kernel module package installed? https://aur.archlinux.org/packages/razer-laptop-control-dkms-git/

infinitnet commented 4 years ago

Yes, it's a dependency of razer-laptop-control-git.

Anyway, I figured this out:

razer-laptop-control-dkms-git doesn't have headers of the running kernel as dependency, although it does depend on it. Installing them with pacman -S linux58-headers (in my case - depends on the kernel version of course) made the razer-laptop-control-dkms-git module finally load.

After a reboot, I still ran into this:

● razerdaemon.service - Razer laptop control daemon
     Loaded: loaded (/etc/systemd/system/razerdaemon.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Thu 2020-08-20 10:07:41 CEST; 59s ago
    Process: 1132 ExecStart=/usr/share/razercontrol/daemon (code=exited, status=101)
   Main PID: 1132 (code=exited, status=101)

Aug 20 10:07:41 host systemd[1]: Started Razer laptop control daemon.
Aug 20 10:07:41 host daemon[1132]: Sysfs ready! Starting daemon
Aug 20 10:07:41 host daemon[1132]: thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', src/driver_sysfs.rs:11:15
Aug 20 10:07:41 host daemon[1132]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aug 20 10:07:41 host systemd[1]: razerdaemon.service: Main process exited, code=exited, status=101/n/a
Aug 20 10:07:41 host systemd[1]: razerdaemon.service: Failed with result 'exit-code'.

After manually restarting the daemon, it was finally running fine and the CLI was working as well.

So in conclusion what should be done here is:

1.) Add headers package of running kernel as a dependency to the razer-laptop-control-dkms-git AUR package

2.) [I just assume this is the cause of the error:] Delay the launch of the daemon a little (like ExecStartPre=/bin/sleep 15) so all kernel modules and drivers it depends on are actually ready. Or, if you want to do it the "clean" way, work on After= in the [Unit] section of your systemd script.

Thanks for making it possible to run all this on Linux btw. :)

rnd-ash commented 4 years ago

did you rebuild initramfs with mkinitcpio?

infinitnet commented 4 years ago

Not manually, no. I never really customized my current system. It's a default Manjaro KDE setup. Manjaro is sort of based on Arch and I did find this: https://www.archlinux.org/news/new-kernel-packages-and-mkinitcpio-hooks/ Although there are differences in Arch and Manjaro kernels, this sounds like they likely use mkinitcpio currently, yes.

rnd-ash commented 4 years ago

Hmm, exactly what hardware ID are you running? - run

lsusb | grep Razer
infinitnet commented 4 years ago

@rnd-ash

[user@host ~]$ lsusb | grep Razer
Bus 001 Device 006: ID 1532:0253 Razer USA, Ltd RZ09-0330, Gaming Laptop [Blade 15 Advanced (Early 2020)]
rnd-ash commented 4 years ago

interesting. driver should load on your device. can you run

dmesg | grep razer
infinitnet commented 4 years ago

It does work for me. :) I just have to manually restart the daemon in order to get it to work like I explained in this response https://github.com/rnd-ash/razer-laptop-control/issues/45#issuecomment-677455747 .. Ie. if I reboot, I get the error described in https://github.com/rnd-ash/razer-laptop-control/issues/45#issuecomment-677455747 but if I then just run systemctl restart razerdaemon.service it works fine. The daemon just tries to start too early or something where not all its dependencies are met.

phush0 commented 4 years ago

I have same problem from time to time. I just restart service and everything is ok again.

infinitnet commented 3 years ago

Same issue seems to exist again on kernel 5.9 and restarting razerdaemon.service doesn't fix it this time.

[user@host ~]$ uname -a
Linux host 5.9.1-1-MANJARO #1 SMP PREEMPT Sat Oct 17 11:44:44 UTC 2020 x86_64 GNU/Linux
[user@host ~]$ lsusb | grep Razer
Bus 001 Device 005: ID 1532:0253 Razer USA, Ltd RZ09-0330, Gaming Laptop [Blade 15 Advanced (Early 2020)]
[user@host ~]$ lsmod | grep razer
[user@host ~]$ sudo dmesg | grep razer
[   47.740962] audit: type=1131 audit(1603182009.405:76): pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=razerdaemon comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
[  154.624967] audit: type=1130 audit(1603182115.879:90): pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=razerdaemon comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[  184.644016] audit: type=1131 audit(1603182145.898:113): pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=razerdaemon comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
[user@host ~]$ sudo systemctl status razerdaemon.service
● razerdaemon.service - Razer laptop control daemon
     Loaded: loaded (/etc/systemd/system/razerdaemon.service; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2020-10-20 10:22:25 CEST; 14s ago
    Process: 3040 ExecStart=/usr/share/razercontrol/daemon (code=exited, status=1/FAILURE)
   Main PID: 3040 (code=exited, status=1/FAILURE)

Okt 20 10:22:18 host daemon[3040]: Waiting for sysfs to be ready
Okt 20 10:22:19 host daemon[3040]: Waiting for sysfs to be ready
Okt 20 10:22:20 host daemon[3040]: Waiting for sysfs to be ready
Okt 20 10:22:21 host daemon[3040]: Waiting for sysfs to be ready
Okt 20 10:22:22 host daemon[3040]: Waiting for sysfs to be ready
Okt 20 10:22:23 host daemon[3040]: Waiting for sysfs to be ready
Okt 20 10:22:24 host daemon[3040]: Waiting for sysfs to be ready
Okt 20 10:22:25 host daemon[3040]: Timed out waiting for sysfs after a minute!
Okt 20 10:22:25 host systemd[1]: razerdaemon.service: Main process exited, code=exited, status=1/FAILURE
Okt 20 10:22:25 host systemd[1]: razerdaemon.service: Failed with result 'exit-code'.
rnd-ash commented 3 years ago

Thats odd, I just upgrades to 5.9.1 and am not seeing any issue (Driver loads as expected).

Did you rebuild your DKMS tree?

Run lsmod | grep razer and see if the razercontrol module got loaded. If it hasn't been loaded, you need to work out how to rebuild the module

infinitnet commented 3 years ago

Did you rebuild your DKMS tree?

I didn't. Sorry man, all working now.

Ashiix commented 3 years ago

I'm having the same exact issue. Running on a Blade Pro. Razer USA, Ltd Gaming Laptop [Blade Pro (Late 2019)]

Same issue. Running 5.9.10-arch1-1.

TANZMUSIK commented 3 years ago

I'm having the same exact issue. Running on a Blade Pro. Razer USA, Ltd Gaming Laptop [Blade Pro (Late 2019)]

Same issue. Running 5.9.10-arch1-1.

1.) rebuild https://aur.archlinux.org/packages/razer-laptop-control-dkms-git 2.) reboot 3.) profit

pyryjook commented 3 years ago

I have the same issue on fresh Late 2020 Blade Stealth and freshly installed razer-laptop-control

$ lsusb | grep Razer
Bus 003 Device 003: ID 1532:0259 Razer USA, Ltd Razer Blade

$ uname -r
5.9.11-3-MANJARO

Late 2020 model not supported yet, I presume?

stormDE commented 2 years ago

Hi, for me i fix this issue: after installing the driver, just deactivate your secureboot in your uefi then boot your os (you can see your keyboard lights are activated) and activate secureboot again. i had the same bahviour and i assume something is not doing right with activated secureboot.