7 Replies Latest reply on Dec 23, 2016 2:12 PM by Intel Corporation

    XDK v3759 met by permission errors upon project upload to Joule

    welcomesorrow

      I have a problem uploading projects to Joule, where Joule gives permission errors for opeing tar archived files of the project. My Joule is running Ubuntu 16.04.1 LTS, XDK v3759, and xdk-daemon. The project is Intel's sample code Bluemix Quick Start.

       

      Do I need to chown the directory to which files are uploaded?

       

      Thanks for your help. 

      imgJVML8HRB.jpg

        • 1. Re: XDK v3759 met by permission errors upon project upload to Joule
          welcomesorrow

          I am now connecting to Joule as root and permission errors are gone. However, nothing is uploaded to /node_app_slot, i.e. a symlink to /home/root/.node_app_slot.

           

          This is what I get:

           

          Upload Complete

           

          There does not appear to be a project/package.json in /node_app_slot/

          Attempting to run anyway . . .

           

          ERROR: Unable to start application! (try re-uploading a project from the Intel XDK.)

           

          Any suggestion?

          • 2. Re: XDK v3759 met by permission errors upon project upload to Joule
            Intel Corporation
            This message was posted on behalf of Intel Corporation

            Hi welcomesorrow,

             

            Thanks for your interest in the Intel Joule Platform.

             

            The Intel XDK has only been tested with the Joule using the Ostro image. Nevertheless I encourage you to contact the Ubuntu community and ask if anybody has an issue similar to yours (Intel Joule | Ubuntu developer portal ).

             

            Also I leave this link if you decide to use Ostro: (IoT - Programming your development platform with Node.js*: Intel® XDK | Intel® Software ).

             

            I hope you find this information useful, have a nice day!

             

            Best Regards,
            -Jose.

            • 3. Re: XDK v3759 met by permission errors upon project upload to Joule
              welcomesorrow

              Hi jose,

               

              Thanks for your comments. I have been looking into the xdk-daemon setup scripts and have a few basic questions.

               

              1. /opt/xdk-daemon/xdk-daemon

               

              xdk-daemon is installed in the /opt/xdk-daemon folder. This is a part of the xdk-daemon script:

               

              APPSLOT="/node_app_slot"

              /bin/mkdir -p /home/root/.node_app_slot

              if [ -h "$APPSLOT" ]

              then

                echo "$APPSLOT exists and is a symbolic link."

              elif [ -d "$APPSLOT" ]

              then

                echo "$APPSLOT is a directory (old format... updating)"

                /bin/cp -ar $APPSLOT/* /home/root/.node_app_slot

                rm -rf $APPSLOT

                /bin/ln -s /home/root/.node_app_slot $APPSLOT

              else

                echo "Creating symbolic link to $APPSLOT"

                /bin/ln -s /home/root/.node_app_slot $APPSLOT

              fi

               

              My question is why does it "mkdir" /home/root/.node_app_slot which can not be accessed from a normal user? This is the cause of all troubles. I am curious how Ostro XT  avoids this obvious permission error. It seems to make more sense if it "mkdir" /home/$USER/.node_app_slot which is accessible from the user.

               

              2. /opt/xdk-daemon/setup.sh

               

              There are syntax errors in this setup script:

               

              echo " Installing modules for daemon version manager"

              echo "--------------------------------------------------------------------"

              $SUDO cd $DIR

              $SUDO export CPLUS_INCLUDE_PATH=/usr/include/avahi-compat-libdns_sd

              $SUDO npm install

              echo " DONE!"

               

              You can not "sudo cd". It will give you an error unless $SUDO is empty. Same for export. Perhaps you can do it as follows;

               

              $SUDO sh -c "cd $DIR;

              export CPLUS_INCLUDE_PATH=/usr/include/avahi-compat-libdns_sd; npm install"

              • 4. Re: XDK v3759 met by permission errors upon project upload to Joule
                Intel Corporation
                This message was posted on behalf of Intel Corporation

                Hi welcomesorrow,

                 

                In the Ostro image you can access the .node_app_slot without any permision. See image below.

                 

                xdk_joule.JPG

                 

                I would encourage you to contact the Ubuntu community and ask why this restrictions exists.

                 

                Hope you find this information useful, have a nice day!

                 

                Best Regards,
                -Jose.

                • 5. Re: XDK v3759 met by permission errors upon project upload to Joule
                  welcomesorrow

                  Hi Jose,

                   

                  Thank you for your information and suggestions. It means that Ostro XT runs XDK with a root previledge. It also explains why "$SUDO cd $DIR" in /opt/xdk-daemon/setup.sh script should not give any error ($SUDO will be a blank if 'whoami' == "root").

                   

                  Now, my question to the XDK development team would be if one can modify the target directory from /home/root/.node_app_slot to /home/$USER/.node_app_slot (/opt/xdk-daemon/xdk-daemon). In Ubuntu 16.04.1, 'whoami' is usually not root.

                  • 6. Re: XDK v3759 met by permission errors upon project upload to Joule
                    welcomesorrow

                    I have now solved the issue by starting XDK as root;

                     

                    cd /opt/intel/XDK

                    gksudo ./xdk.sh

                     

                    One thing that has to be done is to remove $SUDO from five lines in /opt/xdk-daemon/setup.sh file which cause command not found errors. To do so, first stop xdk-daemon and then edit the setup.sh;

                     

                    systemctl stop xdk-daemon

                    sudo rm -rf /opt/xdk-daemon

                    cd ~/xdk-daemon-0100-x64-node-4.5.0

                    nano setup.sh

                     

                    Remove $SUDO from all the following lines;

                     

                    $SUDO cd $DIR

                    $SUDO exort CPLUS_INCLUDE_PATH=/usr/include/avahi-compat-libdns_sd

                    $SUDO cd $DIR/current

                    $SUDO cd $DIR/current/node-inspector-server

                    $SUDO cd $DIR

                     

                    Install a dependency library before running the setup.sh script again.

                     

                    sudo apt-get install libavahi-compat-libdnssd-dev

                    ./setup.sh

                     

                    That will allow installation of mdns, bindings, and nan node modules in /opt/xdk-daemon/current folder.

                     

                    Answere yes to the question at the end of the process, or otherwise mannualy start the daemon by

                     

                    systemctl start xdk-daemon

                     

                    An alternative approach to avoid permission errors upon writing to node_app_slot is to

                     

                    mkdir home/$USER/.node_app_slot

                    sudo rm -rf /node_app_slot

                    sudo ln -s /home/$USER/.node_app_slot /node_app_slot

                     

                    and run xdk as normal,

                     

                    cd /opt/intel/XDK

                    ./xdk.sh

                    • 7. Re: XDK v3759 met by permission errors upon project upload to Joule
                      Intel Corporation
                      This message was posted on behalf of Intel Corporation


                      Hi welcomesorrow,

                      I'm glad hear that you solved your issue!

                      Many thanks for sharing your results in such a detail manner! We appreciate your contribution since it might benefit other users.

                      If you have any more questions, please don't hesitate to ask.

                      Have a nice weekend!

                      Best Regards,
                      -Jose.