Problem installing ON/OFF SHIM (Pimoroni)

Raspberry Pi related support

Problem installing ON/OFF SHIM (Pimoroni)

Postby klettervirus » 29 Mar 2019, 17:17

I tried to install a hardware switch (ON/OFF ShHIM from Pimoroni). It needs to run an install script:

curl https://get.pimoroni.com/onoffshim | bash

When I trie that, it does not install the script but tells me something else:

"Running as root, please log in as a regular user with sudo rights!"

I do not understand, does that mean that a nromal user using "su" can do more than root? What is it that I need to do to install the script?

Thanks in advance for the help, kindest regards, Stefan
klettervirus
 
Posts: 3
Joined: 29 Mar 2019, 17:01

Re: Problem installing ON/OFF SHIM (Pimoroni)

Postby janui » 01 Apr 2019, 17:03

Hi klettervirus,
Linux has got very particular about what can and what can not be run as root. You also have a script designed for one of the standard Linux versions like Rasbian. RuneAudio uses Arch-Linux which uses a formal publication and version control process. So there is no guarantee that your script will deliver what is should.
As you point out it seems a waste of time forbidding things to be run as root then insisting that they are run as root via sudo. But I am afraid that’s the way it is.
I suggest you make a user called ‘shim’ and try using it to run the script. Create the user:
Code: Select all
userdel shim
groupdel shim
groupadd -r shim
useradd -r -d /home/shim -g shim shim
mkdir /home/shim
then add a file to the directory /etc/sudoers.d, for example: sudo-shim:
Code: Select all
nano /etc/sudoers.d/sudo-shim
With this content:
Code: Select all
shim ALL=NOPASSWD: ALL
Copy the script to directory /home and run:
Code: Select all
chmod 777 /home/<scriptname>
Then we should be ready to go, switch to the user shim with this:
Code: Select all
su shim
To check who you are:
Code: Select all
whoami
Then run your script:
Code: Select all
cd /home
sudo <scriptname>
That should do it. You can exit the shim user environment with:
Code: Select all
exit
Check who you are with whoami.
Janui

PS do not forget to clean up afterwards:
Code: Select all
rm /etc/sudoers.d/sudo-shim
userdel shim
groupdel shim
rmdir /home/shim
User avatar
janui
 
Posts: 699
Joined: 20 Dec 2014, 12:55
Location: Ollanda

Re: Problem installing ON/OFF SHIM (Pimoroni)

Postby klettervirus » 01 Apr 2019, 19:24

Thanks so much, will try that!
klettervirus
 
Posts: 3
Joined: 29 Mar 2019, 17:01

Re: Problem installing ON/OFF SHIM (Pimoroni)

Postby andre_chang » 05 Sep 2019, 15:32

This way can realize the shutdown state, click the button to start it?
andre_chang
 
Posts: 84
Joined: 01 Feb 2016, 13:27

Re: Problem installing ON/OFF SHIM (Pimoroni)

Postby janui » 06 Sep 2019, 08:08

Hi andre_chang,
andre_chang wrote:This way can realize the shutdown state, click the button to start it?
See here: post26916.html
And here: shutdown-restart-pushbutton-t6781.html
I do not know if stablgr succeeded in making it work. Collin uses an elegant power switch configuration. However this looks like a better solution than using python scripts: https://github.com/ali1234/systemd-gpio
janui
Edited 06-09-2019
User avatar
janui
 
Posts: 699
Joined: 20 Dec 2014, 12:55
Location: Ollanda

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: No registered users and 6 guests