Skip to main content
Topic: Bumblebee early launch (Read 652 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Bumblebee early launch

It often happens that after turning on the laptop before starting the x-server, the cooler goes to maximum speed. This is cured by restarting bumblebeed or waiting (usually 4-5 minutes) for the fan to calm down. But it's inconvenient...

Can dinit start bumblebeed as early as possible?

Re: Bumblebee early launch

Reply #1
/var/log/dinit/bumblebeed.log was complaining about a missing module for the kernel.

Code: [Select]
user@host> ls /lib/modules/6.1.38-hardened1-1-hardened                                                                                             ~
итого 16212
drwxr-xr-x  4 root root     4096 июл 13 09:00 .
drwxr-xr-x  3 root root     4096 июл  8 17:02 ..
drwxr-xr-x 21 root root     4096 июл  8 17:02 build
drwxr-xr-x 13 root root     4096 июл  8 17:01 kernel
-rw-r--r--  1 root root  1517915 июл 13 09:00 modules.alias
-rw-r--r--  1 root root  1493967 июл 13 09:00 modules.alias.bin
-rw-r--r--  1 root root     9051 июл  6 18:30 modules.builtin
-rw-r--r--  1 root root     6897 июл 13 09:00 modules.builtin.alias.bin
-rw-r--r--  1 root root    11022 июл 13 09:00 modules.builtin.bin
-rw-r--r--  1 root root    71279 июл  6 18:30 modules.builtin.modinfo
-rw-r--r--  1 root root   765915 июл 13 09:00 modules.dep
-rw-r--r--  1 root root  1012705 июл 13 09:00 modules.dep.bin
-rw-r--r--  1 root root      475 июл 13 09:00 modules.devname
-rw-r--r--  1 root root   229089 июл  6 18:30 modules.order
-rw-r--r--  1 root root     1857 июл 13 09:00 modules.softdep
-rw-r--r--  1 root root   624589 июл 13 09:00 modules.symbols
-rw-r--r--  1 root root   765348 июл 13 09:00 modules.symbols.bin
-rw-r--r--  1 root root       15 июл  6 18:30 pkgbase
-rw-r--r--  1 root root 10044896 июл  6 18:30 vmlinuz
But bbswitch is loaded...
Code: [Select]
user@host> lsmod | grep bb                                                                                                                         ~
bbswitch               24576  0
Reinstalled bbswitch-dkms
Code: [Select]
user@host> sudo pacman -S bbswitch-dkms                                                                                             ~
warning: bbswitch-dkms-0.8-606 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (1) bbswitch-dkms-0.8-606

Total Installed Size:  0.02 MiB
Net Upgrade Size:      0.00 MiB

:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring                                                            [####################################################] 100%
(1/1) checking package integrity                                                          [####################################################] 100%
(1/1) loading package files                                                               [####################################################] 100%
(1/1) checking for file conflicts                                                         [####################################################] 100%
(1/1) checking available disk space                                                       [####################################################] 100%
:: Running pre-transaction hooks...
(1/1) Remove upgraded DKMS modules
==> dkms remove bbswitch/0.8
:: Processing package changes...
(1/1) reinstalling bbswitch-dkms                                                          [####################################################] 100%
:: Running post-transaction hooks...
(1/2) Install DKMS modules
==> dkms install --no-depmod bbswitch/0.8 -k 6.1.38-hardened1-1-hardened
Error! Bad return status for module build on kernel: 6.1.38-hardened1-1-hardened (x86_64)
Consult /var/lib/dkms/bbswitch/0.8/build/make.log for more information.
==> WARNING: `dkms install --no-depmod bbswitch/0.8 -k 6.1.38-hardened1-1-hardened' exited 10
(2/2) Cleaning pacman cache...
==> no candidate packages found for pruning

Code: [Select]
user@host> sudo cat /var/lib/dkms/bbswitch/0.8/build/make.log                                                                             ~
DKMS make.log for bbswitch-0.8 for kernel 6.1.38-hardened1-1-hardened (x86_64)
Mon Jul 17 13:57:38 +07 2023
make -C /lib/modules/6.1.38-hardened1-1-hardened/build M="$(pwd)" modules
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (GCC) 13.1.1 20230429
  You are using:           gcc (GCC) 13.1.1 20230714
  CC [M]  /var/lib/dkms/bbswitch/0.8/build/bbswitch.o
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/stackleak_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/randomize_layout_plugin.so
cc1: error: incompatible gcc/plugin versions
cc1: error: failed to initialize plugin ./scripts/gcc-plugins/latent_entropy_plugin.so
make[2]: *** [scripts/Makefile.build:250: /var/lib/dkms/bbswitch/0.8/build/bbswitch.o] Error 1
make[1]: *** [Makefile:2012: /var/lib/dkms/bbswitch/0.8/build] Error 2
make: *** [Makefile:13: default] Error 2/code]


Re: Bumblebee early launch

Reply #3
So, I updated the kernel and bbswitch-dkms is installed normally, but the problem with the sudden inclusion of the maximum cooler speeds has not gone away.

Re: Bumblebee early launch

Reply #4
Can dinit start bumblebeed as early as possible?

Just to copy here what I sent via email:
Quote
To make the service run as soon as possible it needs to be enabled (i.e. be a dependency of the boot service) and have as few dependencies as possible. Please read the Dinit documentation ("man dinit-service") for the format of the service description files; you may be able to edit the bumblebee service description to remove unnecessary dependencies. Note however that getting those wrong might cause the service to fail to start altogether. If the service writes a logfile the directory that will contain the logfile must exist by the time the service starts, and the containing filesystem must be writable, for example.

However, having since examined the service, I do not see anything wrong with the current service description for bumblebee.

Also, since:
Quote
This is cured by restarting bumblebeed
... I am not sure how starting bumblebeed earlier could possibly help? It sounds like either:

  • bumblebeed has in fact not started at all (have you checked? "sudo dinitctl status bumblebeed") - if not, the solution is to find out why (check the log etc). Trying to start it earlier won't help; it's most likely that it's failing because it's trying to start too early to begin with.
  • bumblebeed starts but something else happens afterwards that causes the fans to spin up - in which case, starting bumblebeed [i[later[/i] might help, but starting it earlier isn't going to make a difference.

Another possibility is that bumblebeed starts successfully but the system at that point is in some state such that bumblebeed is not able to, or does not correctly, initialise the hardware (or whatever it does) to prevent the fans spinning.

In all cases starting earlier won't help. Is there some other scenario you're thinking of where starting it earlier will help?

Incidentally:
Quote
So, I updated the kernel and bbswitch-dkms is installed normally, but the problem with the sudden inclusion of the maximum cooler speeds has not gone away.
Have you verified the module is successfully loaded in the kernel? (edit: and checked dmesg log for anything suspicious after loading it?)

Re: Bumblebee early launch

Reply #5
davmac, Hello! Thank you very much for your answer!

it waits "waits-for = loginready" I don't know what could be later...

Yes, after loading the model is loaded

Code: [Select]
user@host> lsmod | grep bb                                                                                                                         ~
bbswitch               24576  0

And the bumblebee is running

Code: [Select]
user@host> doas dinitctl status bumblebeed                                                                                                         ~
doas (user@host) password:
Service: bumblebeed
    State: STARTED
    Activation: start due to dependent(s)
    Process ID: 682

dmesg contains these lines
Code: [Select]
user@host> doas dmesg | grep bbswitch                                                                                                        ~
[   12.713897] bbswitch: loading out-of-tree module taints kernel.
[   12.713906] bbswitch: module verification failed: signature and/or required key missing - tainting kernel
[   12.714151] bbswitch: version 0.8
[   12.714159] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[   12.714165] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[   12.714283] bbswitch: detected an Optimus _DSM function
[   12.714363] bbswitch: disabling discrete graphics
[   12.877207] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is off

Which I am currently looking for in bugs, but so far nothing intelligible.

Re: Bumblebee early launch

Reply #6
Are you certain that restarting bumblebeed is what makes the fans stop?

(Edit: and, have you tried running "top" or similar to see if there any processes using a lot of processing power, while the fans spin?)

Re: Bumblebee early launch

Reply #7
Are you certain that restarting bumblebeed is what makes the fans stop?

This problem occurs every time I boot my laptop and after doing `doas dinitctl reboot bumblebeed` (may have to do this a few times) the fan calms down, although it takes a while. So yeah.

(Edit: and, have you tried running "top" or similar to see if there any processes using a lot of processing power, while the fans spin?)

Yes, I was looking at the processes in htop and noticed that `/usr/lib/Xorg -background none........ /var/run/lxdm` loads one core by more than 20%, but I don't think that a small load causes this problem. Just in case, I tried disabling lxdm and see what happens. However, nothing has changed.

I also looked at the temperature after loading and according to the results of the sensors it is 57°C-60°C.

After the fan stops, the temperature is 50°C-53°C.

Re: Bumblebee early launch

Reply #8
Quote from: doheka
after doing `doas dinitctl reboot bumblebeed` (may have to do this a few times) the fan calms down, although it takes a while

Hmm, but isn't that also what happens if you don't run that command? (I'm assuming you mean "restart" rather than "reboot"). I know this is going to be annoying but - maybe you should time it (maybe even a few times) and see if it really makes any difference?

If it really does make a difference, it seems like bumblebeed is misbehaving somehow, or one of the scenarios I outlined above is occurring. Which isn't much help, but I really don't think starting bumblebeed earlier would help either. What I would be tempted to try in that case is edit the bumblebeed service file so that it runs a script which runs bumblebeed, waits a few seconds, terminates it and then starts it again - to simulate restarting the service. I don't think dinit itself is a factor in this at all.

Re: Bumblebee early launch

Reply #9
If you want to try starting bumblebeed as early as possible, I think you could do it by editing the service description as follows:

Code: [Select]
type            = process
command         = /usr/bin/bumblebeed
smooth-recovery = true
logfile         = /run/bumblebeed.log

Essentially, this drops all dependencies and logs directly into "/run" (which should be available early thanks to the initramfs). As I've said, I don't think it will help (and I can't 100% guarantee that it will actually work at all).

 

Re: Bumblebee early launch

Reply #10
Yes, as you suspected, starting the service early doesn't work....

Well, you will have to use crutches by removing the password for executing the (dinitctl restart bumblebeed) command and adding it to the DE autorun.

Sorry for wasted time