laurento / gnome-shell-extension-ideapad

Lenovo Ideapad goodies for GNOME Shell. User-friendly battery conservation mode control.
GNU General Public License v3.0
68 stars 16 forks source link

Extension not working properly #2

Closed Nandete84 closed 3 years ago

Nandete84 commented 3 years ago

I installed this extension on my Lenovo ideaPad Y700-15ISK with Ubuntu 20.04 and it is not working properly.

When the extension is on, the leaf appears next to the battery, but when I 'toggle' it, it doesn't deactivate the conservation mode.

I have dual boot with Windows 10 and I realized that if I set the 'conservation mode' in Windows, the battery configuration is the same in Ubuntu.

May be 'Lenovo Vantage' tools in windows overrides this extension?

laurento commented 3 years ago

Did you follow the steps described in the "Additional Required Settings" section?

Nandete84 commented 3 years ago

Yes, I did.

The battery mode can be set on Windows and this extension shows that mode chosen, but I can't toggle it in Ubuntu.

I also have installed 'Laptop mode' power tool.

Is there any information you can use to check/debug it?

laurento commented 3 years ago

When the extension has been properly installed, you should be able to toggle the status from your regular user session. Try to run the following command from a terminal. Please note you need to use your regular user (make sure your prompt shows the symbol $).

/bin/sh -c 'echo 0 | sudo tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode'

Simply use echo 0 or echo 1 to respectively disable or enable the conservation mode. The leaf icon should automatically reflect the current status.

VPC2004:00 should work in most of the cases. However, if the command fails try ls /sys/bus/platform/drivers/ideapad_acpi/ and double-check that the path actually exists.

Nandete84 commented 3 years ago

The command works fine; I tried to re-install from scratch but i lost my sudo user.

If I do: pkexec visudo -f /etc/sudoers.d.ideapad

I find this line:

sudo ALL=(ALL) NOPASSWD: /usr/bin/tee /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode

I am stuck now without sudo user. Any help, please?

laurento commented 3 years ago

Make sure the ideapad is a file under the directory /etc/sudoers.d and not a file named /etc/sudoers.d.ideapad. In other words, you should have something like /etc/sudoers.d/ideapad instead of /etc/sudoers.d.ideapad (note the / instead of .). Use the command in my previous answer to check if the configuration is ok or not.

You could also have a look at gnome-shell logs for any errors:

journalctl -b -0 | grep gnome-shell or journalctl -b -0 | grep gnome-shell | grep idea

What's your gnome-shell version? Check it in a terminal with gnome-shell --version

Nandete84 commented 3 years ago

GNOME Shell 3.36.3

I do have the file, but it is not working. When I modify it with pkexec visudo it returns error.

I don't know why is not understanding the command %sudo... from the installation instructions.

What exactly should I write in that ideapad sudoer file?

Jul 05 01:57:15 Lenovo gnome-shell[4384]: IdeaPad device FOUND at /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00 Jul 05 12:06:39 Lenovo gnome-shell[14347]: >>> /etc/sudoers.d/ideapad: syntax error near line 1 <<< Jul 05 12:06:39 Lenovo gnome-shell[14347]: sudo: parse error in /etc/sudoers.d/ideapad near line 1 Jul 05 12:10:08 Lenovo gnome-shell[14435]: >>> /etc/sudoers.d/ideapad: syntax error near line 1 <<< Jul 05 12:10:08 Lenovo gnome-shell[14435]: sudo: parse error in /etc/sudoers.d/ideapad near line 1 Jul 05 13:19:19 Lenovo gnome-shell[16059]: >>> /etc/sudoers.d/ideapad: syntax error near line 2 <<< Jul 05 13:19:19 Lenovo gnome-shell[16059]: sudo: parse error in /etc/sudoers.d/ideapad near line 2 (There is no line 2 in that file...)

Nandete84 commented 3 years ago

I've just found out that the system stop reading the ideapad sudoer file after the first part of the command /usr/bin/tee

So I modified the sudoer file with 2 lines:

%sudo ALL=(ALL:ALL) NOPASSWD: /usr/bin/tee # /sys/bus/platform/drivers/ideapad_acpi/VPC2004:00/conservation_mode

Now it is working. If I write the rest of the commands in the instructions, I loose my sudo user and I need to edit the ideapad sudoer file to restore it.

laurento commented 3 years ago

So it definitely an issue with your sudo configuration nothing to do with the extension.

I've noticed that instead of copy-pasting what I suggest in the instructions you replaced the device name with VPC2004:00. That's completely fine but I believe you forgot to escape the column VPC2004\:00. That's probably what's causing the syntax error. I suggest you to properly fix your configuration since what you're using know could be considered a security issue. In fact, users in the sudo group can essentially use sudo /usr/bin/tee to replace arbitrary files on your system right now.