0

After upgrading my debian from buster to bullseye, my yocto build process fails in do_package: Function failed: perform_packagecopy with hundereds of messages like

tar: ./dir/linkfile: Cannot change mode to rwxrwxrwx: No such file or directory

(linkfile is any symbolic link in the directory). The actual copy action has been executed, the files and their symlinks are present with the expected mode settings. It looks like the symlink is copied before the file it points to and tar believes it needs to adapt the mode of the symlink, but gets an error, because the file the symlink is pointing to does not exist (but this is just an assumption).

Unfortunally, I can't reproduce the error executing

tar -cf - -C /full/path/image -p -S . | tar -xf - -C /full/path/package

directly. This does not give any error. Just when executed as a python subprocess from out the yocto scripting hell, I get these errors. Just in case, the tar is

$ tar --version
tar (GNU tar) 1.34
2
  • Hi, Jörg! Didn't "meet" you since porting cdrecord to HP-UX … like a quarter of a century ago! Good to know you are still around. I'm a little afraid of replacing GNU tar, because it will affect all corners of the yocto build empire – and I don't know whether some strange behaviours could be required.
    – Philippos
    Commented Sep 14, 2021 at 8:48
  • 1
    Hi, cdrecord indeed started in 1995 and did become portable in 1996, but star started in 1982 already ;-) If Linux distros would be made the right way, there was no problem: tar would be a symlink to a sufficiently compatible implementation and general scripts do not make use of gtar specific deviations, not gtar specific option deviations. Special scripts that depend on gtar behavior would call gtar instead of tar. If a script needs support for strange archive formats, it could call libarchive and if a script needs support for extended tar features, it could call star.
    – schily
    Commented Sep 14, 2021 at 9:23

3 Answers 3

2

We have hit the same problem and we avoided it by patching Yocto to use BSD tar instead of GNU tar. You need to install libarchive-tools in Debian to get this version of tar.

We also tried to put BSD tar in the PATH as tar, but this is rejected by Yocto which checks for a tar version number greater than 1.28 (ignoring the fact that non-GNU versions of tar have different version numbers).

This seems to work without problems for us.

From aebcd4668cc3500d6072b7ef3fba2e6ea2cf9f43 Mon Sep 17 00:00:00 2001
From: Florian Viguier <[email protected]>
Date: Wed, 3 Nov 2021 09:15:47 +0100
Subject: [PATCH 1/2] [LCB-318] Switch Gnu tar for bsd tar for Debian 11
 compatibility

---
 meta/classes/package.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 5a32e5c2e3..db47edc92a 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -814,7 +814,7 @@ python perform_packagecopy () {
     # Start by package population by taking a copy of the installed
     # files to operate on
     # Preserve sparse files and hard links
-    cmd = 'tar -cf - -C %s -p -S . | tar -xf - -C %s' % (dest, dvar)
+    cmd = '/usr/bin/bsdtar -cf - -C %s -p -S . | /usr/bin/bsdtar -xf - -C %s' % (dest, dvar)
     subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
 
     # replace RPATHs for the nativesdk binaries, to make them relocatable
-- 
2.30.2

From 7680a3ba35c321fc915714fb835782f0b03d105e Mon Sep 17 00:00:00 2001
From: Adrien Destugues <[email protected]>
Date: Thu, 4 Nov 2021 17:43:47 +0100
Subject: [PATCH 2/2] [FIX] Use bsdtar also in sstate

---
 meta/classes/sstate.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index d08d950e76..4e0be994c7 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -849,7 +849,7 @@ python sstate_report_unihash() {
 # Will be run from within SSTATE_INSTDIR.
 #
 sstate_unpack_package () {
-   tar -xvzf ${SSTATE_PKG}
+   /usr/bin/bsdtar -xvzf ${SSTATE_PKG}
    # update .siginfo atime on local/NFS mirror
    [ -O ${SSTATE_PKG}.siginfo ] && [ -w ${SSTATE_PKG}.siginfo ] && [ -h ${SSTATE_PKG}.siginfo ] && touch -a ${SSTATE_PKG}.siginfo
    # Use "! -w ||" to return true for read only files
-- 
2.30.2
1

I've recently faced the same problem when upgrading my OpenSUSE distribution while using an old Yocto release (sumo). The problem is not directly tied to tar itself since it works outside Yocto but appears when used with "pseudo" (Yocto's fakeroot implementation). Indeed, there have been changes in the handling of the O_NOFOLLOW/AT_SYMLINK_NOFOLLOW flags in tar that are not correctly supported by the old versions of "pseudo".

To fix this, I simply upgraded "pseudo" recipe to commit 060058bb29f70b244e685b3c704eb0641b736f73 to make it work again.

0

Similar issue after upgrade to Bullseye.

tar: ./var/log: Cannot change mode to rwxrwxrwx: No such file or directory

Debian 11 is not supported. Temporary solution is to use Debian 10 docker container.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .