LANraragi Using Experience
Preface
I have been using LANraragi for a while and encountered some issues. I managed to resolve them, and I thought it would be a good idea to document my experience in a post. You can refer to my previous article on installing LANraragi first.
Issue 1: Mounting Thumbnail Directory Causes Thumbnail Generation Failure
When installing LANraragi, to ensure the content
directory is read-only, I set the thumbnail directory as an internal path of the container. This means that every time I deleted and restarted the container, thumbnails will be regenerated. This practice not only wasted computational resources but also deviated from Docker’s best practices. To address this, I used a new volume to store the thumbnails.
1 | version: "3" |
lanraragi-thumbnail
is the volume for storing thumbnails.
After starting the container, I noticed that thumbnails could not be generated. Upon entering the ‘Minion Console’, I found the following error:
Why did mkdir
not have permission? I entered the container:
1 | /home/koyomi/lanraragi # ls -lah |
Note the thumb
directory created by the root
user, but the user running LANraragi, koyomi
, does not have write permission to that directory. Just granting permission:
1 | chmod 777 thumb |
Then, in ‘Tags and Thumbnails’, click on ‘Generate Missing Thumbnails’.
It’s also worth noting that the default manga directory,
content
, has elevated permissions intentionally set by the author. Therefore, usingcontent/thumb
as the default thumbnail directory will not cause this issue.
Issue 2: Real-Time File Monitoring Failure
Refer to the ‘Background Workers’ in the settings:
This File Watcher is responsible for monitoring your content directory and automatically handling new archives as they come. If Shinobu is dead or unresponsive, you can reboot her by clicking this button.
While it should monitor file changes in real-time, I couldn’t use this feature. The reason is that this feature utilizes the inotify
API:
The inotify API provides a mechanism for monitoring filesystem events. Inotify can be used to monitor individual files, or to monitor directories. When a directory is monitored, inotify will return events for the directory itself, and for files inside the directory.
If the file system does not support this API, obviously, LANraragi cannot monitor file changes.
I use VMware’s shared folder to map manga resources to Linux, and the underlying file system of the shared folder does not support inotify
.
Solution: Click ‘Restart File Watcher,’ which will scan the entire content
directory after restarting. Alternatively, write a scheduled task script to POST /api/shinobu/restart
.
In fact, many software applications use inotify
to monitor file changes, making this a common issue.
My Jellyfin media folder also uses VMware’s shared folder, so it faces the same problem. However, Jellyfin is more popular, which allowed me to find the cause to this issue quickly from related posts. More importantly, Jellyfin explicitly states that only file systems supporting inotify
have this functionality, which is a good practice for other software authors to follow when documenting.
Real Time Monitoring
This will let Jellyfin automatically update libraries when files are added or modified. Unfortunately, this feature is only supported on certain filesystems.
For Linux systems, this is performed by inotify. NFS and rclone do not support inotify, but support can be provided by using a union file system such as mergerfs with your networked file systems.
By the way, here’s the solution for Jellyfin:
- Increase the frequency of the scheduled task ‘Scan Media Library’ – this task doesn’t consume many resources, so running it frequently is not an issue.
- Execute a refresh through the API.
Gains
This script is quite useful:
My manga directory structure is:
1 | ├── Author1 |
This script categorizes the corresponding manga into a specific author’s category. Although I did not (and will not) tag manga, using author as a category achieves the same effect, allowing me to select manga based on the author.
References
- inotify(7) — Linux manual page
- LANraragi doc: Shinobu API
- Jellyfin doc: Real Time Monitoring
- Jellyfin not picking up new files on docker mount
- 我的Jellyfin影视库 搭建、信息刮削小记
- Shared folders and inotify: Does it work with VMWare + Any way to run Vagrant + VMWare in trial period?
- How does the Scheduled Task for Scan Media Library work?