Following a recent system refresh, a significant alteration has been observed in how Tvheadend manages user profiles and directories. Unlike previous iterations where a specialized hts user and group were established alongside a dedicated /home/hts directory, the current version continues to operate under the hts user identity but opts to house all data within the /var/lib/tvheadend directory. The rationale behind this shift remains unclear, yet it has introduced several unforeseen consequences, particularly when operating under Ubuntu Server.
The primary challenge stems from Tvheadend's apparent inability to access any resources outside of the /var/lib/tvheadend directory or its immediate subfolders. Despite configurations allowing for universal read/write permissions, Tvheadend fails to recognize or interact with data located beyond these confines. This limitation presents dual challenges concerning Tvheadend updates.
Firstly, an update cycle may inadvertently lead to Tvheadend perceiving itself as the owner of the /var/lib/tvheadend directory, potentially resulting in the deletion or modification of user-stored data. While this scenario poses minimal risk given the existence of redundant data copies, the second challenge is more critical. When utilizing an external storage device for recording purposes, it must be mounted within the /var/lib/tvheadend directory; otherwise, Tvheadend will either refuse to utilize it or fail to acknowledge its presence.
This predicament escalates significantly if Tvheadend mistakenly assumes ownership and autonomy over the directory contents, enabling unrestricted deletion or alteration. Additionally, a concern raised by a Kodi user highlights Tvheadend's backup process upon updating, which targets the /var/lib/tvheadend directory for duplication into /var/lib/tvheadend/backup. This operation may prove time-consuming or outright fail if the external drive hosts substantial data volumes.
Consequently, during a standard apt update/upgrade sequence, Tvheadend may fail to restart if an update is pending. Rebooting in frustration only exacerbates the situation, as Tvheadend resumes the backup process upon relaunch. This cycle ensures Tvheadend will not restart if the external drive is mounted and exceeds the local drive's data capacity. However, the critical twist lies in the temporary unmounting of the external drive to facilitate Tvheadend's completion. Upon resumption, Tvheadend detects the absence of recordings, leading to their removal from the completed recordings list. Although the files remain intact upon remounting, Tvheadend remains oblivious to their existence.
A potential workaround involves introducing a "protected" subdirectory within /var/lib/tvheadend (e.g., /var/lib/tvheadend/user), designated for user data or mount points, safeguarded against Tvheadend's modifications or backups. However, this solution necessitates changes to the Tvheadend software.
The puzzling aspect is the apparent lack of discussions regarding this issue within relevant forums, despite its impact likely extending beyond individual experiences. It raises questions about alternative solutions that might have eluded broader attention. Moreover, the absence of constructive feedback on platforms such as the Kodi forum underscores the complexity of addressing this issue, especially under Ubuntu 22.04.