KVM 9p passthrough seems flakey. Permissions issues?


Recommended Posts

Hi there, I'm an unraid newbie running  6.0-beta10a on a HP microserver n54l.

 

I'm trying to passthrough /mnt/user to a Ubuntu Server 14.10 VM so it can access all my shares.

 

The issue I'm having is Sonarr (AKA NZBDrone) is giving lots of issues like:

System.IO.DirectoryNotFoundException: Could not find a part of the path "/mnt/unraid/TV/Would I Lie to You/tvshow.nfo".
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding)
  at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 
  at System.IO.File.WriteAllText (System.String path, System.String contents) [0x00000] in <filename unknown>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.WriteAllText (System.String filename, System.String contents) [0x00049] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:283 
  at NzbDrone.Core.Metadata.MetadataService.SaveMetadataFile (System.String path, System.String contents) [0x00000] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MetaData\MetadataService.cs:354 
  at NzbDrone.Core.Metadata.MetadataService.ProcessSeriesMetadata (IMetadata consumer, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List`1 existingMetadataFiles) [0x000a4] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MetaData\MetadataService.cs:166 
  at NzbDrone.Core.Metadata.MetadataService.Handle (NzbDrone.Core.MediaCover.MediaCoversUpdatedEvent message) [0x00092] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MetaData\MetadataService.cs:78 
  at NzbDrone.Core.Messaging.Events.EventAggregator.PublishEvent[MediaCoversUpdatedEvent] (NzbDrone.Core.MediaCover.MediaCoversUpdatedEvent event) [0x000c5] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\Messaging\Events\EventAggregator.cs:56 

 

and

System.IO.IOException: Win32 IO returned 25. Path: /mnt/unraid/TV/Would I Lie to You
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.CreateFolder (System.String path) [0x0003e] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:147 
  at NzbDrone.Core.MediaFiles.DiskScanService.Scan (NzbDrone.Core.Tv.Series series) [0x000b0] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\DiskScanService.cs:80 
  at NzbDrone.Core.MediaFiles.DiskScanService.Handle (NzbDrone.Core.Tv.Events.SeriesUpdatedEvent message) [0x00000] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\DiskScanService.cs:143 
  at NzbDrone.Core.Messaging.Events.EventAggregator.PublishEvent[seriesUpdatedEvent] (NzbDrone.Core.Tv.Events.SeriesUpdatedEvent event) [0x000c5] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\Messaging\Events\EventAggregator.cs:56

 

and

 

Series' root folder (/mnt/unraid/TV) doesn't exist.

It seems like the folders are randomly dissapearing from view on the VM?

 

Couchpotato also had some suspect looking errors:

11-30 15:45:48 ERROR [hpotato.core.plugins.base] Unable writing to file "/mnt/unraid/Downloads/Russell.Howards.Good.News.Extra.UK.S04E02.WS.PDTV.XviD-RAWNiTRO/rhgneuks04e02-rawnitro.unknown.ignore": Traceback (most recent call last):
  File "/home/liam/CouchPotatoServer/couchpotato/core/plugins/base.py", line 142, in createFile
    f = open(path, write_type)
IOError: [Errno 22] invalid mode ('w+') or filename: '/mnt/unraid/Downloads/Russell.Howards.Good.News.Extra.UK.S04E02.WS.PDTV.XviD-RAWNiTRO/rhgneuks04e02-rawnitro.unknown.ignore' 

 

This is just while scanning my TV directory to import my shows.

 

Here is the relevant section from the KVM XML

<filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user'/>
      <target dir='unraid'/>
      <alias name='fs0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</filesystem>

 

and here is the fstab entry in ubuntu:

unraid /mnt/unraid 9p trans=virtio,version=9p2000.L,_netdev,rw 0 0

 

When I initially imported all of my files from my old windows 7 fileserver, I did so from the unraid root terminal with CP from a windows HDD, so the permissions were a little off. I've since done a chown to nobody:users and a chmod to 777 (I'll pick more secure permissions once its working).

 

I'm not sure if this is relevant, but unraid and ubuntu have nobody at differed uids.

 

Its possibly a sonarr problem, as sab was able to download/extract some media fine. I have my sab/sonarr/couchpotato/headphones running as 'liam' (the ubuntu user I created at install time) which I have added to the users group.

 

I've also tried changing the KVM XML to use 'mapped' accessmode, which did not help.

 

I understand this is a tldr problem, so any help is really appriciated.

 

Cheers,

Liam.

Link to comment

Hi there, I'm an unraid newbie running  6.0-beta10a on a HP microserver n54l.

 

I'm trying to passthrough /mnt/user to a Ubuntu Server 14.10 VM so it can access all my shares.

 

The issue I'm having is Sonarr (AKA NZBDrone) is giving lots of issues like:

System.IO.DirectoryNotFoundException: Could not find a part of the path "/mnt/unraid/TV/Would I Lie to You/tvshow.nfo".
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding)
  at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 
  at System.IO.File.WriteAllText (System.String path, System.String contents) [0x00000] in <filename unknown>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.WriteAllText (System.String filename, System.String contents) [0x00049] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:283 
  at NzbDrone.Core.Metadata.MetadataService.SaveMetadataFile (System.String path, System.String contents) [0x00000] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MetaData\MetadataService.cs:354 
  at NzbDrone.Core.Metadata.MetadataService.ProcessSeriesMetadata (IMetadata consumer, NzbDrone.Core.Tv.Series series, System.Collections.Generic.List`1 existingMetadataFiles) [0x000a4] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MetaData\MetadataService.cs:166 
  at NzbDrone.Core.Metadata.MetadataService.Handle (NzbDrone.Core.MediaCover.MediaCoversUpdatedEvent message) [0x00092] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MetaData\MetadataService.cs:78 
  at NzbDrone.Core.Messaging.Events.EventAggregator.PublishEvent[MediaCoversUpdatedEvent] (NzbDrone.Core.MediaCover.MediaCoversUpdatedEvent event) [0x000c5] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\Messaging\Events\EventAggregator.cs:56 

 

