Search code examples
aptevolus-pencil

mv: cannot stat 'pencil.desktop': No such file or directory


I have been trying to install the Pencil Project on Ubuntu-18.04 to design user interfaces before implementing it. I have been having the following installation problem and I am not sure why. After downloading it I only

sudo apt install ./pencil_3.1.0.ga_amd64.deb && sudo apt install -f

Below the warning:

emanuele@pc:~/Downloads$ sudo dpkg -i pencil_3.1.0.ga_amd64.deb && sudo apt install -f (Reading database ... 257381 files and directories currently installed.) Preparing to unpack pencil_3.1.0.ga_amd64.deb ... Unpacking pencil (3.1.0.ga) over (3.1.0.ga) ... rm: cannot remove '/usr/share/applications/pencil.desktop': No such file or directory rm: cannot remove '/usr/share/applications/pencil.png': No such file or directory Setting up pencil (3.1.0.ga) ... mv: cannot stat 'pencil.desktop': No such file or directory mv: cannot stat 'pencil.png': No such file or directory chmod: cannot access '/usr/share/applications/pencil.*': No such file or directory Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 529 not upgraded.

And I am not sure why is not being installed. I consulted this source and also this and both sources said that there is a missing file in the folder indicated in the warning. There seems to be a missing icon or .png. But I downloaded the .deb from the official documentation. and simply

 sudo apt install ./pencil_3.1.0.ga_amd64.deb && sudo apt install -f

Solution

  • This is neat, let me tell you what I think is happening

    Unpacking pencil (3.1.0.ga) over (3.1.0.ga) 
    

    You installed 3.1.0.ga, and are now reinstalling (it should be fine to reinstall packages)

    rm: cannot remove '/usr/share/applications/pencil.desktop': No such file or directory 
    rm: cannot remove '/usr/share/applications/pencil.png No such file or directory
    

    It is trying to uninstall it self, from the first install. (The first install did not put these file here, so they can't be found the uninstall)

    Setting up pencil (3.1.0.ga)
    

    It is starting the install

    mv: cannot stat 'pencil.desktop': No such file or directory
    mv: cannot stat 'pencil.png': No such file or directory
    chmod: cannot access '/usr/share/applications/pencil.*': No such file or directory
    

    These three lines are the root of your issue. I downloaded the package, and the files are all present, but I assume it is a path issue.

    So, lets look at the script that is not able to move the files correctly. It is called postinst, and it is a shell script

    #!/bin/sh
    
    NAME=pencil
    VERSION=3.1.0.ga
    EXECUTABLE=pencil
    
    mkdir -p /opt/$NAME-$VERSION
    
    APP_PATH=/usr/share/applications
    
    cd /opt/$NAME-$VERSION
    mv $NAME.desktop $APP_PATH/
    mv $NAME.png $APP_PATH/
    chmod 644 /usr/share/applications/$EXECUTABLE.*
    
    cd /usr/bin
    
    if [ -L $EXECUTABLE ]; then
        rm $EXECUTABLE
    fi
    
    ln -s /opt/$NAME-$VERSION/$EXECUTABLE $EXECUTABLE
    
    #cd /opt/$NAME-$VERSION
    

    The two mv (move files) that don't work, and and the chmod (change permissions) are clearly there.

    Probably, (and I don't know for sure) but I think the step before this script runs, files get moved to /opt/$NAME-$VERSION/ (opt/pencil/3.1.0.ga/ ), and for reasons I don't understand that is not happening.

    The owners of this project know there are some issues with the installer (https://github.com/evolus/pencil/issues/520) , and it might not be the most stable tool to work with, if you are new to programming/linux.

    This user has a similar issue https://askubuntu.com/questions/1172077/pencil-does-not-install-on-ubuntu-18-04

    If you are determined to use this software, it looks as if the other users are building from the source files. (this is typically more error prone, but very standard for software developers). Let us know if you have more questions, or if plan to build from source.