GNU bug report logs - #39727
statx error running 'guix gc' on CentOS 7

Previous Next

Package: guix;

Reported by: Paul Garlick <pgarlick <at> tourbillion-technology.com>

Date: Fri, 21 Feb 2020 22:50:02 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39727 in the body.
You can then email your comments to 39727 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#39727; Package guix. (Fri, 21 Feb 2020 22:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Garlick <pgarlick <at> tourbillion-technology.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Fri, 21 Feb 2020 22:50:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Garlick <pgarlick <at> tourbillion-technology.com>
To: bug-guix <at> gnu.org
Subject: statx error running 'guix gc' on CentOS 7
Date: Fri, 21 Feb 2020 22:49:15 +0000
Hi Guix,

After a 'guix pull' today to commit
536cc4aae5b58b45b974530646a4916a29a8aa6c I noticed that 'guix gc' fails
with the message:

guix gc: error: statting `/gnu/store/.links/0pck...': Invalid argument

The system is running CentOS 7:

$ cat /etc/centos-release
CentOS Linux release 7.7.1908 (Core)

A temporary fix is to remove 'statx' from the list of functions checked
in 
config-daemon.ac (line 96):

-  statvfs nanosleep strsignal statx])
+ statvfs nanosleep strsignal])

This could a problem with the kernel version or coreutils [0] in CentOS
7.  

It seems that HAVE_STATX is set in the guix build process but then
runtime calls to statx generate errors.

Best regards,

Paul.

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1760300









Information forwarded to bug-guix <at> gnu.org:
bug#39727; Package guix. (Sat, 22 Feb 2020 00:00:02 GMT) Full text and rfc822 format available.

Message #8 received at 39727 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Paul Garlick <pgarlick <at> tourbillion-technology.com>
Cc: 39727 <at> debbugs.gnu.org
Subject: Re: bug#39727: statx error running 'guix gc' on CentOS 7
Date: Sat, 22 Feb 2020 00:59:13 +0100
Hi,

Paul Garlick <pgarlick <at> tourbillion-technology.com> skribis:

> After a 'guix pull' today to commit
> 536cc4aae5b58b45b974530646a4916a29a8aa6c I noticed that 'guix gc' fails
> with the message:
>
> guix gc: error: statting `/gnu/store/.links/0pck...': Invalid argument

This was during the “removing unused link” phase, right?

> The system is running CentOS 7:
>
> $ cat /etc/centos-release
> CentOS Linux release 7.7.1908 (Core)

What does “uname -r” return?

This is most likely an issue with the ancient kernel being used.

It would be nice if you could try running a C program that does
something like this:

	struct statx st;
	if (statx(AT_FDCWD, "/",
		  AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC,
		  STATX_SIZE | STATX_NLINK, &st) == -1)
          printf ("failed: %m\n");

It should fail similarly.  Then you can try commenting out
AT_STATX_DONT_SYNC and see whether it fails.

Let me know how it goes!

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#39727; Package guix. (Mon, 24 Feb 2020 12:53:01 GMT) Full text and rfc822 format available.

Message #11 received at 39727 <at> debbugs.gnu.org (full text, mbox):

From: Paul Garlick <pgarlick <at> tourbillion-technology.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 39727 <at> debbugs.gnu.org
Subject: Re: bug#39727: statx error running 'guix gc' on CentOS 7
Date: Mon, 24 Feb 2020 12:52:42 +0000
Hi Ludo,

> This was during the “removing unused link” phase, right?
> 
Yes, that's it.

> The system is running CentOS 7:
> 
> $ cat /etc/centos-release
> CentOS Linux release 7.7.1908 (Core)
> 
> What does “uname -r” return?

3.10.0-1062.12.1.el7.x86_64

> Let me know how it goes!

I compiled a C program with the following code using gcc-toolchain
9.2.0:

#define _GNU_SOURCE
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>

int main(void)
{
  struct statx st;
  if (statx(AT_FDCWD, "/",
            AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC,
            /* AT_SYMLINK_NOFOLLOW, */
            STATX_SIZE | STATX_NLINK, &st) == -1)
    printf ("failed: %m\n");

  return 0;
}

Initially, with the AT_STATX_DONT_SYNC flag, the output is:

$ failed: Invalid argument

Then, without the  AT_STATX_DONT_SYNC flag, the program runs and there
is no output.

Best regards,

Paul.





Information forwarded to bug-guix <at> gnu.org:
bug#39727; Package guix. (Mon, 24 Feb 2020 15:13:01 GMT) Full text and rfc822 format available.

