Hyperion service on OSMC

Hello,
I run OSMC on raspberry 3. There is a program called hyperion ng which I also installed on the raspberry pi3 to control a led strip at the back of my tv to mimic philip’s ambilight. But in order to get this hyperion service going i have to start it from my pc using putty and leave the pc on (which is not convenient).
There is a way to have this hyperion service run at the startup but getting it to work is just way over my head.

Here is the file which is needed to start hyperion service:

Would anyone care to guide me step by step through this process of creating a service on OSMC please?

This thread would be the place to start.

This is where I pointed the user when they opened a support ticket.

I cant say i appreciate having my time wasted on this extensive 600+ comments thread, which doesn’t even scratch the surface on starting hyperion ng. on boot.

Just copy the unit to systemd path, run systemctl daemon-reload and enable it

Would it be too much to ask to break down these “simple” steps for me even more? Im a Linux illiterate.
If i had each particular line of code in the proper order,I think i could pull this off.

You’ll have more luck posing in the thread mentioned earlier I’m pretty sure something that already has it set up will try to help you.

But from looking at the thread and people discussing it I don’t think getting Hyperion to work on osmc is really a very trivial process

I think @hissingshark has a one line installer - at least for Vero

1 Like

If everything else is already in place, you simple need to create a file (using sudo):

/etc/systemd/system/hyperion.service

and copy the above code into it. Then run the command:

sudo systemctl enable hyperion.service

then reboot the device.

I believe to have done so,I then run sudo systemctl status hyperion which gave

  • hyperion.service - Hyperion ambient light systemd service for user
    Loaded: loaded (/etc/systemd/system/hyperion.service; enabled; vendor preset: enable
    Active: activating (auto-restart) (Result: exit-code) since Wed 2019-10-09 23:01:38
    Process: 2217 ExecStart=/usr/bin/hyperiond (code=exited, status=210/CHROOT)
    Main PID: 2217 (code=exited, status=210/CHROOT)

Oct 09 23:01:38 osmc systemd[1]: hyperion.service: Failed with result ‘exit-code’.

And it does not activate hyperion on boot. Maybe not everything is in place then?

  1. For reference, which guide have you followed up to this point to build/install all of the hyperion files?

  2. What command did you use to launch hyperion previously through the terminal?

  3. What is the output from these?
    ls -l /usr/share/hyperion/bin
    ls -l /usr/bin | grep hyperion

Looking at the start script, I see it contains the line User=%i that might be a problem.

I’m not familiar with Hyperion so don’t know why the script has the possibility to run the job under different users. For now, edit the file and replace the %i with an appropriate username, eg osmc, that hyperion shound run under. Reboot and see if works.

@hissingshark I suspect you’ve added the ll command alias yourself. The only alias I find on my OSMC systems is alias ls='ls --color=auto'.

From the look of it I strongly suspect the binaries are not arranged as the service unit is expecting. I await the feedback from @bont55 to be sure.

The %iis not meant to be supported in old versions of systemd, but these days will cause it to run as root. The only effect is to cause hyperion to put the config folder under /root/.hyperion instead of /home/osmc/.hyperion, which is ok for now as you don’t edit the file directly. On my Vero4k installer I change it to osmc, but that’s for forms sake.

Good spot with ll, that’s caught me out before… my alias for ls -l.

  1. I used this video as a guide. Hyperion.NG kompilieren und installieren auf einem Raspberry Pi mit Raspbian - YouTube
    I was told on hyperion forum that it would work for OSMC as well.
    In addition I added
sudo apt-get install rbp-userland-dev-osmc

as it seemed important.

  1. hyperiond
    I find it strange that after launching it, every 10 sec the terminal would continuously pop the “No carrier” notifications, and no other other commands can be executed. If i close the terminal,hyperion stops working.

  2. ls -l /usr/share/hyperion/bin
    ls: cannot access ‘/usr/share/hyperion/bin’: No such file or directory

ls -l /usr/bin | grep hyperion
This command goes pretty much ignored.
Im not sure if and how I should alter those lines based on dillthedog’s remark.

P.S.
Sorry about delayed response. My raspberry wouldn’t boot so I had to start everything from the scratch. Im suspecting it got corrupted from my recent attempt to create hyperion.service.
I know its a question for another topic, but would it be possible to create an image of the sd card,so if things go wrong again I could simply burn the backup image? I thought win32diskimager could do it but im not sure because the sd card has 2 partitions.

That program images the whole card and worked fine when I used it in the past.

3
I’d already altered the lines for you, so you’re good there. The lack of output is because the file aren’t where they are supposed to be.

2
The “no carrier” spamming is normal behaviour, so don’t worry about that.

1
As I suspected the executables are in the wrong place.
From the output onscreen it looked like their install command uses different paths to the ones used in the service unit. Rather than move everything it will be easier to just change the paths in the service file.

In hyperion.service change:

ExecStart=/usr/bin/hyperiond
to
ExecStart=/usr/local/bin/hyperiond

and
WorkingDirectory=/usr/share/hyperion/bin
to
WorkingDirectory=/usr/local/share/hyperion/bin

Ok,so I created /etc/systemd/system/hyperion.service file with the changes to ExecStart and WorkingDirectory. Did the reboot but hyperion didnt auto-start.
I then altered User from %i to osmc ,again without success.

Anything else we could try? Whats with this :

Is it also a necessary step?

This video on YT shows creation of systemd service file. https://www.youtube.com/watch?v=fYQBvjYQ63U&t=119s
He first creates bash script, adds executable permission, only then does he create the service file.
Could it be Im missing those first 2 steps?

Yes, you have to reload the systemd daemon for it to see the changes to the file. And it must be enabled or it won’t run at startup.

Let’s make sure their install command put everything where it did in the video and that the binaries are executable…

  1. What is the output from these?
    ls -l /usr/local/share/hyperion/bin
    ls -l /usr/local/bin | grep hyperion
  1. As usual, it would help greatly if we could see logs.

  2. Since you’re trying to run it under user osmc, why not try to run it from the command line?

     cd /usr/local/share/hyperion/bin
     /usr/local/bin/hyperiond