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

Enable/disable howdy with systemd service fails to execute with "run with sudo" #880

Open
spxak1 opened this issue Jan 25, 2024 · 0 comments
Labels
v2 Old version of Howdy (2.*)

Comments

@spxak1
Copy link

spxak1 commented Jan 25, 2024

This is not a bug, but a problem enabling or disabling howdy with a systemd service.

Howdy works perfectly fine otherwise. No issue whatsoever.

I have written a little script that enables/disables howdy based on if the lid of my laptop is open (dockd) or closed (undocked).

Here's the little script testlid:

#!/bin/bash
# Basic if statement
state=`cat /proc/acpi/button/lid/LID/state | cut -d ":" -f 2` 
if [ $state == closed ]
then
echo Lid is $state
howdy disable 1
nmcli radio wifi off
systemctl stop tp-auto-kbbl.service
authselect disable-feature with-fingerprint
else
echo Lid is $state
howdy disable 0
nmcli radio wifi on
systemctl start tp-auto-kbbl.service
authselect enable-feature with-fingerprint
fi

This script is called using a systemd service:

[Unit]
Description=Check the status of the lid (open/closed)
After=network.target
After=syslog.target

[Service]
Type=oneshot
User=root
Group=root
ExecStart=/usr/local/bin/testlid

[Install]
WantedBy=multi-user.target

The service starts fine, runs the script and all parts of the scripts work, except for howdy.
The line is not executed, and in journalctl I see:

Jan 25 19:26:57 weywot testlid[1829]: Lid is open
Jan 25 19:26:58 weywot testlid[1836]: Please run this command as root:
Jan 25 19:26:58 weywot testlid[1836]:         sudo howdy disable 0

Running the script from a terminal (with sudo) works fine.
However starting the service from the terminal (sudo systemctl start checklid.service), has the same result, howdy asks for sudo```.

So when run from within a systemd service howdy won't e executed as root. No idea why.

I'm stuck as as far as I understand, howdy, like all other commands in the script are executed as root.

What am I missing?

Thank you very much for any help, and for the work you've put into this project.

Edit: running the script from cron (root's cron) has the same effect. Everything else runs, howdy asks for sudo.


I've searched for similar issues already, and my issue has not been reported yet.

Linux distribution (if applicable): Fedora 39

Howdy version (sudo howdy version): Howdy 2.6.1

@musikid musikid added the v2 Old version of Howdy (2.*) label Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v2 Old version of Howdy (2.*)
Projects
None yet
Development

No branches or pull requests

2 participants