Pms_agent.service not found

Hello!

Tad new here, I’m trialling the UPS hat at the moment and I seem to be running into a few teething issues.

Upon installing the software via curl, I noticed that the software had noticed the lack of ‘pi’ user (I develop industrial cryogenic vessel interfaces, so security vulnerabilities like generic usernames are a BIG no no). It seems that because of this, the software is not transmitting information to the cloud.

Looking into brought me to this post: connected but no data
(TL;DR) solution suggested was:

# create user power, add power to the groups: sudo, i2c, video
sudo adduser power
sudo adduser power sudo
sudo adduser power i2c
sudo adduser power video

# edit /etc/sudoers and at the end of the file insert a line with the following content: "power ALL=(ALL) NOPASSWD:ALL".
echo "power ALL=(ALL) NOPASSWD:ALL"|sudo EDITOR='tee -a' visudo

# stop pms_agent, edit user in /etc/systemd/system/pms_agent.service and start pms_agent
sudo systemctl stop pms_agent
sudo sed -i 's/^\(User=\).*/\1power/' /etc/systemd/system/pms_agent.service
sudo systemctl start pms_agent

Unfortunately for reasons that are beyond my understanding, the section RE restarting the pms_agent fails:

uname@hostname:/home/uname# sudo systemctl stop pms_agent
Failed to stop pms_agent.service: Unit pms_agent.service not loaded.
uname@hostname:/home/uname# sudo sed -i 's/^\(User=\).*/\1power/' /etc/systemd/system/pms_agent.service
sed: can't read /etc/systemd/system/pms_agent.service: No such file or directory
uname@hostname:/home/uname# sudo systemctl start pms_agent
Failed to start pms_agent.service: Unit pms_agent.service not found.

I don’t suppose anyone could weigh in with any suggestions to what may be going wrong here?

Thanks in advance,
Daniel

Hello Daniel,

Thank you for your valuable feedback about the generic username.

The pms_agent.service has been replaced by power_agent.service.
Please try with power_agent.service

Hi Saeed,

Thank you for your response, I have adjusted the commands accordingly:

# stop pms_agent, edit user in /etc/systemd/system/pms_agent.service and start pms_agent
sudo systemctl stop power_agent
sudo sed -i 's/^\(User=\).*/\1power/' /etc/systemd/system/power_agent.service
sudo systemctl start power_agent

The sed command didn’t work, so I used nano to change the ‘User’ variable in etc/systemd/system/power_agent.service to ‘power’ (from ‘pi’).

After restarting the service the Power website shows Network status: Connected, but none of the value have updated. Checking journalctl -u power_agent.service lists a lot of:

Feb 17 15:40:11 polarisSBC010 sudo[1361]:    power : TTY=unknown ; PWD=/opt/sixfab/pms/agent ; USER=root ; COMMAND=/usr/bin/cat /opt/sixfab/pms/api/setup.py
Feb 17 15:40:11 polarisSBC010 sudo[1361]: pam_unix(sudo:session): session opened for user root by (uid=0)
Feb 17 15:40:11 polarisSBC010 sudo[1361]: pam_unix(sudo:session): session closed for user root

Any idea what’s going on here?

Many thanks,
Daniel

Hello Daniel,

Please perform similar steps for the power_request.service too.

Wonderful, thank you!
In the end, this becomes the solution:

# create user power, add power to the groups: sudo, i2c, video
sudo adduser power
sudo adduser power sudo
sudo adduser power i2c
sudo adduser power video

# edit /etc/sudoers and at the end of the file insert a line with the following content: "power ALL=(ALL) NOPASSWD:ALL".
echo "power ALL=(ALL) NOPASSWD:ALL"|sudo EDITOR='tee -a' visudo

sudo systemctl stop power_agent
sudo systemctl stop power_request
sudo sed -i 's/^\(User=\).*/\1power/' /etc/systemd/system/power_agent.service
sudo sed -i 's/^\(User=\).*/\1power/' /etc/systemd/system/power_request.service
sudo systemctl start power_agent
sudo systemctl start power_request

Many thanks,
Daniel

1 Like