Loosing TVH config if started with read-only FS

Added by Manuel 3 almost 3 years ago

Hello Tvheadend Forum!
First, I'd like to thank everyone participating in this wonderful project! This is amazing! :)

I bought myself a Raspberry Pi and a Tevii S660 which work wonderfully together on Arch Linux.
However, I've already moved my root to a USB stick because of SD-Card corruption which happens every second day...
(read more about it here: http://jonathanmh.com/raspberry-pi-installing-arch-linux-on-usb-drive/)

TVHeadEnd 3.4-1
https://aur.archlinux.org/packages/tvheadend/

Now I'd like to know how I should proceed to make TVH work in a read-only environment.
I proceeded as following:
-dd'd my partition from USB to SD

-moved my resolv.conf to tmpfs
[[email protected] ~]$ rm /etc/resolv.conf
[[email protected] ~]$ ln -s /tmp/resolv.conf /etc/resolv.conf

-Mount /var/{tmp, log} as tmpfs, /etc/fstab:
tmpfs /var/log tmpfs nodev,nosuid 0 0
tmpfs /var/tmp tmpfs nodev,nosuid 0 0

-disabled some system services
[[email protected] ~]$ sudo systemctl disable systemd-readahead-collect
[[email protected] ~]$ sudo systemctl disable systemd-random-seed

-added Cronjob to manually adjust time:
@reboot /usr/bin/ntpd -qg

-then disabled ntpd service
[[email protected] ~]$ sudo systemctl disable ntpd

-and finally edited my boot config to mount RO:
root=/dev/mmcblk0p2 ro

after all this, the Pi boots nicely in Read Only from my SD Card

The Problem:
When i start the tvheadend Webif, my adapters are not enabled anymore, but detected.
Same with Channels and Muxes - gone!

Can somebody give me a hint where to look for this or whats the problem here?
Is this even possible?

Thanks!


Replies (4)

RE: Loosing TVH config if started with read-only FS - Added by Hein Rigolo almost 3 years ago

All tvheadend settings/configuration is stored in/under the .hts directory in the home directory of the user running tvheadend (usually this is user hts).

SO you need to make sure that this directory is also moved/copied over to at least some writeable location. ANd a persistant storage is also adviced because the configuration needs to be updatable also.

So I would at least use a small USB drive to place a write /home on it.

Hein

RE: Loosing TVH config if started with read-only FS - Added by Manuel 3 almost 3 years ago

Thanks for the Answer Hein!

Do you think it's possible to relocate /home/hts to RAM?
I'm thinking about copying over the contents from Read-Only /home/hts to ramdisk after boot
and then start Tvheadend pointing to the ramdisk....

Because while running a HDTV stream the Pi uses only 40mb of its 512mb ram.
And because I've also experienced corruption on USB sticks (The raspberry has some flaky USB controller...)

I know its OffTopic, but why does the .hts need writes after initial config at all? Is it because of XMLTV or what?

RE: Loosing TVH config if started with read-only FS - Added by Hein Rigolo almost 3 years ago

ofcourse you can configure your linux in such a way that /home/hts is located on a ramdrive/tmpfs location.
But then I would also create a way to store the contents of /home/hts/.hts on a more persistent location while shutting down and reloading it when restarting.

Tvheadend needs to have write access to record any changes to the contents of the data streams. Like new services, extra audio channels, moved services from one mux to an other, new muxes etc.

If you do not want a long startup and configuration each time your Pi has lost power then you can not do without persistent storage.

I have not heard of corrupted USB drives on a Pi ... but most problems relate to imperfect USB power adapters. I assume you run your USB drives via a powered USB hub .. instead of relying on the USB power from the Pi.

Hein

RE: Loosing TVH config if started with read-only FS - Added by Manuel 3 almost 3 years ago

Then I'm the first one telling you: my USB stick got corrupted after a power loss :/
I'm running my Pi on a powered Hub (Genesys Logic USB-2.0 7-Port HUB) with 2.5A power supply.
Usb peripherals exclusively connected to the hub!

But anyway thanks for the posted solutions!
I've done it your suggested way, the hts dir being on a cheap 500mb stick mounted RW.

I tried getting the ramdrive/tmpfs method to work, but I think TVH was confused with a symlink to /home/hts..
for anyone else who reads this, this may be useful:
http://www.a-netz.de/2013/02/persistent-storage-with-ramdisks/

(1-4/4)