Message #14 received at 39727 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Paul Garlick <pgarlick <at> tourbillion-technology.com>
Cc: 39727 <at> debbugs.gnu.org
Subject: Re: bug#39727: statx error running 'guix gc' on CentOS 7
Date: Mon, 24 Feb 2020 16:12:07 +0100
[Message part 1 (text/plain, inline)]
Hi Paul,

Paul Garlick <pgarlick <at> tourbillion-technology.com> skribis:

> Initially, with the AT_STATX_DONT_SYNC flag, the output is:
>
> $ failed: Invalid argument
>
> Then, without the  AT_STATX_DONT_SYNC flag, the program runs and there
> is no output.

Great.  Could you apply the following patch, run the daemon with:

  sudo -E ./pre-inst-env guix-daemon --build-users-group=…

then run:

  guix gc -C42

and confirm that it works for you?

Thanks!

Ludo’.

[Message part 2 (text/x-patch, inline)]
diff --git a/nix/libstore/gc.cc b/nix/libstore/gc.cc
index 77d7fa2dc7..8bc4e01eb0 100644
--- a/nix/libstore/gc.cc
+++ b/nix/libstore/gc.cc
@@ -581,15 +581,27 @@ void LocalStore::removeUnusedLinks(const GCState & state)
 #ifdef HAVE_STATX
 # define st_size stx_size
 # define st_nlink stx_nlink
+	static int statx_flags = AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC;
 	struct statx st;
-	if (statx(AT_FDCWD, path.c_str(),
-		  AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC,
-		  STATX_SIZE | STATX_NLINK, &st) == -1)
+
+	if (statx(AT_FDCWD, path.c_str(), statx_flags,
+		  STATX_SIZE | STATX_NLINK, &st) == -1) {
+	    if (errno == EINVAL) {
+		/* Old 3.10 kernels (CentOS 7) don't support
+		   AT_STATX_DONT_SYNC, so try again without it.  */
+		statx_flags &= ~AT_STATX_DONT_SYNC;
+		if (statx(AT_FDCWD, path.c_str(), statx_flags,
+			  STATX_SIZE | STATX_NLINK, &st) == -1)
+		    throw SysError(format("statting `%1%'") % path);
+	    } else {
+		throw SysError(format("statting `%1%'") % path);
+	    }
+	}
 #else
         struct stat st;
         if (lstat(path.c_str(), &st) == -1)
-#endif
             throw SysError(format("statting `%1%'") % path);
+#endif
 
         if (st.st_nlink != 1) {
             actualSize += st.st_size;

Information forwarded to bug-guix <at> gnu.org:
bug#39727; Package guix. (Mon, 24 Feb 2020 19:52:01 GMT) Full text and rfc822 format available.

Message #17 received at 39727 <at> debbugs.gnu.org (full text, mbox):

From: Paul Garlick <pgarlick <at> tourbillion-technology.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 39727 <at> debbugs.gnu.org
Subject: Re: bug#39727: statx error running 'guix gc' on CentOS 7
Date: Mon, 24 Feb 2020 19:51:18 +0000
Hi Ludo,


> Great.  Could you apply the following patch, run the daemon with:
> 
>   sudo -E ./pre-inst-env guix-daemon --build-users-group=…
> 
> then run:
> 
>   guix gc -C42

Yes, all is good.  

I have re-built guix with your patch and started the daemon.  Now 'guix
gc' runs as expected:

.
.
.
deleted or invalidated more than 42 bytes; stopping
deleting `/gnu/store/trash'
deleting unused links...
note: currently hard linking saves 3264.68 MiB
guix gc: freed 0.91850 MiBs

Many thanks!  CentOS 7 will be around for a few years yet.

Best regards,

Paul.





Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 26 Feb 2020 21:08:02 GMT) Full text and rfc822 format available.

Notification sent to Paul Garlick <pgarlick <at> tourbillion-technology.com>:
bug acknowledged by developer. (Wed, 26 Feb 2020 21:08:02 GMT) Full text and rfc822 format available.

Message #22 received at 39727-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Paul Garlick <pgarlick <at> tourbillion-technology.com>
Cc: 39727-done <at> debbugs.gnu.org
Subject: Re: bug#39727: statx error running 'guix gc' on CentOS 7
Date: Wed, 26 Feb 2020 22:07:34 +0100
Hi Paul,

Paul Garlick <pgarlick <at> tourbillion-technology.com> skribis:

>> Great.  Could you apply the following patch, run the daemon with:
>> 
>>   sudo -E ./pre-inst-env guix-daemon --build-users-group=…
>> 
>> then run:
>> 
>>   guix gc -C42
>
> Yes, all is good.  
>
> I have re-built guix with your patch and started the daemon.  Now 'guix
> gc' runs as expected:

Great, pushed as 513c0a0f4602018a49d8fd2dfa24670a3fa08ac9.

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 26 Mar 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 32 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.