Snapcraft errors with No such directory /tmp/

[Errno 2] No such file or directory: ‘/tmp/tmp5wpljo77’

what is it looking for?

 prepare: |
        sh prepare.sh
    build: |        
        sh run.sh
    install: |
        cp -R out/ $SNAPCRAFT_PART_INSTALL
    organize:
        out/: lib/application/
    filesets:
        app:
         - lib/application/*
    stage:
       - $app

This happens, after the build completes

Everything ran smooth till like a day ago.

All I ever did was restart ubuntu after like a week or so.

and run snapcraft clean

cleared all caches.

tried a fresh build.

What are those scripts doing? Maybe they are expecting to run from a different folder?

Without a complete example it’s hard to tell.

1 Like

The build script runs some node js scripts, which build a debian archive inside

parts |
            part1 |
                        build |
                                    out |
                                              app.deb

the entire part is like so:

parts:
  foundation:
    plugin: nodejs
    node-engine: 6.11.2
    source: ./sources/app/
    build-packages:
         - build-essential
         - git
         - libsecret-1-0
         - libsecret-common
         - libsecret-1-dev
         - fakeroot
         - libx11-dev
         - libxkbfile-dev
         - gcc-5
         - g++-5        
    prepare: |
        sh prepare.sh
    build: |
         sh run.sh
         echo $SNAPCRAFT_PART_INSTALL
         ls -alh out/*
    install: |
        cp -R out/ $SNAPCRAFT_PART_INSTALL
    organize:
        out/: lib/application/
    filesets:
        app:
         - lib/application/*
    stage:
       - $app

This build step, finishes just fine. I can see the debian archive inside the out directory.

For part2 to consume this debain archive, I am moving it into the install directory

This happens in the install step as in the yaml above.

After which , I organize and stage the required files under 'stage`

it errors out after build , with the error saying

[Errno 2] No such file or directory: ‘/tmp/tmp5wpljo77’

Since the error itself is not very verbose, I am not sure how best to watch the exact point of failure.

I for sure know, that the build step finished successfully, but the install scriptlet never fired

Sooo, snapcraft, creates

  • A temporary shell script inside of /tmp/
  • Deletes it later

For every scriptlet inside of the yaml.

I am seeing a peculiar behaviour as of today, where,

It creates a temporary file inside tmp/ and is deleting it before it even runs it.

This is happening only for the install scriptlet in my yaml.

I had to watch the /tmp/ directory like a hawk, to notice times of creation and deletion.

If the build takes a long time, the install scriptlet somehow times out and clears from tmp/ , even before the build finishes.

Hence the error ,

[Errno 2] No such file or directory: ‘/tmp/tmp5wpljo77’

it is unable to find the script it created for install after build finished.

The cryptic message is related to the bug on scriptlet errors LP: #1650968

2 Likes

@sergiusens. Cooool. Are you fixing it? :slight_smile:

Well Another issue to bring by your attention.

When a part initialization happens, or when a prime happens,

Is it all about just copying files over to the respective directory?

If so,

I notice that with the source set to a folder with .git files and submodule stuff,

snapcraft copies the entire thing.

Can snapcraft filter out all the git files and pointers and submodules?

because on a build host, especially on an ext4 FS, and the current upstream kernel ,

r/w operations are very very very SLOW :frowning:

and copying unwanted files, can cause significant delays

Are you using the dump plugin in these slow cases?

yes. very much so.

Just dumping a debian archive and priming whatever snapcraft primes by default