Cannot mount USB drive

Thank you, looks like the issue is with permissions.

Oct 18 22:20:39 DietPi systemd[1]: Started Sonarr Daemon (DietPi).
Oct 18 22:22:11 DietPi Sonarr[1484]: [Info] Bootstrap: Starting Sonarr - /usr/li
b/sonarr/bin/Sonarr.exe - Version 3.0.6.1265
Oct 18 22:32:08 DietPi Sonarr[1484]: [Info] AppFolderInfo: Data directory is bei
ng overridden to [/mnt/dietpi_userdata/sonarr]
Oct 18 22:32:08 DietPi Sonarr[1484]: [Trace] DiskProviderBase: Directory '/mnt/d
ietpi_userdata/sonarr' isn't writable. Access to the path "/mnt/dietpi_userdata/
sonarr/sonarr_write_test.txt" is denied.

Also,

Oct 18 18:41:53 DietPi systemd[1]: Started Radarr Daemon (DietPi).
Oct 18 22:20:42 DietPi Radarr[594]: [Info] Bootstrap: Starting Radarr - /opt/radarr/Radarr - Version 3.2.2.5080
Oct 18 22:25:11 DietPi Radarr[594]: [Info] AppFolderInfo: Data directory is being overridden to [/mnt/dietpi_userdata/radarr]
Oct 18 22:32:06 DietPi Radarr[594]: [Trace] DiskProviderBase: Directory '/mnt/dietpi_userdata/radarr' isn't writable. Access to the path '/mnt/dietpi_userdata/
radarr/radarr_write_test.txt' is denied.

AND:

Oct 18 22:20:39 DietPi systemd[1]: Started Jellyfin Media Server.
Oct 18 22:32:06 DietPi jellyfin[1477]: Error whilst attempting to create folder
Oct 18 22:32:06 DietPi jellyfin[1477]: System.IO.IOException: The file '/mnt/dietpi_userdata' already exists.
Oct 18 22:32:06 DietPi jellyfin[1477]:    at System.IO.FileSystem.CreateDirectory(String fullPath)
Oct 18 22:32:06 DietPi jellyfin[1477]:    at System.IO.Directory.CreateDirectory(String path)
Oct 18 22:32:06 DietPi jellyfin[1477]:    at Jellyfin.Server.Program.CreateApplicationPaths(StartupOptions options)
Oct 18 22:32:06 DietPi systemd[1]: jellyfin.service: Main process exited, code=exited, status=1/FAILURE
Oct 18 22:32:06 DietPi systemd[1]: jellyfin.service: Failed with result 'exit-code'.
Oct 18 22:32:06 DietPi systemd[1]: jellyfin.service: Service RestartSec=100ms expired, scheduling restart.
Oct 18 22:32:06 DietPi systemd[1]: jellyfin.service: Scheduled restart job, restart counter is at 1.
Oct 18 22:32:06 DietPi systemd[1]: Stopped Jellyfin Media Server.
Oct 18 22:32:06 DietPi systemd[1]: Started Jellyfin Media Server.
Oct 18 22:32:08 DietPi jellyfin[2223]: Unhandled Exception
Oct 18 22:32:08 DietPi jellyfin[2223]: System.UnauthorizedAccessException: Access to the path '/mnt/dietpi_userdata/jellyfin/cache' is denied.
Oct 18 22:32:08 DietPi jellyfin[2223]:  ---> System.IO.IOException: Permission denied
Oct 18 22:32:08 DietPi jellyfin[2223]:    --- End of inner exception stack trace ---

Can you please help me with these, e.g. who should own what in the dietpi_userdata folder. This currently looks like this:

root@DietPi:/mnt/dietpi_userdata# ls -l
total 60
drwxr-xr-x 2 root mediamgmt 4096 Oct 16 21:22 comics
drwxr-x--- 4 root mediamgmt 4096 Oct 16 21:22 deluge
drwxr-xr-x 8 root mediamgmt 4096 Oct 16 21:22 downloads
drwxr-xr-x 2 root mediamgmt 4096 Oct 16 21:22 ebooks
drwxr-xr-x 7 root mediamgmt 4096 Oct 16 21:28 homeassistant
drwxr-x--- 9 root mediamgmt 4096 Oct 17 02:13 jellyfin
drwxr-x--- 2 root mediamgmt 4096 Oct 16 22:41 lost+found
drwxr-xr-x 2 root mediamgmt 4096 Oct 16 21:22 Music
drwxr-x--- 3 root mediamgmt 4096 Oct 16 21:22 mysql
drwxr-x--- 4 root mediamgmt 4096 Oct 16 21:22 nzbget
drwxr-xr-x 2 root mediamgmt 4096 Oct 16 21:28 Pictures
drwxr-x--- 6 root mediamgmt 4096 Oct 16 23:53 radarr
drwxr-x--- 6 root mediamgmt 4096 Oct 16 23:32 sonarr
drwxr-xr-x 5 root mediamgmt 4096 Oct 16 23:30 ubooquity
drwxr-xr-x 2 root mediamgmt 4096 Oct 16 21:28 Video

