webos-homebrew-channel
webos-homebrew-channel copied to clipboard
webOS <4.0 doesn't run startup.sh, hence no SSH or Telnet
I had a working version of Homebrew until I decided to upgrade to 05.50 system software, now webOS 4.4.2 (from 05.40).
The initial symptoms after upgrading are that SSH server is not working, Telnet is not working and also PicCap doesn't auto-start - but I still have elevated privileges.
After some debugging, it looks like that the autostart
service registered by Homebrew is not being called; hence no startup.sh
called.
I built a companion app that tries to call the autostart service via LunaBus; once installed, you can see that the first call to the autostart services fails because of a LunaBus error - but trying again it works.

Our assumption is that probably the service doesn't get registered in time or there are some overloads of the LunaBus at startup.
The error we get from LunaBus is this: https://github.com/webosose/luna-service2/blob/master/src/libluna-service2/transport.c#L239
Most likely, this new method of using previewMetadata
in the appinfo.json
doesn't work on webOS 4+, and the startup method was working in the previous firmware because of the presence of /etc/wam/plugins/conf.sh
that called our script in the $EXTRA_CONF
path:
EXTRA_CONF=/mnt/lg/cmn_data/wam/extra_conf.sh
if test -f $EXTRA_CONF; then
source $EXTRA_CONF;
fi
That has now been removed from the 4.4 firmware.
In my case, I've a running Homebrew + startup with the companion app I built myself and managed to manually run the startup.sh
script and everything works correctly, but U guess we ned to find a new way to run services at startup.
Hi, I think the previewMetadata was working on webOS 4 and above. Did it stop working recently?
It doesn't work for me on webOs 4.4 - and most likely not working before?
I was using webOS 4.9 and 5.3 and it worked. Could you install Netflix and see if there are suggestions when you focus the icon?
Nope, no suggestions.
Also, the Netflix ipk I inspected installed on the TV doesn't have any previewMetadata attribute.
I did a grep search and none of the package appinfo.json have it.
This is a TV from 2018, LG B8 running latest software with webos 4.4
It may be possible that with webOS4.4 we are stick in a limbo where none of the previous startup method works (extra_conf.sh or start_devmode.sh) as they patched this but the firmware is too old to support new features like the previewMetadata.
Also, what I've noticed after some usage is that Homebrew stops working and all INSTALL options are greyed-out.
After some digging I found out that's because the LunaBus stop being responsive, causing no luna-message to be dispatched (by looking at ls-monitor).
That's really unfortunate. I think in such case only crashd
method is available (if they are still working).
Isn't crashd method only to gain root?
IIRC if the file is there it will always work.
I'm on same boat with kopiro, with SK8500PLA, MY2018 tv, with webos 4.4 as well. Looks like i have same issues with doing root, with help of hellobox on discord i've managed to get kopiros ipk working on my tv because even that didn't work for me at the beggining, it was just showing some weird output, but hellobox suggested to do some magic, and after that i've got it. However now, after starting up tv, few minutes later homebrew ipk stop working, root status becomes pending and i can't launch/install new apps. After power cycle it does work for few minutes and then back on that again.
Similar boat to @kopiro and @fryc88 here. Managed to crashd
my way to root, but autostart isn't working for me. I tried installing https://github.com/kopiro/webosbrew-autostart, but that encounters errors when running the autostart
service as luna-send -n 1 'luna://org.webosbrew.hbchannel.service/autostart' '{}'
gives the error {"returnValue":false,"errorText":"undefined is not a function"}
.
Unlike @kopiro though, I do seem to get suggestions when hovering over home icons like Netflix as suggested earlier ( https://github.com/webosbrew/webos-homebrew-channel/issues/124#issuecomment-1296841694)
If you can't access the telnet via homebrew app, add this repo https://repo.webosapp.club
-> install root.telnet and connect normally.
@mariotaku yes, the file is there and you can get root - but no startup scripts.
I'm facing the exact same issue. Successfully rooted via crashd
, PicCap and Hyperion are working as expected but only if I start the apps manually after TV start. Autostart is just not working, even though the option is enabled for both services.
Telnet and SSH are also not working.
Using webOS 5.50.10, and HomeBrew 0.5.1 on a OLED55B8LLA.
Any chance that the issue will be fixed?
It's not something that can really be "fixed", since webOS 4.[0-4] is missing the feature we're currently using for autostart functionality. There are other ways of hooking into the boot process, but only for newer versions of webOS. The next version of Homebrew Channel will try to work around this to a limited extent by running startup.sh
when the app is launched.
If anyone wants to look for new boot hooks, it would be greatly appreciated.
Hello; I'll share the solution that works for me.
The main problem with not having autostart so far is only that PicCap and Hyperion/HDR don't start automatically, hence no LEDs.
What you only need is a device that is always on in your network - example: a raspberry Pi.
Generic solution
Install https://github.com/merdok/homebridge-webos-tv using npm -g install homebridge-webos-tv
- I't s a plugin for homebridge that also has a nice CLI tool (/usr/bin/webostv
) you can use.
I recently added support for sending raw luna-messages, we're going to use that.
Create a binary on your system with the following (example: /usr/local/bin/tv-autostart
)
#!/bin/sh
TV_IP=192.168.0.40
TV_MAC=AA-BB-CC-DD-EE-FF
if ! ping $TV_IP; then
echo "TV is off"
exit 1
fi
if curl -s "http://$TV_IP:8090/json-rpc?request=%7B%22command%22:%22serverinfo%22%7D"; then
echo "TV already rooted"
exit 2
fi
echo "Calling autostart"
webostv luna-message $TV_IP $TV_MAC luna://org.webosbrew.hbchannel.service/autostart '{}'
And of course chmod +x /usr/local/bin/tv-autostart
Now, what you're going to do with this binary is really up to you.
Solution 0: Call this script in a CRON
Well, simply enough, setup a CRON that calls /usr/local/bin/tv-autostart
every minute.
Solution 1: Use HomeBridge create a switch that you can use when you want to switch LEDs on/off
Since I don't always want the LEDs on (especially during daylight), I've setup a switch using in HomeKit so that I can just say "Hey Siri, switch on TV LEDs" or use the Homekit app in order to switch them on-off.
The script i'm using is a bit more complex than the one above, since it's also controlling HyperHDR status on/off - you can find it here and put it in /usr/local/bin/tv-hyperhdr
Then, install the plugin "homebridge-cmdswitch2" and add the following:
{
"platform": "cmdSwitch2",
"name": "homebridge-cmdswitch2",
"switches": [
{
"name": "TV LED",
"on_cmd": "/usr/local/bin/tv-hyperhdr on",
"off_cmd": "/usr/local/bin/tv-hyperhdr off",
"state_cmd": "/usr/local/bin/tv-hyperhdr status",
"polling": true,
"interval": 30,
"timeout": 15,
"manufacturer": "HyperHDR"
}
]
}
Now that you have this switch, you can leave it there to manually call it, or, for example, you can configure it to run when TV get switched on, if you also have the TV in HomeKit.
The luna://org.webosbrew.hbchannel.service/autostart '{}'
call kills my Homebrew Channel app. After executing the command, I cannot install any apps from the Channel and the root status under"Settings" is shown as "pending".
It is "fixed" again after a restart if the TV was completely shut down.
But I can confirm that executing the command fixes the autostart and SSH issue for my TV.
Hello - I can confirm you that this behaviour is "everything is locked" happened to me as well, but not because of the luna message you just sent.
It may be that the luna bus is a bit buggy with this webOS version, and messages don't get delivered - therefore, also the "install app" message is not delivered, or the "get root status" message is never delivered and is always shown as pending.
I'm not sure if this is a specific webOS issue or a problem with the homebrew service itself (with this version). - perhaps @Informatic knows more :)
As a workaround for anyone that uses the LG integration within Home Assistant: I created a script that executes the command suggested by @kopiro, which can be used in an automation (e.g. on TV start):
alias: Enable app autostart on rooted LG TV
sequence:
- service: webostv.command
data:
entity_id: media_player.lg_tv
command: system.notifications/createAlert
payload:
message: Executing HB Channel autostart...
modal: false
buttons:
- label: OK
focus: true
buttonType: ok
onClick: luna://org.webosbrew.hbchannel.service/autostart
params: {}
type: confirm
isSysReq: true
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
alias: Delay for Button click to close the alert toast
- service: webostv.button
data:
entity_id: media_player.lg_tv
button: ENTER
mode: single
icon: mdi:television-ambient-light
My workaround also uses Home Assistant but with a custom component: https://github.com/panic175/webosbrew-autostart-helper
@panic175 tried your custom integration, sadly it doesn't work. The first time the remote control Dialog was presented on the tv. I clicked yes and nothing happens. Also she i run the custom component service again.
When I'll open HBC autostart apps will be launched. So my setup works, except autostart .
Any hints i can debug this?
@popy2k14 Do you see any errors from the custom component in your Home Assistant Logs?
@panic175 sorry for hijacking your thread. I have webOS 6.3.1-411 (kisscurl-kinglake). In my case i had to uncheck all EULAs and retry (incl. reboot) until they are unchecked (two times in my case). Then enabled the TOP one and autostart is working again.
Just if anybody like me has this issue and needs this information. I am in conact with the https://gist.github.com/throwaway96/e811b0f7cc2a705a5a476a8dfa45e09f owner, so maybe this info get's also added there.
thx again
hi there!
I think I found a way:
luna-send -f -n 1 -m org.webosbrew.hbchannel.service luna://com.webos.service.activitymanager/create '{
"activity": {
"name": "org.webosbrew.hbchannel.service.autostart",
"description": "who cares",
"type": {
"foreground": true,
"persist": true,
"continuous": true
},
"trigger": {
"method": "luna://com.webos.bootManager/getBootStatus",
"params": {
"subscribe": true
},
"where": {
"prop": [
"signals",
"core-boot-done"
],
"op": "=",
"val": true
}
},
"callback": {
"method": "luna://org.webosbrew.hbchannel.service/autostart",
"params": {}
}
},
"replace": true,
"start": true
}'
I haven't tested this on 4.4. I would be glad to receive any feedback!
hi there!
I think I found a way:
luna-send -f -n 1 -a org.webosbrew.hbchannel.service luna://com.webos.service.activitymanager/create '{ ...... }'
I haven't tested this on 4.4. I would be glad to receive any feedback!
On my webOS TV (version 4.4.2), this above worked perfectly, I could finally disable my HomeAssistant automation :D
On my webOS TV (version 4.4.2), this above worked perfectly, I could finally disable my HomeAssistant automation :D
that was quick! thank you for the feedback.
follow #143 👀
As a workaround for anyone that uses the LG integration within Home Assistant: I created a script that executes the command suggested by @kopiro, which can be used in an automation (e.g. on TV start):
alias: Enable app autostart on rooted LG TV sequence: - service: webostv.command data: entity_id: media_player.lg_tv command: system.notifications/createAlert payload: message: Executing HB Channel autostart... modal: false buttons: - label: OK focus: true buttonType: ok onClick: luna://org.webosbrew.hbchannel.service/autostart params: {} type: confirm isSysReq: true - delay: hours: 0 minutes: 0 seconds: 2 milliseconds: 0 alias: Delay for Button click to close the alert toast - service: webostv.button data: entity_id: media_player.lg_tv button: ENTER mode: single icon: mdi:television-ambient-light
Massive thanks for this. It helped me find the syntax needed to run the PicCap service directly from Home Assistant, as it doesn't autorun in my webOS 3.4.0. Might be that the createAlert method doesn't exist in that version?
However, your script doesn't work for me. The button step works, but the toast alert doesn't appear at any time. Any idea why?
[21:14:25.594][INFO] com.webos.service.secondscreen.gateway SSG_PERM Failed to find permissions for ssap://system.notifications/createAlert: Error: method /createAlert not found in interface system.notifications {}
Hmm, yes, it seems that the method is not found on your OS. But the error message also indicates, that you do not have the right permissions to execute? Not sure what's the issue here. All available methods are listed here, but without OS version support information: https://github.com/bendavid/aiopylgtv/blob/master/aiopylgtv/endpoints.py
@soeren-a Yeah, I have been checking that and testing all I can think of. But can't make it work. createToast works fine, but createAlert doesn't.
Isn't there any other way to send the command to start SSH from HA?
@soeren-a Yeah, I have been checking that and testing all I can think of. But can't make it work. createToast works fine, but createAlert doesn't.
Isn't there any other way to send the command to start SSH from HA?
Not that I'm aware of. As far as I know, a user interaction like a button click is needed to execute the call. Showing a toast with a button and click it was the easiest way to achieve that.