RecursiveDirectoryIterator preventing snapin uploads

  • I was creating a snapin and it uploaded fine. It didn’t work for an unrelated reason, so I made a change, deleted the snapin and tried to re-upload it and keep getting this error in the notification pop-up:

    RecursiveDirectoryIterator::__construct(//boot/grub2): failed to open dir: Permission denied

    SELinux is in permissive mode. I don’t see anything interesting in either FOG’s or Apache’s logfiles.

  • @altitudehack Confirmed this was caused by running out of disk space. Growing the disk and retrying it worked, so this is solved. Thank you for your time!

  • @sebastian-roth Looks typical to me:

    ; File Uploads ;
    ; Whether to allow HTTP file uploads.
    file_uploads = On
    ; Temporary directory for HTTP uploaded files (will use system default if not
    ; specified).
    ;upload_tmp_dir =
    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 3000M
    ; Maximum number of files that can be uploaded via a single request
    max_file_uploads = 20

    Wait a second… I’m at 91% consumed on / . I think the package I’m uploading may exceed the available 580MB available on the partition. It may be a little premature of me, but it looks like this one is solved!

  • Senior Developer

    @altitudehack And you still see the exact same error message even after updating to the latest dev-branch?

    No unfortunately there is no verbose logging at this part of the code. Did you check php.ini just in case?

  • Thanks for taking a look, @Sebastian-Roth. I encountered this issue on a previous version (I think it was 1.5.4 but can’t swear to that.) Figured the first suggestion was going to be to update it, so I did a full yum update including a reboot for a new kernel, followed by an upgrade to dev-branch and now I’m on
    Is there a verbose logging option to enable?

  • Senior Developer

    @altitudehack Interesting one. I don’t think I have ever seen this before, especially with path //boot/grub2 set.

    Let’s try to dig into it. The RecursiveDirectoryIterator called should be the one in function getFilesize (code ref on github). This is being called when you add a snapin (code ref) or update an existing snapin (code ref).

    In both cases the variable $_FILES['snapin']['tmp_name']) is used, which should be set by PHP accordingly when uploading a file - see PHP code ref. So I would imagine that upload_tmp_dir directive was set in php.ini. On the other hand it doesn’t make sense because an earlier upload just worked fine.

    While I usually don’t recommend to just restart things I would give that I try in this case. Restart Apache and PHP-FPM or the whole server and see if it’s still causing the same problem. I have no idea how or why our code would possibly cause this.