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

"Could not acquire EC lock" on Ubuntu 18.04 LTS #472

Closed
linkwh opened this issue Apr 30, 2018 · 15 comments
Closed

"Could not acquire EC lock" on Ubuntu 18.04 LTS #472

linkwh opened this issue Apr 30, 2018 · 15 comments

Comments

@linkwh
Copy link

linkwh commented Apr 30, 2018

After having built and installed the software (1.5.2 and 1.5.3 beta) as explained on this website :

  • the service seems to run fine
  • nbfc.exe does not work in enabled mode and displays the error "Could not acquire EC lock"
    NBFC ran just fine on the same computer with Ubuntu 17.10.

Step 1 : start the service & check that the service is running
$ sudo systemctl start nbfc
$ sudo systemctl status nbfc
● nbfc.service - NoteBook FanControl service
Loaded: loaded (/etc/systemd/system/nbfc.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2018-04-30 16:35:48 CEST; 11min ago

Step 2 : read only mode works
$ nbfc.exe start -r
$ nbfc.exe status
Service enabled : True
Read-only : True
Selected config name : Asus Zenbook UX310UA
Temperature : 34

Fan display name : Fan #1
Auto control enabled : True
Critical mode enabled : False
Current fan speed : 0.00
Target fan speed : 0.00
Fan speed steps : 8

Step 3 : enabled mode does not work
$ nbfc.exe start -e
EC initialization failed: Could not acquire EC lock
$ nbfc.exe config -a "Asus Zenbook UX310UA"
EC initialization failed: Could not acquire EC lock

Additional info
mono-complete 4.6.2.7+dfsg-1ubuntu1 amd64
Linux 4.15.0-20-generic #21-Ubuntu SMP Tue Apr 24 06:16:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

@MonteyMontey
Copy link

same issue for me

@Gele-CZ
Copy link

Gele-CZ commented May 1, 2018

Same problem as describes @linkwh (and @MonteyMontey). Tested on Ubuntu 16.04, 16.10 and 17.10 (everything OK), 18.04 not working with EC initialization failed: Could not acquire EC lock.

@stefanocirici
Copy link

stefanocirici commented May 4, 2018

Same issue on 18.04 with UX430UQ.
From issue #414 seems to be a BIOS secure boot problem. However I cannot confirm it for Ubuntu (yet).
EDIT:
Just disabled Secure Boot and nbfc seems working. Wondering if it can be run with secure boot enabled...

@Gele-CZ
Copy link

Gele-CZ commented May 5, 2018

@stefanocirici: 👍

Disabled Secure Boot is already functional on my NTB (UX430UA).

@linkwh
Copy link
Author

linkwh commented May 5, 2018

Mine is an Asus computer (UX410UA), juste like @stefanocirici and @Gele-CZ
Could the problem be Asus-specific?

NBFC ran juste fine on Ubuntu 17.10 with secure boot enabled.

@linkwh
Copy link
Author

linkwh commented May 5, 2018

In can confirm that it runs fine on Ubuntu 18.04 without Secure Boot disabled.

Any idea on how to make it work with Secure Boot enabled?

@stefanocirici
Copy link

@hirschmann could you please take a look at our problem? I would like to keep secure boot enabled.

@hirschmann
Copy link
Owner

I don't have much spare time right now, but I'll try to reproduce this issue on the weekend.
In the meantime, you could try to stop the service, then delete nbfc/Plugins/StagWare.Plugins.ECSysLinux.dll and restart the service.

@stefanocirici
Copy link

stefanocirici commented May 10, 2018

I've deleted the file and enabled Secure boot. On restart:

velix@velix-pc:~$ cd /opt/nbfc/Plugins/
velix@velix-pc:/opt/nbfc/Plugins$ ls
StagWare.Hardware.LPC.dll  StagWare.Plugins.ECLinux.dll  StagWare.Plugins.FSTemperatureMonitor.dll

velix@velix-pc:/opt/nbfc/Plugins$ sudo service nbfc start
velix@velix-pc:/opt/nbfc/Plugins$ sudo service nbfc status
● nbfc.service - NoteBook FanControl service
   Loaded: loaded (/etc/systemd/system/nbfc.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Thu 2018-05-10 12:15:07 CEST; 331ms ago
  Process: 3559 ExecStart=/opt/nbfc/nbfcservice.sh start (code=exited, status=0/SUCCESS)
 Main PID: 3575 (code=exited, status=1/FAILURE)

mag 10 12:15:07 velix-pc systemd[1]: Failed to start NoteBook FanControl service.

velix@velix-pc:/opt/nbfc/Plugins$ nbfc status
Connection refused

Without the nbfc/Plugins/StagWare.Plugins.ECSysLinux.dll file nbfc wont't start even in read only mode.

This is my journal (only errors are shown):

mag 10 12:14:02 velix-pc mono[1046]: NbfcService: Exception has been thrown by the target of an invocation.
mag 10 12:14:02 velix-pc mono[1046]: NbfcService: Could not load a  plugin which implements StagWare.FanControl.Plugins.IEmbeddedController
mag 10 12:14:03 velix-pc mono[1518]: NbfcService: Exception has been thrown by the target of an invocation.
mag 10 12:14:03 velix-pc mono[1518]: NbfcService: Could not load a  plugin which implements StagWare.FanControl.Plugins.IEmbeddedController
mag 10 12:14:04 velix-pc mono[1553]: NbfcService: Exception has been thrown by the target of an invocation.
mag 10 12:14:04 velix-pc mono[1553]: NbfcService: Could not load a  plugin which implements StagWare.FanControl.Plugins.IEmbeddedController
mag 10 12:14:05 velix-pc mono[1671]: NbfcService: Exception has been thrown by the target of an invocation.
mag 10 12:14:05 velix-pc mono[1671]: NbfcService: Could not load a  plugin which implements StagWare.FanControl.Plugins.IEmbeddedController
mag 10 12:14:06 velix-pc mono[1758]: NbfcService: Exception has been thrown by the target of an invocation.
mag 10 12:14:06 velix-pc mono[1758]: NbfcService: Could not load a  plugin which implements StagWare.FanControl.Plugins.IEmbeddedController
mag 10 12:14:06 velix-pc systemd[1]: Failed to start NoteBook FanControl service.
mag 10 12:15:03 velix-pc mono[3434]: NbfcService: Exception has been thrown by the target of an invocation.

@hirschmann
Copy link
Owner

Thanks for your fast response 👍

The problem is caused by these "kernel lockdown" patches:
https://lkml.org/lkml/2017/4/5/652

In particular:

  • No use of ioperm(), iopl() and no writing to /dev/port.

The ECLinux plugin uses /dev/port/ to access the EC :(

  • Restrict debugfs interface to ASUS WMI.

The ECSysLinux plugin uses /sys/kernel/debug/ec/ec0/io (debugfs) to access the EC :(
Actually the ECSysLinux plugin can only be initialized because it only checks if the ec_sys kernel module can be loaded with write support enabled, but it should also check if it's actually possible to access the EC (this is a bug - I will fix it).

The good news:
There is a workaround, see #414 (@stefanocirici already posted this)
You don't have to completely disable secure boot. It's enough to "just" lift the kernel lockdown, see:
#414 (comment)
and
#414 (comment)

The bad news:
Currently, I don't know how to access the EC from user mode without lifting the kernel lockdown.
If someone has an idea, please let me know :)

@GitEscape
Copy link

GitEscape commented Aug 9, 2018

I'm new to Mint 19 and can't get the #414 script from @jgoclawski to work?

mandree's method works for me (kernel.sysrq=16), but I'm unsure if my lift_kernel_lockdown.service is booting properly, and none of the boot managers I've searched for seem to be available for M19 at the minute. I'm fresh to Linux from Windows, so I don't even know if the syntax in the two files is correct for Mint?

Another thought is that they might be plaintext files, although I C&Ped a genuine .sh to try and avoid that. It's not as easy to me as just creating a .bat and throwing it into Startup. Help appreciated!

[edit]

Oh, and NBFC is loaded and enabled at boot, as per systemctl status and is-enabled.

@GitEscape
Copy link

BUT... lift_kernel_lockdown wasn't recognised with systemctl is-enabled, so I copied NBFC.service to another directory, filled it with the script and renamed it, and then made sure it was executable via Permissions before moving it back. And that's done it!

Good work @jgoclawski

@hirschmann hirschmann pinned this issue May 27, 2019
@github-actions
Copy link

This issue is stale because it has been open more than 180 days with no activity. If nobody comments within 7 days, this issue will be closed

@Demetrio92
Copy link

For me, disabling secure boot worked.

@rijnhard
Copy link

rijnhard commented Apr 6, 2021

have you tried adding the following kernel flag? ec_sys.write_support=1

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

No branches or pull requests

8 participants