I remember, in the early days, making a group(??) called mediamgmt and then adding users to it, if that helps.
Many thanks.

It should be owned by dietpi user and dietpi group should have also full access.

dietpi@RockPi:[~]$ ls -al /mnt/dietpi_userdata/
total 44
drwxrwxr-x 11 dietpi  dietpi  4096 Απρ  23 12:03 .
drwxr-xr-x  7 root    root    4096 Μαΐ   6 09:18 ..
drwxr-xr-x  8 bazarr  dietpi  4096 Οκτ  13 03:13 bazarr
drwxr-xr-x  5 radarr  root    4096 Οκτ  19 12:39 radarr
drwxr-xr-x  7 sonarr  root    4096 Οκτ  19 12:39 sonarr

Then each application would have its own user owning the folder.

This could work, but you don’t have write permission for the mediamgmt group for each folder.

UNIX permissions are not the issue here. An additional group can only have an effect it the related directories are owned by this group :wink:. Here its root, intentionally to not allow any other user than the service itself to access these.

Is this a dedicated drive?

findmnt -T /mnt/dietpi_userdata

Can you try to manually create a file inside?

echo | sudo tee /mnt/dietpi_userdata/testfile
sudo rm /mnt/dietpi_userdata/testfile

Thanks, I think the settings messed up when I manually copied these dirs/files from the corrupt USB drive to the new one, while being logged in as root. I will try giving the main folder to dietpi and then folders to the respective applications.

Yes, this is a dedicated drive (the replacement for the previously corrupted USB drive). Root has r/w permissions. I am going to try to change these permissions as per trendy’s recommendation. That is, to set dietpi as the owner of dietpi_userdata and then set sonarr/ radarr, etc. as the owners of their dirs in there.

how did you copied the files from old to new disk. What was the command used?

Yep, silly me. Not sure what I was thinking :cry: I simply copied the files to the new USB, thinking that somehow the existing installations of sonarr, radarr, etc will pick up the existing databases without issue. It looks like not :frowning: I am not worried about anything else except sonarr and radarr, as I had a huge list of wanted, ignored, etc items which will be a pain to setup again. Is there anyway to salvage the existing databases from the files that I have? I am thinking of going nuclear and reinstalling dietpi to the latest version, as I can set up almost everything else without much trouble.
So, any idea how to recover all or part of the (sql?) database of sonarr and radarr and use them with a fresh install? Many thanks.

You have still the old HDD available? If yes you could copy data again. But this time not just using simple copy command as this will not preserve file system permission. Better to use rsync.

I have that USB drive and a couple of images that I made of it as well. I didn’t use rsync because I didn’t have another USB of the same size (64GB, replaced by 32GB). Also, when I mounted the image, it was also mounted as read-only- same problem that the USB drive had, so thought that doing an rsync might produce the same problem. On the other hand, while copying files, I saw a few errors but other than that, all files were copied on the new drive (with messed up permissions of course).

Usingrsync did not require to have source and target with same size

I believe cp -a will have the same effect in preserving ownership and permissions.

I guess it would need to be cp -p -r. But if possible I would go with rsync.

On a second thought, it will do just fine:

  -a, --archive                same as -dR --preserve=all
  -d                           same as --no-dereference --preserve=links
  -R, -r, --recursive          copy directories recursively
  -P, --no-dereference         never follow symbolic links in SOURCE
      --preserve[=ATTR_LIST]   preserve the specified attributes (default:
                                 mode,ownership,timestamps), if possible
                                 additional attributes: context, links, xattr,
                                 all

Thanks trendy Joulinar MichaIng for your help and support and sorry for a late update on my part. My internet broke down for a whole day and also, I wanted to test something before posting an update here.
So here’s what I have done.

  • 1

