Error trying to share btrfs subvolumes with '@' prefix in their names using NFS add shares GUI

    • OMV 3.x
    • Resolved

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Error trying to share btrfs subvolumes with '@' prefix in their names using NFS add shares GUI

      I've been using btrfs for a few years and this week decided to make a dedicated NAS instead of relying on my PC. Installation of Debian and OMV went smoothly and I transplanted my data disks from my PC into my new (as new as you can get on freecycle and ebay for a £25 outlay :/ ) NAS. A few clicks and by btrfs RAID1 mirror was back.

      My NAS box is running OMV 3.0.59 erasmus, 64-bit AMD 4.7.0 backport kernel and omvextrasorg 3.4.15. (I'm using the 4.7 kernel because I use btrfs on my disks and want to use the most recent btrfs-progs that is currently available)

      I hit a snag when I tried to setup NFS shares for my various subvolumes which I have named using the semi-adopted convention of using an '@' symbol to prefix subvolume names to make it easy to distinguish subvolumes from directories at a glance, e.g. subvolume '@photos' vs a directory, e.g. 'Maldives_XMAS_2017'. However, it is impossible to share the subvolumes directly because of the '@' symbol in their names. As a workaround I have created symlinks to my subvolumes for now.

      The recreate the problem simply create a subvolume called '@test' then try to share it using OMV's NFS add share GUI which fails with:

      Source Code

      1. fsname: Failed to match exactly one schema.
      2. Error #0:
      3. exception 'OMV\Json\SchemaValidationException' with message 'fsname: Failed to match exactly one schema.' in /usr/share/php/openmediavault/json/schema.inc:688 Stack trace:
      4. #0 /usr/share/php/openmediavault/json/schema.inc(375): OMV\Json\Schema->checkOneOf('/media/24e40b77...', Array, 'fsname')
      5. #1 /usr/share/php/openmediavault/json/schema.inc(297): OMV\Json\Schema->validateString('/media/24e40b77...', Array, 'fsname')
      6. #2 /usr/share/php/openmediavault/json/schema.inc(257): OMV\Json\Schema->validateType('/media/24e40b77...', Array, 'fsname')
      7. #3 /usr/share/php/openmediavault/config/datamodel.inc(155): OMV\Json\Schema->validate('/media/24e40b77...', 'fsname')
      8. #4 /usr/share/php/openmediavault/config/configobject.inc(189): OMV\Config\DataModel->validateProperty('fsname', '/media/24e40b77...')
      9. #5 /usr/share/php/openmediavault/config/configobject.inc(271): OMV\Config\ConfigObject->set('fsname', '/media/24e40b77...', true)
      10. #6 /usr/share/php/openmediavault/config/configobject.inc(233): OMV\Config\ConfigObject->setFlatAssoc(Array, true, false)
      11. #7 /usr/share/openmediavault/engined/rpc/nfs.inc(192): OMV\Config\ConfigObject->setAssoc(Array)
      12. #8 [internal function]: OMVRpcServiceNfs->setShare(Array, Array)
      13. #9 /usr/share/php/openmediavault/rpc/serviceabstract.inc(124): call_user_func_array(Array, Array)
      14. #10 /usr/share/php/openmediavault/rpc/rpc.inc(84): OMV\Rpc\ServiceAbstract->callMethod('setShare', Array, Array)
      15. #11 /usr/sbin/omv-engined(516): OMV\Rpc\Rpc::call('NFS', 'setShare', Array, Array, 1)
      16. #12 {main}
      Display All
      The problem does not occur when I dont use the '@' symbol in the subvolume name, e.g. test2 created with 'btrfs sub cre test2' can be shared without issue. Creating a symlink 'ln -s @test test3' and sharing the 'test3' symlink also works without problem.

      Is this actually a bug in OMV or am I doing something wrong :?: .

      Thanks in advance,
      Sophie x
    • Please open a bug report. I've looked into the code, but the regex was a little bit complicated to understand (without a comment ?( ), so i need to have a deeper look into it.
      Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • subzero79 wrote:

      there is maybe a restriction pattern in the datamodels conf file not sure. Also seeing your thread I recall someone else's mentioned this problem before....not sure.

      Cc @votdev

      votdev wrote:

      Please open a bug report. I've looked into the code, but the regex was a little bit complicated to understand (without a comment ?( ), so i need to have a deeper look into it.


      Thank you votdev and subzero79, I see. I have learnt that the behaviour of almost everything in Linux can be modified through configuration files and so I went looking. The file that ultimately throws a SchemaValidationException is /usr/share/php/openmediavault/json/schema.inc, specifically the checkOneOf function. Unfortunately I don't unerstand enough to know which schemas that function is testing against or where they are defined. I have found some OMV specific schemas defined in /usr/share/php/openmediavault/datamodel/schema.inc but I suspect that this is not the place to look and I need to find where the default JSON schema definitions are stored.

      votdev can you tell me where the schema is defined please? I'd like to debug this myself if I can but fear my lack of experience is going to frustrate my efforts. I'd be grateful If you or anyone else can point me in the right direction. In the meantime I shall continue reading spacetelescope.github.io/under…ng-json-schema/index.html for enlightenment :/


      Sophie x
    • Absolutely no support through PM!

      I must not fear.
      Fear is the mind-killer.
      Fear is the little-death that brings total obliteration.
      I will face my fear.
      I will permit it to pass over me and through me.
      And when it has gone past I will turn the inner eye to see its path.
      Where the fear has gone there will be nothing.
      Only I will remain.

      Litany against fear by Bene Gesserit
    • Wow, you've fixed it already. I've been trying to get my head around regular expression syntax, a task where having Sherlock Holmes' 'Mind Palace' would help.

      I can happily confirm that after modifying the regex for dirpath in .../datamodel/schema.inc and rebooting my OMV NAS I am able to share my subvolumes without having to resort to renaming them or using symlinks.

      Thank you very much Volker :D
      Sophie x

      PS sorry for using the f**r word previously =O