Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tar Cannot stat: No such file or directory #99

Closed
iver56 opened this issue Mar 8, 2023 · 28 comments
Closed

tar Cannot stat: No such file or directory #99

iver56 opened this issue Mar 8, 2023 · 28 comments
Assignees
Labels
bug Something isn't working

Comments

@iver56
Copy link

iver56 commented Mar 8, 2023

Hi,

I'm using cache-apt-pkgs-action (thanks for making it, by the way) like this:

    - uses: awalsh128/cache-apt-pkgs-action@latest
      with:
        packages: libsdl2-dev build-essential gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu ffmpeg
        version: 1.0

Lately it has been failing. The log ends like this:

10:20:18 Caching 153 installed packages...
10:20:18   * Caching libnss-systemd to /home/runner/cache-apt-pkgs/libnss-systemd:249.11-0ubuntu3.7.tar...
10:20:18     done (compressed size 320K).
10:20:18   * Caching libsystemd0 to /home/runner/cache-apt-pkgs/libsystemd0:249.11-0ubuntu3.7.tar...
10:20:18     done (compressed size 812K).
10:20:18   * Caching systemd-sysv to /home/runner/cache-apt-pkgs/systemd-sysv:249.11-0ubuntu3.7.tar...
10:20:18     done (compressed size 32K).
10:20:18   * Caching libpam-systemd to /home/runner/cache-apt-pkgs/libpam-systemd:249.11-0ubuntu3.7.tar...
10:20:18     done (compressed size 492K).
10:20:18   * Caching systemd to /home/runner/cache-apt-pkgs/systemd:249.11-0ubuntu3.7.tar...
tar: lib/systemd/system/system-systemdx2dcryptsetup.slice: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors
Error: Process completed with exit code 123.

I have tried both latest (v1.2.4) and v1.2.1, and I get the same error in both cases. I have also tried execute_install_scripts: true

What can I do to resolve the issue?

@awalsh128
Copy link
Owner

Can you turn on debug from the latest version and link to the logs?

It is pulling in systemd as a dependency. It will try to tar all files in the APT manifest. For some reason that file is listed but not present on disk. We need to find out why that file isn't present. Once we know more we can either fix it per package or maybe accommodate in general (i.e. throw a warning and continue with Tar).

I can get around to this but it may take me some time as I have been fairly busy recently. Something that would help a lot would be to install that version of systemd and see if the file is there, and try to explain the behavior.

@iver56
Copy link
Author

iver56 commented Mar 9, 2023

Yes, certainly. I'll try to make a minimal repo for reproducing it.

One thing I noticed in the log is that lib/systemd/system/system-systemdx2dcryptsetup.slice doesn't have a slash in the beginning. Could that be it?

@iver56
Copy link
Author

iver56 commented Mar 9, 2023

I have created the minimal repo that reproduces the issue. It uses @latest version and debug: true

The failed job, along with the debug log can be read here: https://github.com/iver56/cache-apt-systemd/actions/runs/4374423862/jobs/7653831648

@awalsh128
Copy link
Owner

Thank you very much and the coffee 😁 The path will be relative intentionally because this is what Tar accepts only. I have it restore to root.

I hope you have an update sometime today.

@iver56
Copy link
Author

iver56 commented Mar 13, 2023

Thank you very much and the coffee 😁

You're welcome 😄

I hope you have an update sometime today.

What kind of update from me do you want/expect? You mentioned "install that version of systemd and see if the file is there" earlier. Is that on me or you? How would one begin to reproduce it? Make a docker image where that version of systemd gets installed?

@awalsh128
Copy link
Owner

This is on my end. You don't need to do anything more.

I think I see what the issue is. The filename is using a backslash in it.

$ ls /lib/systemd/system/system-*
'/lib/systemd/system/system-systemd\x2dcryptsetup.slice'

Enclosed the filepath in single quotes and it was able to store and extract successfully.

$ tar -cf /tmp/test.tar '/lib/systemd/system/system-systemd\x2dcryptsetup.slice'

Working on a fix. Still need to clear some failing tests in master.

@awalsh128
Copy link
Owner

awalsh128 commented Mar 24, 2023

Was able to clear up the errors and the regression test for this is now passing.

You can try out the pre-release v1.3.0. Will do the final release later today (PST).

@iver56
Copy link
Author

iver56 commented Mar 24, 2023

Thanks! It seems to be working well on my end

@iver56 iver56 closed this as completed Mar 24, 2023
@iver56 iver56 reopened this Apr 12, 2023
@iver56
Copy link
Author

iver56 commented Apr 12, 2023

I'm not sure what happened or why, but I am now seeing this error once again, even with v1.3.0. I made a minimal reproduction here:
https://github.com/iver56/cache-apt-systemd/actions/runs/4675789547/jobs/8281303920

Do you need me to enable debug mode as well?

@awalsh128
Copy link
Owner

awalsh128 commented Apr 13, 2023

Wow, sorry to hear that. The regression isn't failing either. Does rolling back the version fix it? A debug run would be helpful.

I noticed it failing on the same file but the backslash is gone which indicates some regression in my part. Try the run against master too in your action version as ...@master

@awalsh128
Copy link
Owner

Looks like the CI silently ate the error, which is why I didn't catch it originally.

echo "lib/systemd/system/system-systemd\x2dcryptsetup.slice" | xargs -I '{}' echo \'{}\'

