RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login
    Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

    TriggerHappy Daemon (THD) doesn't work on my Pi running Retropie ! Help

    Scheduled Pinned Locked Moved Help and Support
    retropietriggerhappydaemonhelpbug
    32 Posts 4 Posters 8.7k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Djon @mitu
      last edited by

      @mitu
      Thanks for your help !
      That is a great idea, poorly i already tested it and it doesn't work aswell...

      1 Reply Last reply Reply Quote 0
      • D
        Djon
        last edited by

        An "UP" is usefull in this website ?
        :)

        1 Reply Last reply Reply Quote 0
        • D
          Djon
          last edited by

          @mitu
          Can you help me out ?

          I will be very grateful
          Thanks

          mituM 1 Reply Last reply Reply Quote 0
          • mituM
            mitu Global Moderator @Djon
            last edited by

            @djon I would, but it's a guessing game without having the hardware to test it. It seems the problem is not in the configuration, but something with the service. Is the triggerhappy service running ? What does sudo systemctl status triggerhappy show ?

            1 Reply Last reply Reply Quote 0
            • D
              Djon
              last edited by

              @mitu Thanks for your help, i could be very reactive if you want me to test it quick :)
              First, triggerhappy don't run as root, anyway i need to do "sudo nano /etc/triggerhappy/triggers.d/testb.conf" (sudo) or the file will be unwritable.
              Second, here's what the status said :

              sudo systemctl status triggerhappy

              ● triggerhappy.service - triggerhappy global hotkey daemon

              Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor pre

              Active: active (running) since Tue 2018-06-05 23:19:15 UTC; 6 days ago

              Main PID: 384 (thd)

              CGroup: /system.slice/triggerhappy.service

                   └─384 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket
              

              Jun 12 22:37:00 retropie sudo[1353]: pam_unix(sudo:auth): auth could not identif

              Jun 12 22:37:02 retropie thd[384]: Executing trigger action: sudo chmod 777 /sys

              Jun 12 22:37:02 retropie thd[384]: We trust you have received the usual lecture

              Jun 12 22:37:02 retropie thd[384]: Administrator. It usually boils down to these

              Jun 12 22:37:02 retropie thd[384]: #1) Respect the privacy of others.

              Jun 12 22:37:02 retropie thd[384]: #2) Think before you type.

              Jun 12 22:37:02 retropie thd[384]: #3) With great power comes great responsi

              Jun 12 22:37:02 retropie thd[384]: sudo: no tty present and no askpass program s

              Jun 12 22:37:02 retropie sudo[1359]: pam_unix(sudo:auth): conversation failed

              Jun 12 22:37:02 retropie sudo[1359]: pam_unix(sudo:auth): auth could not identif

              lines 1-17/17 (END)...skipping...

              ● triggerhappy.service - triggerhappy global hotkey daemon

              Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor pre

              Active: active (running) since Tue 2018-06-05 23:19:15 UTC; 6 days ago

              Main PID: 384 (thd)

              CGroup: /system.slice/triggerhappy.service

                     └─384 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket
              

              Jun 12 22:37:00 retropie sudo[1353]: pam_unix(sudo:auth): auth could not identif

              Jun 12 22:37:02 retropie thd[384]: Executing trigger action: sudo chmod 777 /sys

              Jun 12 22:37:02 retropie thd[384]: We trust you have received the usual lecture

              Jun 12 22:37:02 retropie thd[384]: Administrator. It usually boils down to these

              Jun 12 22:37:02 retropie thd[384]: #1) Respect the privacy of others.

              Jun 12 22:37:02 retropie thd[384]: #2) Think before you type.

              Jun 12 22:37:02 retropie thd[384]: #3) With great power comes great responsi

              Jun 12 22:37:02 retropie thd[384]: sudo: no tty present and no askpass program s

              Jun 12 22:37:02 retropie sudo[1359]: pam_unix(sudo:auth): conversation failed

              Jun 12 22:37:02 retropie sudo[1359]: pam_unix(sudo:auth): auth could not identif

              ~

              ~

              ~

              ~

              ~

              ~

              ~

              lines 1-17/17 (END)...skipping...

              ● triggerhappy.service - triggerhappy global hotkey daemon

              Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor preset: enabled)

              Active: active (running) since Tue 2018-06-05 23:19:15 UTC; 6 days ago

              Main PID: 384 (thd)

              CGroup: /system.slice/triggerhappy.service

                     └─384 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket /run/thd.socket --user nobody --deviceglob /dev/input/event*
              

              Jun 12 22:37:00 retropie sudo[1353]: pam_unix(sudo:auth): auth could not identify password for [nobody]

              Jun 12 22:37:02 retropie thd[384]: Executing trigger action: sudo chmod 777 /sys/class/backlight/rpi_backlight/brightness && echo 25 > /sys/class/backlight/rpi_backlight/brightness

              Jun 12 22:37:02 retropie thd[384]: We trust you have received the usual lecture from the local System

              Jun 12 22:37:02 retropie thd[384]: Administrator. It usually boils down to these three things:

              Jun 12 22:37:02 retropie thd[384]: #1) Respect the privacy of others.

              Jun 12 22:37:02 retropie thd[384]: #2) Think before you type.

              Jun 12 22:37:02 retropie thd[384]: #3) With great power comes great responsibility.

              Jun 12 22:37:02 retropie thd[384]: sudo: no tty present and no askpass program specified

              Jun 12 22:37:02 retropie sudo[1359]: pam_unix(sudo:auth): conversation failed

              Jun 12 22:37:02 retropie sudo[1359]: pam_unix(sudo:auth): auth could not identify password for [nobody]

              Hope it can help !

              1 Reply Last reply Reply Quote 0
              • D
                Djon
                last edited by

                It seems to be running but some of the line are in red, here they are :

                pam_unix(sudo:auth): auth could not identif
                pam_unix(sudo:auth): conversation failed
                pam_unix(sudo:auth): auth could not identif

                pam_unix(sudo:auth): auth could not identif
                pam_unix(sudo:auth): conversation failed
                pam_unix(sudo:auth): auth could not identif

                pam_unix(sudo:auth): auth could not identify password for [nobody]
                pam_unix(sudo:auth): conversation failed
                pam_unix(sudo:auth): auth could not identify password for [nobody]

                mituM 1 Reply Last reply Reply Quote 0
                • mituM
                  mitu Global Moderator @Djon
                  last edited by mitu

                  @djon Well, it's clear why this fails: the service doesn't run as root AND the user used to run the service does not have sudo passwordless access. You can see the normal sudo disclaimer in the logs (We trust you have received the usual lecture from the local System..), which is shown whenever a user runs sudo and it must provide the password to run privileged commands. Since your service cannot provide the password, the sudo commands fail.

                  Configure the service to run as rootor as the user pi, and you won't have any problems.

                  1 Reply Last reply Reply Quote 0
                  • D
                    Djon
                    last edited by

                    Well it looks promising thanks !
                    How can i do it ?? ahah i'm kind of new in the Raspberry family :)

                    Thanks again @mitu

                    mituM 1 Reply Last reply Reply Quote 0
                    • mituM
                      mitu Global Moderator @Djon
                      last edited by mitu

                      @djon said in TriggerHappy Daemon (THD) doesn't work on my Pi running Retropie ! Help:

                      Well it looks promising thanks !

                      Luckily, this is configurable. Edit the /etc/default/triggerhappy file and uncomment (remove the # ) from the last line. Restart the service via sudo systemctl restart triggerhappy and it should run as root, so you don't need sudo for executing commands.

                      You can also modify the last line and make it run as the pi user (which should be able to run sudo commands without a password prompt), I'd recommend doing that instead of leaving it running as root.

                      1 Reply Last reply Reply Quote 0
                      • D
                        Djon
                        last edited by

                        @mitu
                        Some people say that i need to do
                        "open the configuration file with
                        sudo nano /etc/init.d/triggerhappy
                        modify the configuration file line to look like the following
                        DAEMON_ARGS="--daemon --triggers /etc/triggerhappy/triggers.d/ --socket /var/run/thd.socket --pidfile $PIDFILE --user pi /dev/input/event*" "

                        previously it was : "
                        DAEMON_ARGS="--daemon --triggers /etc/triggerhappy/triggers.d/ --socket /var/run/thd.socket --pidfile $PIDFILE --user nobody /dev/input/event*"

                        But i did it previsouly before asking for help on this forum so i guess i'm missing something !

                        1 Reply Last reply Reply Quote 0
                        • D
                          Djon
                          last edited by

                          I already tried it in the past, but i'll try it again now
                          let's see

                          1 Reply Last reply Reply Quote 0
                          • D
                            Djon
                            last edited by

                            The new status, seems to be working on paper @mitu :
                            sudo systemctl status triggerhappy

                            ● triggerhappy.service - triggerhappy global hotkey daemon

                            Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor pre

                            Active: active (running) since Wed 2018-06-13 02:55:23 UTC; 1min 33s ago

                            Main PID: 752 (thd)

                            CGroup: /system.slice/triggerhappy.service

                                   └─752 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket
                            

                            Jun 13 02:55:23 retropie systemd[1]: Starting triggerhappy global hotkey daemon.

                            Jun 13 02:55:23 retropie thd[752]: Unable to parse trigger line:

                            Jun 13 02:55:23 retropie thd[752]: Found socket passed from systemd

                            Jun 13 02:55:23 retropie systemd[1]: Started triggerhappy global hotkey daemon.

                            lines 1-11/11 (END)...skipping...

                            ● triggerhappy.service - triggerhappy global hotkey daemon

                            Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor pre

                            Active: active (running) since Wed 2018-06-13 02:55:23 UTC; 1min 33s ago

                            Main PID: 752 (thd)

                            CGroup: /system.slice/triggerhappy.service

                                   └─752 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket
                            

                            Jun 13 02:55:23 retropie systemd[1]: Starting triggerhappy global hotkey daemon.

                            Jun 13 02:55:23 retropie thd[752]: Unable to parse trigger line:

                            Jun 13 02:55:23 retropie thd[752]: Found socket passed from systemd

                            Jun 13 02:55:23 retropie systemd[1]: Started triggerhappy global hotkey daemon.

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            ~

                            lines 1-11/11 (END)...skipping...

                            ● triggerhappy.service - triggerhappy global hotkey daemon

                            Loaded: loaded (/lib/systemd/system/triggerhappy.service; enabled; vendor preset: enabled)

                            Active: active (running) since Wed 2018-06-13 02:55:23 UTC; 1min 33s ago

                            Main PID: 752 (thd)

                            CGroup: /system.slice/triggerhappy.service

                                   └─752 /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --socket /run/thd.socket --user nobody --deviceglob /dev/input/event*
                            

                            Jun 13 02:55:23 retropie systemd[1]: Starting triggerhappy global hotkey daemon...

                            Jun 13 02:55:23 retropie thd[752]: Unable to parse trigger line:

                            Jun 13 02:55:23 retropie thd[752]: Found socket passed from systemd

                            Jun 13 02:55:23 retropie systemd[1]: Started triggerhappy global hotkey daemon.

                            1 Reply Last reply Reply Quote 0
                            • D
                              Djon
                              last edited by

                              Now that TriggerHappy seems to be "running well", i think we're close to make it work !
                              Poorly, when i press the button, nothing seems to be happening...
                              @mitu

                              1 Reply Last reply Reply Quote 0
                              • D
                                Djon
                                last edited by

                                FYI: i edited the line as follow: " DAEMON_OPTS"--user pi"

                                1 Reply Last reply Reply Quote 0
                                • mituM
                                  mitu Global Moderator
                                  last edited by

                                  No, it's still not working:

                                  • User running the service seems to be still nobody - probably the configuration file I mentioned works only for the old style service file
                                  • You get an error in the configuration file, which means it's running but ignoring your config.

                                  I think your best bet is to disable the service and run it as the pi user from the autostart.sh file (where Emulationstation is started).
                                  Run it from the terminal, as the pi user with

                                  /usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --deviceglob /dev/input/event*
                                  

                                  Make sure it works like this - i.e. it gets your button inputs correctly. Then, add the line in either /etc/rc.local or in the autostart.sh script. Make sure you add an & at the end of the command when adding it to either file.

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    Djon
                                    last edited by

                                    Waaa we're so close now !!
                                    So when i type
                                    "/usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --deviceglob /dev/input/event*" from the terminal and press my button, it actually works !

                                    Now i'm not sure when to add the line, should i do "sudo nano /etc/rc.local" and go at the end and copy and paste ?

                                    FYI, when i type "sudo nano autostart.sh" the file is empty
                                    @mitu

                                    mituM 1 Reply Last reply Reply Quote 0
                                    • mituM
                                      mitu Global Moderator @Djon
                                      last edited by

                                      @djon The autostart.sh file is in /opt/retropie/configs/all/autostart.sh, but try with /etc/rc.local first. You'll need to reboot to test it.

                                      1 Reply Last reply Reply Quote 0
                                      • D
                                        Djon
                                        last edited by

                                        @mitu
                                        if the line need to start at boot, i also have a python code running at boot, i added the pyton path at the end of /etc/profile
                                        Don't know if it can help here :)

                                        1 Reply Last reply Reply Quote 0
                                        • D
                                          Djon
                                          last edited by

                                          @mitu
                                          So i did : sudo nano /etc/rc.local
                                          And added at the end of the file
                                          "/usr/sbin/thd --triggers /etc/triggerhappy/triggers.d/ --deviceglob /dev/input/event* &"
                                          Then sudo reboot

                                          But it still not working

                                          mituM 1 Reply Last reply Reply Quote 0
                                          • D
                                            Djon
                                            last edited by

                                            Maybe should i past it before "exit 0" line ?

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

                                            Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.