and

System.IO.IOException: Win32 IO returned 25. Path: /mnt/unraid/TV/Would I Lie to You
  at System.IO.Directory.CreateDirectoriesInternal (System.String path) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.CreateDirectory (System.String path) [0x00000] in <filename unknown>:0 
  at NzbDrone.Common.Disk.DiskProviderBase.CreateFolder (System.String path) [0x0003e] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:147 
  at NzbDrone.Core.MediaFiles.DiskScanService.Scan (NzbDrone.Core.Tv.Series series) [0x000b0] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\DiskScanService.cs:80 
  at NzbDrone.Core.MediaFiles.DiskScanService.Handle (NzbDrone.Core.Tv.Events.SeriesUpdatedEvent message) [0x00000] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\DiskScanService.cs:143 
  at NzbDrone.Core.Messaging.Events.EventAggregator.PublishEvent[seriesUpdatedEvent] (NzbDrone.Core.Tv.Events.SeriesUpdatedEvent event) [0x000c5] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\Messaging\Events\EventAggregator.cs:56

 

and

 

Series' root folder (/mnt/unraid/TV) doesn't exist.

It seems like the folders are randomly dissapearing from view on the VM?

 

Couchpotato also had some suspect looking errors:

11-30 15:45:48 ERROR [hpotato.core.plugins.base] Unable writing to file "/mnt/unraid/Downloads/Russell.Howards.Good.News.Extra.UK.S04E02.WS.PDTV.XviD-RAWNiTRO/rhgneuks04e02-rawnitro.unknown.ignore": Traceback (most recent call last):
  File "/home/liam/CouchPotatoServer/couchpotato/core/plugins/base.py", line 142, in createFile
    f = open(path, write_type)
IOError: [Errno 22] invalid mode ('w+') or filename: '/mnt/unraid/Downloads/Russell.Howards.Good.News.Extra.UK.S04E02.WS.PDTV.XviD-RAWNiTRO/rhgneuks04e02-rawnitro.unknown.ignore' 

 

This is just while scanning my TV directory to import my shows.

 

Here is the relevant section from the KVM XML

<filesystem type='mount' accessmode='passthrough'>
      <source dir='/mnt/user'/>
      <target dir='unraid'/>
      <alias name='fs0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</filesystem>

 

and here is the fstab entry in ubuntu:

unraid /mnt/unraid 9p trans=virtio,version=9p2000.L,_netdev,rw 0 0

 

When I initially imported all of my files from my old windows 7 fileserver, I did so from the unraid root terminal with CP from a windows HDD, so the permissions were a little off. I've since done a chown to nobody:users and a chmod to 777 (I'll pick more secure permissions once its working).

 

I'm not sure if this is relevant, but unraid and ubuntu have nobody at differed uids.

 

Its possibly a sonarr problem, as sab was able to download/extract some media fine. I have my sab/sonarr/couchpotato/headphones running as 'liam' (the ubuntu user I created at install time) which I have added to the users group.

 

I've also tried changing the KVM XML to use 'mapped' accessmode, which did not help.

 

I understand this is a tldr problem, so any help is really appriciated.

 

Cheers,

Liam.

 

Initially replied with feedback you had already tried ;-).  I will need to look into this further, but have you tried this with any other Linux VMs and do you get the same results?

Link to comment

Thanks for the reply, I havn't tried booting any other VMs.

 

I thought Ubuntu's apparmor could've been getting in the way, but can't see anything in the usual logs (dmesg, messages, kern.log).

 

I've set the permissions to a more sensible 777 for dirs and 666 for files.

 

I tried unmounting and manually mounting the FS after the VM has started but that didn't help

System.IO.FileNotFoundException: File doesn't exist: /mnt/unraid/TV/Bad Education/Season 01/Bad Education - 1x05 - Football Match.mp4
  at NzbDrone.Common.Disk.DiskProviderBase.GetFileSize (System.String path) [0x0006e] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Common\Disk\DiskProviderBase.cs:141 
  at NzbDrone.Core.MediaFiles.EpisodeImport.ImportApprovedEpisodes.Import (System.Collections.Generic.List`1 decisions, Boolean newDownload, NzbDrone.Core.Download.DownloadClientItem downloadClientItem) [0x001a9] in m:\BuildAgent\work\328d72309b633a8\src\NzbDrone.Core\MediaFiles\EpisodeImport\ImportApprovedEpisodes.cs:76 

 

To display how flakey it is, here's me running ls a few times in a row:

liam@virtual:~$ ls -l /mnt/unraid/TV/Spaced/
total 1460
-rw-rw-rw- 1   99 users   340476 Nov  3 22:52 backdrop.jpg
-rw-rw-rw- 1 liam nogroup 113406 Nov 30 15:18 banner.jpg
-rw-rw-rw- 1 liam nogroup 340476 Nov 30 15:18 fanart.jpg
-rw-rw-rw- 1   99 users   236815 Nov  3 22:52 folder.jpg
-rw-rw-rw- 1 liam nogroup  29930 Nov 30 15:18 poster.jpg
-rw-rw-rw- 1 liam nogroup      0 Nov 30 16:52 season01-poster.jpg
-rw-rw-rw- 1   99 users   198532 Nov  3 22:52 season01.tbn
-rw-rw-rw- 1 liam nogroup      0 Nov 30 16:52 season02-poster.jpg
-rw-rw-rw- 1   99 users   103211 Nov  3 22:52 season02.tbn
-rw-rw-rw- 1 liam nogroup  46710 Nov 30 16:52 season-specials-poster.jpg
-rw-rw-rw- 1   99 users    46710 Nov  3 22:52 season-specials.tbn
-rw-rw-rw- 1   99 users     1571 Nov  3 22:52 series.xml
drwxrwxrwx 1   99 users     4096 Nov  3 22:53 Spaced.S01.iNTERNAL.DVDRip.XviD-iLS
drwxrwxrwx 1   99 users     4096 Nov  3 22:53 Spaced.S02.iNTERNAL.DVDRip.XviD-iLS
-rw-rw-rw- 1   99 users     2700 Nov 30 16:52 tvshow.nfo
liam@virtual:~$ ls -l /mnt/unraid/TV/Spaced/
ls: /mnt/unraid/TV/Spaced/: Invalid argument
ls: cannot open directory /mnt/unraid/TV/Spaced/: Invalid argument
liam@virtual:~$ ls -l /mnt/unraid/TV/Spaced/
ls: cannot access /mnt/unraid/TV/Spaced/backdrop.jpg: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/folder.jpg: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/season-specials.tbn: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/season01.tbn: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/season02.tbn: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/series.xml: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/Spaced.S01.iNTERNAL.DVDRip.XviD-iLS: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/Spaced.S02.iNTERNAL.DVDRip.XviD-iLS: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/tvshow.nfo: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/banner.jpg: Invalid argument
ls: cannot access /mnt/unraid/TV/Spaced/poster.jpg: Invalid argument
total 384
-??? ? ?    ?            ?            ? backdrop.jpg
-??? ? ?    ?            ?            ? banner.jpg
-rw-rw-rw- 1 liam nogroup 340476 Nov 30 15:18 fanart.jpg
-??? ? ?    ?            ?            ? folder.jpg
-??? ? ?    ?            ?            ? poster.jpg
-rw-rw-rw- 1 liam nogroup      0 Nov 30 16:52 season01-poster.jpg
-??? ? ?    ?            ?            ? season01.tbn
-rw-rw-rw- 1 liam nogroup      0 Nov 30 16:52 season02-poster.jpg
-??? ? ?    ?            ?            ? season02.tbn
-rw-rw-rw- 1 liam nogroup  46710 Nov 30 16:52 season-specials-poster.jpg
-??? ? ?    ?            ?            ? season-specials.tbn
-??? ? ?    ?            ?            ? series.xml
d??? ? ?    ?            ?            ? Spaced.S01.iNTERNAL.DVDRip.XviD-iLS
d??? ? ?    ?            ?            ? Spaced.S02.iNTERNAL.DVDRip.XviD-iLS
-??? ? ?    ?            ?            ? tvshow.nfo
liam@virtual:~$ ls -l /mnt/unraid/TV/Spaced/
ls: cannot open directory /mnt/unraid/TV/Spaced/: Invalid argument
liam@virtual:~$ ls -l /mnt/unraid/TV/Spaced/
ls: /mnt/unraid/TV/Spaced/: Invalid argument
total 1460
-rw-rw-rw- 1   99 users   340476 Nov  3 22:52 backdrop.jpg
-rw-rw-rw- 1 liam nogroup 113406 Nov 30 15:18 banner.jpg
-rw-rw-rw- 1 liam nogroup 340476 Nov 30 15:18 fanart.jpg
-rw-rw-rw- 1   99 users   236815 Nov  3 22:52 folder.jpg
-rw-rw-rw- 1 liam nogroup  29930 Nov 30 15:18 poster.jpg
-rw-rw-rw- 1 liam nogroup      0 Nov 30 16:52 season01-poster.jpg
-rw-rw-rw- 1   99 users   198532 Nov  3 22:52 season01.tbn
-rw-rw-rw- 1 liam nogroup      0 Nov 30 16:52 season02-poster.jpg
-rw-rw-rw- 1   99 users   103211 Nov  3 22:52 season02.tbn
-rw-rw-rw- 1 liam nogroup  46710 Nov 30 16:52 season-specials-poster.jpg
-rw-rw-rw- 1   99 users    46710 Nov  3 22:52 season-specials.tbn
-rw-rw-rw- 1   99 users     1571 Nov  3 22:52 series.xml
drwxrwxrwx 1   99 users     4096 Dec  1 18:28 Spaced.S01.iNTERNAL.DVDRip.XviD-iLS
drwxrwxrwx 1   99 users     4096 Dec  1 18:28 Spaced.S02.iNTERNAL.DVDRip.XviD-iLS
-rw-rw-rw- 1   99 users     2700 Dec  1 18:28 tvshow.nfo

Link to comment

I don't know if this helps but I usually symlink the 9p mounts.  So I have a /tv directory that points to /mnt/users/tv_shows.

I might have change users.  I looked in /etc/group and my users shows 100.

And I run everything under user nobody.

Any reason for the symlink? Don't really want to add it unless it's likely to help!

 

I think users is at the same gid but nobody is a different uid!

 

The vms run as root, which I think is typical for KVMs.

Link to comment

I don't know if this helps but I usually symlink the 9p mounts.  So I have a /tv directory that points to /mnt/users/tv_shows.

I might have change users.  I looked in /etc/group and my users shows 100.

And I run everything under user nobody.

Any reason for the symlink? Don't really want to add it unless it's likely to help!

 

I think users is at the same gid but nobody is a different uid!

 

The vms run as root, which I think is typical for KVMs.

 

The reason for the symlink is mainly for portability. So I can change the 9p mount and I just have to update the symlink or move to a docker.  But when I used xen the symlink seemed to help with cifs shares dropping. Try a symlink and run your ls test again.

 

I checked and I did change nobody to uid 99. The kvm vm's running as root doesn't matter. By apps I meant sickbeard, nzbget, etc. I run them on ubuntu as nobody so the permissions don't get messed up on the 9p mounted cache drive where I download to.

 

Link to comment

Thanks for that, I shall try a symlink. Are there any issues with changing the uid of nobody in ubuntu? it's currently  in the 64000's IIRC.

I don't know that the symlink will help much but it's easy to do  I think changing nobody to 99 will help and running your programs as nobody. Otherwise I think when media gets sent back to unRAID the permissions will be for root or whatever user your running the programs as.

 

Another issue you might have too is programs starting before the shares are mounted. I had this with sickrage. There would be no tv shows sometimes.  I use noauto in fstab and /etc/rc.local to mount.  And I changed the S script numbers to 99 and rc.local  to 98.

 

And as far as nobody uid 99. I don't really know. But as long as your not replacing a user that has 99 then it should be fine.  I haven't had any issues. I've been using it for months.

Link to comment

I think it may have been due to me sharing /mnt/user as I've changed it to specifically share /mnt/user/TV and mounted that within ubuntu and it seems much more stable.

I'd rather not have to create XML and fstab entries for 15+ user shares for each VM but meh...

 

I managed to run rm -rf on the TV dir from the VM when I thought it was unmounted but was not  :-[ So I'll have to wait for my TV to finish copying back over to unraid (about 24 hrs remaining, lightning took out my old servers network port so its USB2 WiFi) before I can fully test it.

Link to comment
  • 2 weeks later...

Unfortuantely I don't think this is fixed. Still seems to cause the same errors especially importing/scanning (I guess heavy disk access).

 

I don't think its permissions related that all seems to be fine now. Some files work a second time round etc so I don't think permissions could cause an intermittent fault.

 

This happens on debian wheezy too. I tried Centos but it doesn't support 9p mounts without recompiling the kernel...

 

NFS mounts work fine, seems to be quicker actually.

 

Any other ideas anyone?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.