Not sure how this ever worked actually as it was the only change a644619. Looks like xargs string substitution doesn't preserve the literals still.

Will work on an actual fix, then doublecheck on the CI and update here.

@awalsh128
Copy link
Owner

awalsh128 commented Apr 14, 2023

Updated the CI regression test (old run log) with an updated version to see if it will trigger the error (awalsh128/cache-apt-pkgs-action-ci@f94c318). systemd makes this a bit awkward because it is a core level dependency on top of the OS. The alternative would be to mount these Ubuntu images locally and run the tests inside of it before commit.

@iver56 do me a favor and run the action from the dev branch. I am using awk instead in abb3a6d and bf94842. Hoping this will be a better fit overall anyways since it is a text processing tool.

UPDATE: Actually hold off, looks like the change broke some other tests.

@awalsh128
Copy link
Owner

Actually give it a shot. It is just do a package version not existing which I just need to debug on the CI end.

@iver56
Copy link
Author

iver56 commented Apr 17, 2023

Feel free to fork that cache-apt-systemd repo if you want to do test runs like that more quickly than what I can provide

@awalsh128
Copy link
Owner

Sorry for the delay. I'll check it out this weekend.

@sn-o-w
Copy link
Contributor

sn-o-w commented May 25, 2023

@awalsh128 Hi there. I also get a very similar error:

tar (grandchild): lzip: Cannot exec: No such file or directory

And yes, lzip is set to get installed via the workflow. 😞

@sn-o-w
Copy link
Contributor

sn-o-w commented May 26, 2023

Hmm, in my case, lzip seems to not be installed properly via cache-apt-pkgs-action. I wonder why. 🤔

sn-o-w referenced this issue in YT-Advanced/WSA-Script May 29, 2023
@sn-o-w
Copy link
Contributor

sn-o-w commented Jul 13, 2023

@iver56 I think I have fixed it: https://github.com/sn-o-w/cache-apt-systemd/actions/runs/5547482021/jobs/10129187070

We need this for the dev branch: https://github.com/sn-o-w/cache-apt-pkgs-action/commit/d0ee83b497ac30023e51cd526c62e57b07501912

You can temporarily use sn-o-w/cache-apt-pkgs-action@master

@iver56
Copy link
Author

iver56 commented Jul 24, 2023

Good work :) I have not tested it, but if it's a good fix, maybe it can be fixed upstream too?

@bekriebel
Copy link

I started getting this same issue with the caching of systemd. Using @sn-o-w's branch fixes the issue.

@iver56
Copy link
Author

iver56 commented Oct 9, 2023

@awalsh128 Any chance @sn-o-w's fix can get merged upstream?

@vvv
Copy link

vvv commented Oct 26, 2023

Got this error tonight. @an-o-w's patch works.

awalsh128 added a commit that referenced this issue Oct 30, 2023
* Use awk to enclose filename in single quotes tar #99

* Add null field separator so filenames don't get broken up.

* Move upload logs up in the action sequence so it captures data before it gets deleted.

* Fix awk (#109)

---------

Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>
awalsh128 added a commit that referenced this issue Oct 30, 2023
* Pull dev upstream to staging. (#112)

* Use awk to enclose filename in single quotes tar #99

* Add null field separator so filenames don't get broken up.

* Move upload logs up in the action sequence so it captures data before it gets deleted.

* Fix awk (#109)

---------

Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>

* Fix awk delimiter.

Pull in fix by @sn-o-w in https://github.com/sn-o-w/cache-apt-pkgs-action/commit/d0ee83b497ac30023e51cd526c62e57b07501912 mentioned in issue #99

---------

Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>
@awalsh128
Copy link
Owner

Hi all. Lots of apologies for the massive delay. I updated the doc looking for help with maintainers (if any of you are feeling up to it).

I integrated the fix and confirmed it works against the regression test on the CI (log). It is now available in release v1.3.1 and marked against latest tag.

@iver56, @vvv and @sn-o-w, please confirm for yourself before I close this out.

@awalsh128 awalsh128 added the bug Something isn't working label Oct 30, 2023
@iver56
Copy link
Author

iver56 commented Oct 30, 2023

No need to apologize. I know the feeling. Thanks for merging, testing and releasing the fix! ❤️🥇

I just tested it, and it runs smoothly as far as I can tell. Now I can get fast CI runs again :D

@iver56 iver56 closed this as completed Oct 30, 2023
@sn-o-w
Copy link
Contributor

sn-o-w commented Oct 30, 2023

@awalsh128 👍

@vvv
Copy link

vvv commented Oct 30, 2023

@awalsh128 It works! 🙌🏻 Thank you.

awalsh128 added a commit that referenced this issue Dec 22, 2023
)

* Pull dev upstream to staging. (#112)

* Use awk to enclose filename in single quotes tar #99

* Add null field separator so filenames don't get broken up.

* Move upload logs up in the action sequence so it captures data before it gets deleted.

* Fix awk (#109)

---------

Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>

* Fix awk delimiter.

Pull in fix by @sn-o-w in https://github.com/sn-o-w/cache-apt-pkgs-action/commit/d0ee83b497ac30023e51cd526c62e57b07501912 mentioned in issue #99

* Swap out Bash based APT query logic for Golang version. (#117)

* First version of a Golang version of command handling in general. (#118)

---------

Co-authored-by: sn-o-w <cristian.silaghi@mozilla.ro>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants