Dietpi: Two questions.

Created on 18 Jan 2020  路  22Comments  路  Source: MichaIng/DietPi

Hi

  1. I symlinked this folder /mnt/dietpi_userdata/radarr/MediaCover/ to sd card, so when i open radarr webview i dont wake up my ext hdd
    but i noticed few times that this symlink disappeared i quess after dietpi update, but not 100% sure

  2. i have zerotier installed and i tried to acess other lan devices through raspberry pi on my local network when i'm outside. in tutorial it is written that i need to add this to /etc/network/interfaces

auto eth1
iface eth1 inet manual

auto br0
iface br0 inet manual
    bridge_ports eth1 zt0
    bridge_fd 0
    bridge_maxage 0

after that i restarted, and after few hours i was unable to do what i wanted so i deleted those lines in /etc/network/interfaces and now i notice that restart is much slower then before.. what can be issue?

Edit: about second question, i uninstalled zerotier and now rpi reboot fine and quickly, not sure why.

Edit2: about first question i also noticed that folder where i symlinked all posters are missing to. here is how i symlink files to sd card

mkdir /home/dietpi/radarr_posters

chown -R radarr:dietpi /home/dietpi/radarr_posters

rm -r /mnt/dietpi_userdata/radarr/MediaCover

ln -s /home/dietpi/radarr_posters /mnt/dietpi_userdata/radarr/MediaCover
Question

All 22 comments

Hi,
many thanks for your report.

Regarding VPN, I would recommend to use one of the VPN Server available on DietPi Software catalog. There are already pre-configured and much more easier to use.

Zerotier indeed is not a VPN in particular, in the classic server <> client style, but a peer <> peer virtual network which enables different use cases. We have a software request open for it: #2843

About the network setup, from what I know it builds up as tun interface, just the same like OpenVPN. When this is not somehow done dumb, then the service configures it a way that only requests which match the same IP range (I know the embedded interface does not use IP addresses, but everything is embedded in regular TCP/IP connections of course), are sent through the Zerotier interface while all other requests are sent and answered through the regular network adapter. Else regular internet connection would be broken as well. Hence it should be possible regardless of Zerotier to connect to your DietPi from LAN and WAN as usual. How did you install it? Using the official installer? curl -s https://install.zerotier.com | bash

About the Radarr symlink, at least DietPi does not touch this in any case. If /mnt/dietpi_userdata/radarr exists even on Radarr reinstall, it would be left untouched, only the install dir /opt/radarr is upgraded. So not sure why the symlink is removed, probably Radarr itself removes it in some circumstances? I know e.g. that the log file/db/dir symlink we create by default on install (to have it logging to RAMlog) are removed during some background job... here it is: #3133 so only on Jessie as of my tests.... I'll now try to replicate both, lost RAM symlinks and the MediaCover symlink, lets see.

I installed zerotier with a script from their site months ago and was using it without any problems.. it works perfectly when i want to access rpi (radarr, sonarr, transmission) from android phone, but i wanted to access other lan devices on my local network (playstation 4) and zerotier can do this in bridge mode.. but i didnt understand that well, i guess zerotier and lan must be in the same subnet for this to work, but when i do this i cant connect to local 192.168.1.12 (local adress of dietpi) anymore from my home pc when i ssh.

I followed these tutorials

https://zerotier.atlassian.net/wiki/spaces/SD/pages/7471125/Layer+2+Bridging+of+Ethernet+and+ZeroTier+Networks+on+Linux

https://gist.github.com/laduke/98406c2eb86644901c24a453736e4014

I will try to install wireguard, if i want to access other lan devices i just add 192.168.1.0/24 (my local network) to allowed ip's?

About radarr, i thought that it has something to do with dietpi update, because every time after update folders that i deleted are coming back (Music, Video, Pictures) and if i remember some folder permissions are changing also after update, but i need to check that.. it is strange that folder MediaCover in /home/dietpi/ is deleted, can radarr delete that folder?

@Dr0bac
Ah I got it, the intention with the bridge.

Did you install bridge-utils?

apt install bridge-utils

Also does your DietPi actually have two network adapters, so that eth1 interface exists? Otherwise it would be the way it is done in the second example: https://gist.github.com/laduke/98406c2eb86644901c24a453736e4014#example
dns-nameservers 127.0.0.1 would be only correct if a DNS server runs on the machine of course, like Pi-hole, dnsmasq, unbound or such, else use the router IP or some public DNS like 1.1.1.1 (Cloudflare). And yes both IP ranges must match then AFAIK. Not sure if/how this is controlled by Zerotier, e.g. if there is a config file or such.
And of course the other eth0 definition in /etc/network/interface must be removed. At best add everything to a drop-in config /etc/network/interface.d/zerotier-bridge, so dietpi-config cannot accidentally overwrite it 馃槈.

