RootMyTV / RootMyTV.github.io

RootMyTV is a user-friendly exploit for rooting/jailbreaking LG webOS smart TVs.
https://RootMy.TV
MIT License
2.21k stars 64 forks source link

[Q] What folders on file system are safe to mess with their content? #102

Closed stiw47 closed 1 year ago

stiw47 commented 1 year ago

Not an actual issue, but don't know where else to ask. If you are considering this as inappropriate, please close it immediately.

I rooted my OLED55C11LB one year ago or so at system version 3.21.20 and webOS version 6.2.0-35 (kisscurl-kavir). Unfortunately, recently I noticed that my system version is 03.34.55 and webOS 6.3.2-423 (kisscurl-kinglake). Most probably kids accepted update pop-up at some point when root scripts failed on boot and TV went to failsafe mode. Fortunately, root is still ok, but I am not happy because of ugly purple webOS wallpaper across whole screen, which cannot be changed (yeah, I turned off promotions and I'm using DNS ad blocking, so there is no default ad billboard in place of this wallpaper):

image

I found this wallpaper is located in 3 different locations on TV file system, in 3 different resolutions:

  1. /usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Components/images/2k/banner_image_03.png
  2. /usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Components/images/4k/banner_image_03.png
  3. /usr//palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Components/images/hd/banner_image_03.png

I tried to copy my .png images over those, in same resolution and with the same name, but system is read-only. Don't want to go further and try to remount the system as rw, cause MOTD in SSH console says: NEVER EVER OVERWRITE SYSTEM PARTITIONS LIKE KERNEL, ROOTFS, TVSERVICE. Your TV will be bricked, guaranteed! See https://rootmy.tv/warning for more info. This is something you set as MOTD 6 months ago or so, and I already got info here that you wrote this cause someone had success to brick the TV by messing with system files.

Questions:

  1. Would it be possible to change this wallpaper safely?
  2. Is it safe to remount file system as rw (if possible), change the wallpaper and revert it back to ro (maybe it will revert to ro on it's own on reboot?)?
  3. In general, what folders/partitions are safe for messing with file editing, and which ones shouldn't be touched? E.g. I know that /media/developer should be safe.

Thank you very much upfront.

####################################### EDIT: Actually, now I'm reading again the answer from @Informatic here, this part:

all read-only system partitions are signed, and there's no way of bypassing that

So if I'm understand correct, it's mean I should give up of this, correct?

Informatic commented 1 year ago
  1. You can non-permanently modify rootfs partition by making an overlay over it during startup. Here's a quick explanation: https://www.webosbrew.org/pages/filesystem-overlays.html Keep in mind that wallpaper may be loaded early during boot, and you may need to somehow kill/restart com.webos.app.home process for it to get reloaded.
  2. No, it is not possible. (since rootfs and most other partitions are cryptographically signed by LG, and thus can't be modified directly)
  3. It's hard to tell, since there's many moving parts (different on different webOS versions) that we indirectly rely on for startup. Generally filesystem-level overlays applied on startup are safe - if your TV crashes on boot we'll fall back to "failsafe mode" which will not execute any of the usual startup scripts that modify the system in runtime and will only expose a root telnet server that can be used to fix the system up to prevent further crashes.
stiw47 commented 1 year ago

Vau, @Informatic , you are very fast. I edited my first post, few sentences at the end. With that and your answer, all clear.

Thanks for point 1.

From my perspective, this can be closed, closing, thanks.

mariotaku commented 1 year ago

Hi. It's absolutely not safe to change anything in a read only partition. Or rather - it will 100% cause brick.

However, by using bind mount, you are actually adding an overlay on top of the read only file system, and all the changes actually happen on the user partition, which will be safe.

stiw47 commented 1 year ago

Makes sense, thanks. Will study Filesystem Overlays and other parts of wiki in free time.

stiw47 commented 1 year ago

I just would like to add additional comment that this github repo is miracle. I mean, I asked 2 questions since now, they even are not an issues, just a questions, and both times got an answers in less than half hour (this time in 5 minutes). This is for sure much better than LG support will ever be, and I will for sure donate few bucks here, when salary comes, on Friday 😁. Yes, I'm talking about same LG who sold expensive ad billboards for our living rooms 😇

DavidBuchanan314 commented 1 year ago

You almost got a third answer, I was midway through typing one when I saw @Informatic's one come through lol

stiw47 commented 1 year ago

It is working, yeaaaaaahhh, thanks guys.

image

Regarding OLED55C11LB, 2k image should be replaced, one in /usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Components/images/2k/banner_image_03.png

Very simple, store your .png photo in same resolution somewhere in /root/home and execute following (actually, I was experimented from /tmp folder, but will move it later to /home/root):

mount --bind /tmp/2k/banner_image_03.png /usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Components/images/2k/banner_image_03.png

After that ps aux to find the PID of home app:

ps aux | grep com.webos.app.home

and kill <PID> (was kill 2137 in my case)

Since home is killed, you will be sent to some last app I believe (I was sent to HDMI4, where my Android BOX is connetcted), but first next time when you press HOME button on remote, home will start again and your wallpaper will be there.

(I'm writing in detail, it could be useful for someone non-experienced).

Now will see to make this persistent, also to create some dynamic slideshow with the help of Home Assistant and SSH.

Thx, guys.

kitsuned commented 1 year ago

btw @stiw47, I'm working on a home app replacement for webOS — AltHome!

the project is not ready for "production" yet, but you can try it. I don't have much free time right now, so no ETAs.

demo.

stiw47 commented 1 year ago

Vau, cool, will check it out for sure. I am a fan of custom launchers (e.g. never used default on Android).

In mean time, I borrowed Custom Screensaver script, put it in same folder as wallpaper, symlinked it to /var/lib/webosbrew/init.d and made that my wallpaper applies on boot. Single wall for now, maybe later I will try to make some rotation based on time for some 10 or 20 images. Something like e.g. "if com.webos.app.home not foreground...", because it would be stupid to restart the home while in front....

#!/bin/sh

set -e -o pipefail

MOUNT_TARGET="/usr/palm/applications/com.webos.app.home/qml/UserInterfaceLayer/Components/images/2k/banner_image_03.png"
WAL_PATH="$(dirname "$(realpath "$0")")/banner_image_03.png"

if [[ ! -f "$MOUNT_TARGET" ]]; then
    echo "[-] Target file does not exist: $MOUNT_TARGET" >&2
        exit 1
fi

if ! findmnt "$MOUNT_TARGET"; then
    mount --bind "$WAL_PATH" "$MOUNT_TARGET"
        echo "[+] Enabled succesfully" >&2
        sleep 1
        killall com.webos.app.home
else
    echo "[~] Enabled already" >&2
fi