For Sonarr and Radarr, I formatted the USB after copying some files (Sonarr, Radarr folders) from it, and then reinstalled the apps. Using the restore backup function, I then used the copied files (which had originally come from the corrupt USB drive) to rebuild the database. For Sonarr, it went well and I can see my settings intact.

  • 2

Radarr is still giving me some pain in using the old files during the restore process but I am hopeful.
Strangely, There is another backup directory I found in the sd card (which has the OS on it), called /mnt/dietpi-backup. Not sure if I copied it there or it was made automatically. It is a tad bit older than the files from the corrupted USB but in worst case, I will try to use those for Radarr.

  • 3

For jellyfin, I simply reinstalled the app and its now scanning my media drives and rebuilding its databases. I didn’t bother to check if its has a back up restore function though.

  • 4

The only thing I am now having trouble is Ubooquity. It is running but trying to access as admin (:2038 )gives me error, :2039 obviously tells me to set it up first. Tried looking in the logs but I think its java based and I cannot make any sense of it :slight_smile: Should I open another thread for ubooquity or can someone help me with that here?

In all, another USB corrupted but lessons learnt (make regular backups). Not sure why the system has corrupted two USB drives within a relatively short span though.

Sorry for the long reply but given the help I was provided here, I felt I should report it in detail. Thanks again :slight_smile:

what is the error you have on ubooquity? Any special thinks on the logs

systemctl status ubooquity
journalctl -u ubooquity

Thanks. I am getting these:

root@DietPi:~# systemctl status ubooquity
● ubooquity.service - Ubooquity (DietPi)
   Loaded: loaded (/etc/systemd/system/ubooquity.service; disabled; vendor preset: enabled)
   Active: active (running) since Fri 2021-10-29 23:41:40 AEDT; 6min ago
 Main PID: 898 (java)
    Tasks: 39 (limit: 4915)
   CGroup: /system.slice/ubooquity.service
           └─898 /usr/bin/java -Xmx719m -jar /mnt/dietpi_userdata/ubooquity/Ubooquity.jar --headless --remoteadmin --adminport 2038 --libraryport 2039

Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [main] INFO  org.eclipse.jetty.server.Server - jetty-9.4.0.v20161208
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.ContextHandler@46d9f4{/,null,AVAILABLE,@admin}
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.ContextHandler@c69cfe{/,null,AVAILABLE,@library}
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  o.e.jetty.server.AbstractConnector - Started library@95ac9e{HTTP/1.1,[http/1.1]}{0.0.0.0:2039}
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  o.e.jetty.server.AbstractConnector - Started admin@4efc1b{HTTP/1.1,[http/1.1]}{0.0.0.0:2038}
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  org.eclipse.jetty.server.Server - Started @18766ms
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  com.ubooquity.b - Internal server started. Listening on port 2039 (library) and 2038 (admin)
Oct 29 23:42:00 DietPi Ubooquity[898]: Tyep Q then ENTER to exit
Oct 29 23:42:14 DietPi Ubooquity[898]: 20211029 23:42:14 [Timer-0] INFO  com.ubooquity.Ubooquity - Checking latest available Ubooquity version from website
Oct 29 23:42:15 DietPi Ubooquity[898]: 20211029 23:42:15 [Timer-0] INFO  com.ubooquity.Ubooquity - Latest version available: 2.1.2 - Current version: 2.1.2
root@DietPi:~#

AND:

root@DietPi:~# journalctl -u ubooquity
-- Logs begin at Thu 2019-02-14 21:11:58 AEDT, end at Fri 2021-10-29 23:51:32 AEDT. --
Oct 29 23:41:40 DietPi systemd[1]: Started Ubooquity (DietPi).
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - Running with the following parameters - headless: true, libraryport: 2039, adminport: 2038, remoteadmin: true, host: null, debug: false, execdir: /mnt/USB_for_Data/dietpi_userdata/ubooquity
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - #############################
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - #     Starting Ubooquity    #
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - #############################
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - Java version: 11.0.12
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - Java vendor: Raspbian
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - java vm name: OpenJDK Server VM
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - java runtime name: OpenJDK Runtime Environment
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - Max heap size available: 720 MB
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - OS name: Linux
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - OS version: 5.10.63-v7l+
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - OS architecture: arm
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - Loading local version info
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - Ubooquity 2.1.2 built on 2018-10-14 at 12:58
Oct 29 23:41:51 DietPi Ubooquity[898]: 20211029 23:41:51 [main] INFO  com.ubooquity.Ubooquity - Creating application folders
Oct 29 23:41:55 DietPi Ubooquity[898]: 20211029 23:41:55 [main] INFO  com.ubooquity.Ubooquity - Loading preferences
Oct 29 23:41:58 DietPi Ubooquity[898]: 20211029 23:41:58 [main] INFO  org.eclipse.jetty.util.log - Logging initialized @17554ms to org.eclipse.jetty.util.log.Slf4jLog
Oct 29 23:41:58 DietPi Ubooquity[898]: 20211029 23:41:58 [main] INFO  com.ubooquity.b - Starting internal server...
Oct 29 23:41:58 DietPi Ubooquity[898]: 20211029 23:41:58 [main] INFO  com.ubooquity.b - Reverse proxy prefix is not activated
Oct 29 23:41:58 DietPi Ubooquity[898]: 20211029 23:41:58 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Scanning books directories
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Finished scanning books directories, populating folders content cache
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Books folder content cache populated
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Scanning comics directories
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Finished scanning comics directories, populating folders content cache
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Comics folder content cache populated
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Comics statistics: [total: 0, added or updated: 0, removed: 0]
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [Scanner thread] INFO  com.ubooquity.data.feeder.a - Books statistics: [total: 0, added or updated: 0, removed: 0]
Oct 29 23:41:59 DietPi Ubooquity[898]: WARNING: An illegal reflective access operation has occurred
Oct 29 23:41:59 DietPi Ubooquity[898]: WARNING: Illegal reflective access by org.eclipse.jetty.util.BufferUtil (file:/tmp/JarClassLoader/jetty-util-9.4.0.v20161208.jar.6347727232607750212.tmp) to field java.nio.MappedByteBuffer.fd
Oct 29 23:41:59 DietPi Ubooquity[898]: WARNING: Please consider reporting this to the maintainers of org.eclipse.jetty.util.BufferUtil
Oct 29 23:41:59 DietPi Ubooquity[898]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
Oct 29 23:41:59 DietPi Ubooquity[898]: WARNING: All illegal access operations will be denied in a future release
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [main] INFO  org.eclipse.jetty.server.Server - jetty-9.4.0.v20161208
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.ContextHandler@46d9f4{/,null,AVAILABLE,@admin}
Oct 29 23:41:59 DietPi Ubooquity[898]: 20211029 23:41:59 [main] INFO  o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.ContextHandler@c69cfe{/,null,AVAILABLE,@library}
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  o.e.jetty.server.AbstractConnector - Started library@95ac9e{HTTP/1.1,[http/1.1]}{0.0.0.0:2039}
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  o.e.jetty.server.AbstractConnector - Started admin@4efc1b{HTTP/1.1,[http/1.1]}{0.0.0.0:2038}
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  org.eclipse.jetty.server.Server - Started @18766ms
Oct 29 23:42:00 DietPi Ubooquity[898]: 20211029 23:42:00 [main] INFO  com.ubooquity.b - Internal server started. Listening on port 2039 (library) and 2038 (admin)
Oct 29 23:42:00 DietPi Ubooquity[898]: Tyep Q then ENTER to exit
Oct 29 23:42:14 DietPi Ubooquity[898]: 20211029 23:42:14 [Timer-0] INFO  com.ubooquity.Ubooquity - Checking latest available Ubooquity version from website
Oct 29 23:42:15 DietPi Ubooquity[898]: 20211029 23:42:15 [Timer-0] INFO  com.ubooquity.Ubooquity - Latest version available: 2.1.2 - Current version: 2.1.2

looks like it has been started

INFO  o.e.jetty.server.AbstractConnector - Started library@95ac9e{HTTP/1.1,[http/1.1]}{0.0.0.0:2039}
INFO  o.e.jetty.server.AbstractConnector - Started admin@4efc1b{HTTP/1.1,[http/1.1]}{0.0.0.0:2038}
INFO  org.eclipse.jetty.server.Server - Started @18766ms
INFO  com.ubooquity.b - Internal server started. Listening on port 2039 (library) and 2038 (admin)

let’s check LISTEN ports

ss -tulpn | grep LISTEN

Thanks a lot Joulinar Looks like a silly mistake. The admin page is :2038/admin. A quick google search helped :slight_smile: May be the documentation should be updated according.
Once again, thank you all for your help and support. Much appreciated :slight_smile:

well our online docs reflecting this already

Admin page = http://<your.IP>:2038/admin