However IMO best solution is to install Zerotier directly on all devices which shall be available and/or have connection to the Zerotier network. This bridge method looks kinda un{intended,secure,stable} to me, but partly because I do not know much about both, Zerotier and network bridges 馃槄.

Yes i installed bridge-utils and added eth1, br0 to network/interface and after that i did ifup eth1 ifup br0
Zerotier is super easy to configure if two devices have zerotier installed, this bridge mode is nothing like that :D will try wireguard, i heard only good things about it.. (super fast, secure, etc)

@Dr0bac
yes WireGuard is pretty easy to configure and it's working for me on all my mobile devices (Android, Win10 & iPhone). I have the server installed on my DietPi system (RPi4B) and can connect from all over the world to my Home Network. The client can be configured that way, that only the traffic for your privat network will be routed through the VPN tunnel. Rest of the traffic will go to the normal internet. That way I'm able to use my own DNS/PiHole from home while still being connected to the normal mobile network or whatever place you are at that time.

Agree, if it is about connecting with the home network, a classic VPN, should be best, preferably WireGuard.

Zerotier is great if you do not want to connect two "mobile" devices and do not want or cannot rely on a running server somewhere else + want to avoid the overhead of relaying data from peer1 to server and from server to peer2, but peer to peer directly instead.


I am running Radarr currently, created the MediaCover symlink and went through all tasks I can do (incl. update) from the Radarr web UI. So far everything fine. Now setting up Transmission to do some test downloads:

2020-01-19 00:42:59 root@VM-Buster:/mnt/dietpi_userdata/radarr$ l
total 432K
drwxr-xr-x 3 radarr dietpi 4.0K Jan 19 00:27 .config
-rw-r--r-- 1 radarr dietpi  420 Jan 19 00:38 config.xml
lrwxrwxrwx 1 radarr dietpi   15 Jan 18 23:56 logs -> /var/log/radarr
lrwxrwxrwx 1 radarr dietpi   23 Jan 18 23:56 logs.db -> /var/log/radarr/logs.db
lrwxrwxrwx 1 radarr dietpi   27 Jan 18 23:56 logs.db-shm -> /var/log/radarr/logs.db-shm
lrwxrwxrwx 1 radarr dietpi   27 Jan 18 23:56 logs.db-wal -> /var/log/radarr/logs.db-wal
lrwxrwxrwx 1 root   root     27 Jan 19 00:23 MediaCover -> /home/dietpi/radarr_posters
-rw-r--r-- 1 radarr dietpi 252K Jan 19 00:38 nzbdrone.db
-rw-r--r-- 1 radarr dietpi  32K Jan 19 00:42 nzbdrone.db-shm
-rw-r--r-- 1 radarr dietpi 133K Jan 19 00:42 nzbdrone.db-wal
-rw-r--r-- 1 radarr dietpi    4 Jan 19 00:38 nzbdrone.pid

Download runs, cover dir used, all links stay. Will do some internal restarts and server restarts.

@Dr0bac
You could also raise log level in Radarr and see if something is shown there.


Still everything, fine, so far I cannot replicate any issue, besides after update:

0-1-19 01:25:36.6|Info|InstallUpdateService|Waiting for external auto-restart.

So when using the internal updater, Radarr does not restart automatically. Same will be true for Sonarr and Lidarr. For this to work we would need to add Restart=on-failure to our systemd units, although I am no big fans of this since it can cause a restart loop in case of real failure. Although:

Jan 19 01:25:04 VM-Buster mono[6925]: [Info] InstallUpdateService: Radarr will restart shortly.
Jan 19 01:25:04 VM-Buster mono[6925]: [Info] InstallUpdateService: Updater Arguments: 6925 /tmp/radarr_update /opt/Radarr/Radarr.exe /data=/mnt/dietpi_userdata/radarr /nobrowser
Jan 19 01:25:36 VM-Buster systemd[1]: radarr.service: Main process exited, code=killed, status=9/KILL
Jan 19 01:25:36 VM-Buster systemd[1]: radarr.service: Failed with result 'signal'.

One more thing that i have configured is that when movie is downloaded i set it with radarr custom script to delete movie from radarr database, when movie is deleted from database, poster images are also deleted for that movie, i don't believe that this can delete root folder (mediacover) folder.
Something similar to this

https://www.reddit.com/r/radarr/comments/aicnuw/automate_removing_movies_from_radarr_once_they/

I don't know, this happened only few times in last 6 months i guess..

So we can quess that problem was with /home/dietpi/MediaCover folder, because this folder was deleted symlink was then deleted also in /mnt/dietpi_userdata/radarr so then radarr made new mediacover folder there..
In home/dietpi/ i have two script files for radarr custom script menu, and those files are still there

I will make new symlink and see next time what trigger this behavior.

@Dr0bac
Down see any reason why the script would delete the dir/symlink. It uses the Radarr API to remove the movie from database:

curl "http://$RADARRIP:$RADARRPORT/api/movie/$radarr_movie_id" -X DELETE -H "X-Api-Key: $RADARRAPIKEY" -k

Adding URL/IP, port (7878), the movie ID and personal API key, it could simply be tested manually from console.

Maybe the problem can be with DietPi-Arr_to_RAM
We update .bak database files when radarr download movie and when system goes to power off state. When i add some movie to radarr that will not be downloaded for few days, months (there is no release yet for download) and in that time dietpi shutdown via power loss or similar, i will lose that movie in radarr because .bak files were not updated. But folder with posters in mediacover directory will stay because they are not in ram.. maybe when i add next movie, that movie will have the same id name like previous movie because radarr don't know that i added last movie, because that old database don't exist anymore, and radarr will name that new folder the same like previos time ( radarr name poster folders "id1" "id2") and radarr get confused i guess.. just a crazy theory, can i test this theory without the need to unplug rpi power cable?

@Dr0bac
Probably this is related, although I am still not sure why Radarr would remove the symlink then which is still valid.

To test:

dietpi-arr_to_RAM 1 # Link database to RAM
# Add a new movie
systemctl stop radarr
rm -R /tmp/radarr_db_link # Remove database from RAM
dietpi-arr_to_RAM 0 # Store back to disk, this will fail
dietpi-arr_to_RAM 1 # Link to RAM again, which will now restore database from backup
systemctl start radarr

I will test today few times..
Can i ask, if is not to much of a hassle, can you consider changing dietpi-arr_to_RAM a little?
Can you make saving .bak files to a user predefined location? So i can store them on the sd card and update them every hour through crontab?

If you think it is not easy and quick to rewrite the script, you can leave it as it is now.

@Dr0bac
You should be able to do this by simply placing symlinks?

Would be not difficult to implement, but having too much options might get confusing and usually why would you want to move such data to the SDcard when you have dietpi_userdata already moved to an external drive to NOT have and constantly write such data to the vulnerable SDcard?

Ah, ok i will create them..
We moved database files to ram because they update itself every minute originaly because of this process in the picture

https://github.com/MichaIng/DietPi/issues/2223#issuecomment-435928563

If i update these files every hour or two on sd card that will not harm sd card to much?

@Dr0bac
The files are not that large, hence influence on SDcard should be marginal, when written only once an hour. You don't want those backup files where they are now to avoid external HDD spin-up hourly?

Yes, i like to wake up hdd only when downloading something or watching.. hdd sometimes stays for days in sleep mode..

@MichaIng I moved .bak files to sd card and created symlinks to radarr database folder, and while testing (updating with dietpi_arr_to_RAM 2) everything was ok, but when i restarted raspberry pi, i againg had .bak files in radarr database folder, symlinks are deleted.. Maybe something that dietpi_arr_to_RAM script does on system startup?

@Dr0bac
Ah yes that does not work currently: https://github.com/MichaIng/DietPi/blob/dev/dietpi/misc/dietpi-arr_to_RAM#L81
mv file symlink does not move the file to the symlink target but overwrites the symlink with the actual file.
We could use mv file $(readlink -f symlink), but there are other places where having a symlinked backup does not work currently: https://github.com/MichaIng/DietPi/blob/dev/dietpi/misc/dietpi-arr_to_RAM#L183
Okay would be possible to use readlink in all cases, actually. A better long-term solution would be to allow setting the backup dir via env var, option or config file.

Thanks @MichaIng for response, i'm not quite sure what to do from your response? did you hinted me to do something with "readlink" command, or do i need to wait for you to implement custom backup dir variable?

@Dr0bac
Basically it means that those symlinks are indeed not yet supported but I found a solution how to add it, although requires testing. If you want to test it:

Basically all cases where ${FP_DISK}.bak is handled, it needs to be wrapped into $(readlink -f ... ), so if it is a symlink, thinks will be done with the symlink target. If the backup file does not exist, readlink btw just outputs the input path/name, hence a new backup on default location would be created.

@MichaIng i edited arr_to_RAM script, and now everything work like charm. I tried:

  1. To update backups with dietpi-arr_to_RAM 2
  2. To reboot system
  3. To stop radarr and delete nzb files from ram and let it restore nzb files from backup

Backup symlinks survive everytime.

Also i Mediafolder symlink also survive little test you told me few posts above. So something else must be the problem.

I will close the issue, and will come back if i notice something new about that issue..

Can you update the arr_to_RAM script with new changes you mentioned in your last comment?

@Dr0bac
Okay I'll implement that or indeed a custom backup location. I'm just not keen to add another config file for that, would like to keep the script simple and failsafe.

Was this page helpful?
0 / 5 - 0 ratings