This is a guide (which isn’t short, unfortunately, sorry) on how to enable Samba support in your LG WebOS Smart TV.
If you want to know the story on how I came up with this, read part 1, part 2 and part 3.
If you just want the instructions, read on.
For those willing to build their own binaries for WebOS TVs, I’ve created a GCC toolchain which should work for most TVs. You can download it here.
DISCLAIMER: ROOT SHELL ALLOWS FULL UNRESTRICTED ACCESS TO YOUR TV’S LINUX OS. THIS IS VERY DANGEROUS IF YOU DON’T KNOW WHAT YOU’RE DOING. I WILL NOT BE RESPONSIBLE IF YOU BRICK OR OTHERWISE HARM YOUR SMART TV WHILE FOLLOWING THESE INSTRUCTIONS. YOU TAKE ALL RESPONSIBILITY FOR YOUR ACTIONS. IF YOU CHOOSE TO FOLLOW THESE INSTRUCTIONS PLEASE READ EACH STEP VERY CAREFULLY AND MAKE SURE YOU UNDERSTAND WHAT TO DO.
What you will need:
1. A WebOS Smart TV (of course), connected to the Internet, preferably over Ethernet.
2. A spare USB drive which you can keep inserted permanently. It would be best if this was the only USB drive or at least the only drive at the moment the TV is turned on.
3. Some Linux knowledge and patience would help as well.
This guide consists of 4 steps, each divided into substeps. I’ve tried to be as detailed as possible, but if you still have trouble following these instructions, do write in the comments.
Commands to run in the shell and text which you need to paste use this font.
Make sure to replace the text “IP address” in commands with your actual IP address !
UPDATE: I’ve replaced the mount.cifs binary inside the samba-webos-support-tar.gz archive with a more compatible version. Should now be compatible even with very old WebOS versions (tested this on 1.4).
——
Step 1: Root your TV
1. Install an app called Developer Mode from LG’s app store.
2. Go to http://developer.lge.com/main/Intro.dev and click on Sign In (the link should be in the upper right corner).
3. Click on Create Account (above the login form) and follow the instructions.
4. Start the Developer Mode app on your TV and log-in with your account.
5. Enable Developer Mode. Your TV will restart.
6. After your TV boots up, open Developer Mode app again and enable Key Server.
7. Download Cygwin (64-bit or 32-bit) and install it. Make sure you select the openssh, telnet and wget packages.
8. Open Cygwin terminal and type this command: wget http://IP address:9991/webos_rsa
(IP address of your TV should be visible in Developer Mode app)
9. Type this command: ssh -i ./webos_rsa prisoner@IP address -p 9922 '/bin/sh -i'
and enter the 6 character password from Developer Mode app. You should now be in a new shell, inside /media/developer directory.
10. In your new shell, type these commands (one after another): (NOTE: link removed, see update)
wget [link removed] -O root;
chmod +x root
./root
11. When prompted, try installing any app from the app store. You should get an error on the TV screen.
If the app installs successfully STOP HERE. Your TV’s firmware cannot be rooted with the tool provided and you will need to downgrade your firmware. There’s a link to a tutorial on how to do this in part 2.
12. Type 1111 when prompted. You should now have a root shell with no prompt. Type: id
and press Enter. You should a line of text confirming that you are now root.
——
Step 2: Make root access permanent
You now have root access but it’s not permanent. We’re going to make it permanent so you don’t have to root the TV again.
1. First, we need to change the root password and run telnet, so we can get out of the crappy LG shell (try arrow keys…). Type these commands as root:
busybox chroot /proc/1/root
mkdir /media/cryptofs/root
mkdir /media/cryptofs/root/etc
cp -r /etc/* /media/cryptofs/root/etc/
mount --bind /media/cryptofs/root/etc /etc
passwd
(type new password for root user)
nohup telnetd -l /sbin/sulogin &
2. Switch to Cygwin terminal. Type command: telnet IP address
and enter your password when prompted. You should now get a better shell to your TV.
3. In your new shell, type these commands:
cd /home/root
wget http://zebra-mirror.ddscentral.org/webos-samba/samba-webos-support.tar.gz
tar -xvf samba-webos-support.tar.gz
cd bin
chmod +x *
./edit_devmode.sh
4. You should now be in text editor. Press “i” to enter insert mode. After the first line (it should say #!/bin/sh
), add this text:
mount -o bind /media/cryptofs/root/etc /etc
telnetd -l /sbin/sulogin &
5. Scroll down until you see this code (I wanted to retain lines as they are in the actual code, zoom in if you can’t see):
if [ $OnLine ]; then
sessionToken=$(cat /var/luna/preferences/devmode_enabled);
checkSession=$(curl --max-time 3 -s https://developer.lge.com/secure/CheckDevModeSession.dev?sessionToken=$sessionToken);
if [ "$checkSession" != "" ] ; then
result=$(node -pe 'JSON.parse(process.argv[1]).result' "$checkSession");
if [ "$result" == "success" ] ; then
rm -rf /var/luna/preferences/dc*;
# create devSessionTime file to remain session time in devmode app
remainTime=$(node -pe 'JSON.parse(process.argv[1]).errorMsg' "$checkSession");
resultValidTimeCheck=$(echo "${remainTime}" | egrep "^([0-9]{1,4}(:[0-5][0-9]){2})$");
if [ "$resultValidTimeCheck" != "" ] ; then
echo $resultValidTimeCheck > ${DEVMODE_SERVICE_DIR}/devSessionTime;
chgrp 5000 ${DEVMODE_SERVICE_DIR}/devSessionTime;
chmod 664 ${DEVMODE_SERVICE_DIR}/devSessionTime;
fi
elif [ "$result" == "fail" ] ; then
rm -rf /var/luna/preferences/devmode_enabled;
rm -rf /var/luna/preferences/dc*;
if [ -e ${DEVMODE_SERVICE_DIR}/devSessionTime ] ; then
rm ${DEVMODE_SERVICE_DIR}/devSessionTime;
fi
fi
fi
fi
6. Modify it, so it looks like this (see highlighted characters for changes):
# if [ $OnLine ]; then
# sessionToken=$(cat /var/luna/preferences/devmode_enabled);
# checkSession=$(curl --max-time 3 -s https://developer.lge.com/secure/CheckDevModeSession.dev?sessionToken=$sessionToken);
# if [ "$checkSession" != "" ] ; then
# result=$(node -pe 'JSON.parse(process.argv[1]).result' "$checkSession");
# if [ "$result" == "success" ] ; then
rm -rf /var/luna/preferences/dc*;
# # create devSessionTime file to remain session time in devmode app
# remainTime=$(node -pe 'JSON.parse(process.argv[1]).errorMsg' "$checkSession");
# resultValidTimeCheck=$(echo "${remainTime}" | egrep "^([0-9]{1,4}(:[0-5][0-9]){2})$");
# if [ "$resultValidTimeCheck" != "" ] ; then
echo '900:00:00' > ${DEVMODE_SERVICE_DIR}/devSessionTime;
chgrp 5000 ${DEVMODE_SERVICE_DIR}/devSessionTime;
chmod 664 ${DEVMODE_SERVICE_DIR}/devSessionTime;
# fi
# elif [ "$result" == "fail" ] ; then
# rm -rf /var/luna/preferences/devmode_enabled;
# rm -rf /var/luna/preferences/dc*;
# if [ -e ${DEVMODE_SERVICE_DIR}/devSessionTime ] ; then
# rm ${DEVMODE_SERVICE_DIR}/devSessionTime;
# fi
# fi
# fi
# fi
7. Double and triple check to make sure you’ve changed the right lines. Then press Esc key to exit insert mode. After that, press Shift + : , type w and then press Enter key to save. After that, press Shift + : again, type q and press Enter key to exit.
8. I recommend testing you root access. Type reboot
. Wait until the TV restarts then try typing telnet IP address
in Cygwin shell again. If you get a shell, that means you did everything correctly. If you don’t get anything, restart rooting process from the beginning and make sure you do it right this time.
——
Step 3: Configure Samba
1. In Cygwin shell, type telnet IP address
. If you rooted your TV correctly, you should get a password prompt and a root shell.
2. Type this command cd /home/root/bin
to go to “bin” directory.
3. Type ./mount.cifs
. If you get usage instructions, all is fine. If you get an error STOP HERE. That means the mount.cifs
binary isn’t compatible with your TV. Post your TV model, WebOS version and the error message you get in the comments and I will try to help.
4. Connect your USB drive to the TV and wait until the TV detects it. Then type mount
command in the shell. Check for line which looks like this:
/dev/sda1 on /tmp/usb/sda/sda1 type tfat (some more stuff in parentheses)
The important parts are /dev/sda1 on /tmp/usb/sda/sda1
. /dev/sda1
is your USB drive’s device name and /tmp/usb/sda/sda1
is your USB drive’s mount point.
5. Type vi samba.cfg
to edit Samba configuration. Edit the file the same way you did with edit_devmode.sh. There’s a note above each configuration option, telling what that option does. If you don’t understand something, do post a comment and I will try to help.
6. Create a directory inside your USB drive for mounting shares on. Then create additional directories for each of your shares inside that directory. For example, my share configuration looks like this:
...
# List of shares to mount. Use double quotes around the list. List is space separated.
# For example: SHARELIST="Example1 Example2 MyPhotos MyMovies"
SHARELIST="Junkie Scrapheap Capone Stormtrooper Violet Blue Blackbird KoreanServer VenusMedia StoreServer"
# Mount point of the USB drive. Use "mount" command after inserting the USB drive to find out where it was mounted.
USB_ROOT=/tmp/usb/sda/sda1
# Directory inside your flash drive for mounting shares. Don't forget to create mount point directories for each share in it.
# For example, if your directory is /tmp/usb/sda/sda1/NAS and share name is Example1, create directory /tmp/usb/sda/sda1/NAS/Example1
# Do not delete $USB_ROOT prefix !
HOSTDIR_USB=$USB_ROOT/NAS
...
To create directories for this setup, you would run these commands:
mkdir /tmp/usb/sda/sda1/NAS
cd /tmp/usb/sda/sda1/NAS
mkdir Junkie Scrapheap Capone Stormtrooper Violet Blue Blackbird KoreanServer VenusMedia StoreServer
First command will create your share root directory, second one will go to it. Finally, third one will create all your share mount directories. I recommend you simply copy your share list (without the quotes !) from terminal for the last command.
When you’re done, type cd /home/root/bin
to return to your “bin” directory.
7. Test your configuration. Type ./smbsharemond.sh
. Wait at least 10-15 seconds. Then type catย /tmp/smbsharemond.log
This will show the mounter log. If you get any errors, check your configuration and try again. If all shares were mounted fine, read on.
8. Pick up your remote and open Photos & Videos or Music app (or SmartShare app in older TVs) on your TV. Select your USB drive and navigate to your shares directory. Then try opening one of the share directories. Your shared files should be visible. You can try opening a file if you want.
You’ve successfully added Samba support to your WebOS TV. But there’s still one more thing to do: make the share mounts permanent.
——
Step 4: Make share mounts permanent
1. Go to your “bin” directory if you’re not already there (that command again cd /home/root/bin
) and type ./edit_devmode.sh
.
2. Enter insert mode with i key. Then, below line
telnetd -l /sbin/sulogin &
insert this text:
/home/root/bin/smbsharemond.sh
Then save and exit the same way as you did before.
3. Reboot your TV by using the reboot
command. After your TV boots, wait 40 – 50 seconds. Then open Photos & Videos or Music app and check your shares again. Your files should still be visible.
Congratulations ! Your setup is complete. Enjoy using your Samba shares !
——
Additional notes
1. The mounter script is designed to remount all your shares automatically every time you turn on your TV. It will take about 30 seconds or so for the shares to be remounted after the TV is turned on.
2. Do not unplug your USB drive when using the shares or they will be dismounted. I recommend keeping the drive plugged-in all the time when the TV is on if possible.
3. If you have downgraded your TV’s firmware, do NOT update it back to the latest version or you will lose both root access and Samba. To disable update nags, open root shell to your TV (telnet IP address
), type vi /etc/hosts
and insert these lines:
127.0.0.1 snu.lge.com
127.0.0.1 rdvs.alljoyn.org
127.0.0.1 fi.lgtvsdp.com
127.0.0.1 us.lgtvsdp.com
127.0.0.1 in.lgtvsdp.com
127.0.0.1 fr.lgtvsdp.com
The save and quit the same way as you did before.
4. I’ve only tested this configuration with Samba shares on my Linux server. Using Windows shares is possible but you will most likely need to edit your mount options (OPTIONS in samba.cfg). Let me know I will try to help if you can’t get Windows shares to work.
5. The mounter script assumes all shares are always available and will not remount shares if computer hosting them is turned off. To force remount your shares, turn your TV off and back on again.
6. Although using WiFi will work, Samba will likely be much slower than over wired Ethernet.
If you have any questions, post in the comments below.
———
UPDATE: 03/01/22: Unfortunately, because someone has reported the download link for webOS jailbreak binary as malware to my domain host, I can no longer host the binary on my server. You will have to find and download it yourself from elsewhere (replace “[link removed]” with an actual link). Otherwise, the instructions stay the same.
This binary is a system-specific jailbreak tool which has absolutely no use outside of webOS and which cannot be used without the owner manually installing and running it through SSH.
But I guess some uneducated moron knows better… Sorry folks.
P.S.: If you can’t find the binary yourself on the web, drop me an e-mail (see Requests for address), I will check if I still have the binary laying around somewhere in my stash of old files. But I can no longer host it publicly.
Hello everyone.
The comment system is fixed now, thanks to a fellow reader who emailed me about this.
You are welcome to post your comments and suggestions.
How you get โbinโ directory writable? I have error filesystem read-only :((
Thank you for your comment.
I had this issue with my older WebOS 1.4 TV where after telnet login, you would end up in the file system root / instead of /home/root.
You need to run this command:
cd /home/root
before running
wget
in part 3 of Step 2.I’ve added this to the instructions.
Great Tutorial! Nice to see hacks coming available for WebOs and some ideas on how to use it.
If I have some time I will also play around with my LG TV more and try for example to get to run XBMC/Kodi or things like HomeAssistant (which can by the way trigger Notifications on LG Tvs from remote).
One thing I was wondering on your effort. I am able to access my NAS files with my LG WebOs out of the box with the Application SmartShare. I think I had to enable DLNA on my NAS, but not sure.
That’s the catch. You need DLNA for NAS to work. I couldn’t get my WebOS TV to detect my home server (running Ubuntu), so I’ve decided to hack the TV to work with Samba.
As for Kodi, it can be done as WebOS is basically a normal Linux distro with UI running on Wayland. Someone tried to do it already (link), but gave up and provided no information on how to do it.
I have built a toolchain targeting WebOS, I have plans to port Kodi to WebOS sometime in the future, but unfortunately, I don’t have enough free time.
Hi,
nice, compact tutorial ๐
How do you download a file, if the browser of the smarttv denies to do so?
This happend on an LG 43UJ6309.
I was able to downgrade my firmware to 04.31.20 using the instructions linked to here, however I want to mention to anyone that you should NOT ever upgrade to firmware 05.30.25 or later as it will NOT allow you to downgrade anymore.
This is mentioned in this russian post http://webos-forums.ru/post23656.html#p23656. It also says that supposedly there are some 5.40.x test firmware versions that you can upgrade to that will then allow you to downgrade again, howevr I have not been able to get any of these to work with my north-american TV.
So, I was able to downgrade from 05.30.25 by first upgrading to test version from here
https://www.avforums.com/threads/lg-b6-oled-tv-owners-and-discussion-thread-part-6.2109692/page-141#post-26604009
Also, something else weird happened to me after downgrading; the audio quality from the internal speakers became terrible for some reason (like it sounded muffled or like the sound was coming out of tiny phone speaker). I tried re-upgrading and a factory reset and neither would fix it. Eventually I had to buy a service remote from ebay, press the ADJ button and enter password 0413 to get to the service menu, then goto tool menu 3, and change the audio amp setting from ntp7515 2amp -> ntp7515 1amp, then power cycle the TV. Hopefully this will help if someone else has a similar issue.
Hi! And thank you for what you already did!
Did you try some other important thing with Root? (or maybe you know how to do it… )
1. Importantent – add extfat support on tv.
2. Add more codec support (audio or video)
3. Make backup firmware?
4. Try to flash custom firmware.
5. (very important for me – reasign button on Remote Control and add FAST subtitle on\off button!!! I realy dont understand why they removi it…cause Netcast have it.
6. e.t.c. Midnight Commander, usb modem driver…
1. My newer webOS TV already has exfat support (Tuxera driver), but if your TV doesn’t have exfat, it should be possible to build a driver using LG’s kernel sources and a compatible toolchain (my toolchain should do).
2. Not possible. All decoding is done through hardware and the decoded video is displayed directly on the screen through decoder’s own internal video output, bypassing webOS entirely.
3. You can dump the internal eMMC to an external drive with a simple DD command.
4. It’s doable but without some kind of recovery mode, you will only have one shot. If you mess something up to the point the TV will not boot correctly, you’ll have yourself a very expensive dummy TV, which will require external re-flashing of the eMMC and a firmware backup to fix.
I would strongly suggest not touching the main OS, unless you know what you’re doing.
5. The controls are most likely handled by the main UI process, not Linux. Unless there’s a config file somewhere, you will most likely have to patch the main binary file to reassign controls.
6. All terminal apps (including mc) should work fine through a terminal client. Modems are doable too.
Im surprised about exfat. It is realy included on new tv or you build it?
Wich webos you have on your new tv?
Please help with compile exfat driver for webos 3.0
Also…i dont understand why webos not support native linux fs ext2-4
also one question…
did you not try a make Samba\cifs server on webos? I mean its cool to connect USB HDD to tv and copy what you need directly to tv.
My mistake, there’s no exFAT. LG didn’t build the Tuxera’s texfat.ko driver, only tntfs and tfat. I wonder why. When I saw the tntfs.ko module in the OS, I automatically assumed that there’s texfat.ko as well, but there isn’t.
Both of my TVs (one runs webOS 1.4, other runs 3.3.1) run derivatives of the same 3.10.19 kernel. Both have Tuxera drivers for NTFS and FAT but not exFAT.
Samba should work just fine, provided you have the right binaries. Ubuntu ARM binaries should run just fine in chroot. You can also do a native build using my toolchain. Heck, you can even run Transmission if you so desire ๐
Both of my TVs support all common Linux file systems Here’s a dump of /proc/filesystems:
cat /proc/filesystems
nodev sysfs
nodev rootfs
nodev bdev
nodev proc
nodev cgroup
nodev cpuset
nodev tmpfs
nodev devtmpfs
nodev debugfs
nodev sockfs
nodev pipefs
nodev anon_inodefs
nodev rpc_pipefs
nodev devpts
ext3
ext2
ext4
nodev cramfs
squashfs
nodev ramfs
vfat
msdos
nodev ecryptfs
nodev nfs
nodev cifs
ntfs
nodev autofs
fuseblk
nodev fuse
nodev fusectl
jfs
nodev mqueue
tntfs
tfat
and one more thng…
do you know path wich useed for downloading tv update? (i want delete temp files) I push update by mistake and then fast turned off tv, now every time it ask to “try instal update again” even after Factory Reset. So…looks like this files not deleted.
I would suggest you to let it update and then do a downgrade.
Make sure you block the update servers so that the TV doesn’t try to update again.
You may have to re-do root and Samba support after the downgrade.
I do not want to rush.
wanna just try “downloaded” files. But is better when you know whre to find it.
I hope its not downloaded to protected area.
You tald abou ext Fs’s you mean that show disk right on BuildIn Tv application? Or it accessible only in commandline?
* try to Delete
Not sure if ext4 formatted disk will work on it’s own, but the same trick I’ve described in these instructions (using FAT32 drive as a mount point for CIFS) should also work with ext4.
You’ll need to make sure the drive has the right permissions set so the TV application can access it.
About CODEC’s. I understand what you mean about hardware decoder.
But i of course ask about software solution.
All we know that OS (windows for example) can soft decode files via PROCESSOR(even without hw decoding support). SO…that quastion about it.
Doable in theory (someone even managed to get Kodi working on webOS as a native app), but webOS TVs have pretty weak main CPUs. Your phone probably has a better chip than your TV.
My webOS 1.4 model has a dual-core LGE LG1311 B1 chipset (ARM Cortex-A9) with 1 GB of usable RAM and some kind of PowerVR GPU. That’s weaker than a second generation Raspberry Pi.
My webOS 3.3.1 TV runs on a quad-core Realtek RTD299O chipset (ARM Cortex-A53) running at 1.0 GHz with ~1.1GB usable RAM and also a PowerVR GPU (no way to find out the model). This is comparable to a Raspberry Pi 3. The Realtek chip should (in theory) be able to do 1080p h264 in software, but the LG chip likely won’t even handle 720p.
To build the exFAT driver, you’ll need to download LG’s kernel sources from their website and build the kernel using a compatible toolchain (check the compiler version of your TVs kernel, it should be at the very beginning of dmesg. My toolchain MIGHT work, but but don’t count on it).
Then build the exfat-nofuse driver against LG’s kernel.
These steps aren’t trivial and require some knowledge of Linux. I don’t have time to make a detailed guide (it would probably be much longer than the instructions in this post).
There are instructions available online on how to cross-compile out-of-tree drivers. Google is your friend.
Is it possible to increase the timeshift buffer
At my TV it is 90 minutes. I would like to fill the entire USB disk (several hours)
Timeshift size is probably controlled by the main TV UI binary. Unless there’s a configuration file somewhere to set the timeshift buffer size (unlikely), you would need to patch the main binary to change it.
If you decide to modify your TV’s OS, don’t touch the squashfs partitions.
Do you think that the TV binary is at squashfs partition so I need to modify it in order to
change the UI binary?
In any case I do not have the capability to patch the UI binary myself.
But I could do tests if there was a procedure to change the timeshift buffer and there
was a method to “factory reset”
Main binary is stored in a squashfs partition. On my webOS 1.4 it’s in /mnt/lg/tvservice/lgapp/tvservice
You can mount a writable partition on top of a squashfs mount (see instructions for /etc). But there’s no point if you can’t patch the binary blob.
Could we install a desktop environment in ubuntu chroot ?
Like https://forum.samygo.tv/viewtopic.php?t=7898
Samsung TVs run Tizen which IIRC runs an X server. LG’s WebOS uses Wayland for display instead of X.
In theory, any Wayland app should run on LG Smart TVs. You’ll need to package your apps as native WebOS packages though (yes, WebOS can run native code apps, even though LG doesn’t officially support this), otherwise the system will immediately suspend them after launch.
You can, of course, run X using Xvnc in chroot, but it will be slow.
Thanks. Nice tutorial btw
Is there any way to get root access on newer tizen os samsung tvs?
Download link for the jailbreak binary has been removed, see post update.
thanks for link update. Cheers!