FS#61566 - [fakeroot]makepkg and/or fakeroot issue, faked 100% cpu load, strange permissions on pkg/

Attached to Project: Arch Linux
Opened by whoami (whoami) - Tuesday, 29 January 2019, 09:59 GMT
Last edited by Toolybird (Toolybird) - Monday, 02 January 2023, 00:36 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Christian Hesse (eworm)
Bartłomiej Piotrowski (Barthalion)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
After last update I tried to build yay and i2pd and getting same behaviour. Look on pkg directory permissions.

software building fine, but can't pack it to archive.
on step fakeroot environment I getting faked process 100% cpu load

I tried -lts kernel, but the same as -hardened, too

I tried reinstall base-devel, not helps.

==> Entering fakeroot environment...
^C/usr/bin/fakeroot: line 1: kill: (10532) - No such process

$ l
total 368
drwxr-xr-x 8 user user 4096 Jan 28 11:10 .git
-rw-r--r-- 1 user user 35 Jan 28 11:10 .gitignore
d--x--x--x 2 user user 4096 Jan 29 09:05 pkg
-rw-r--r-- 1 user user 674 Jan 28 11:10 PKGBUILD
drwxr-xr-x 3 user user 4096 Jan 29 09:05 src
-rw-r--r-- 1 user user 463 Jan 28 11:10 .SRCINFO
-rw-r--r-- 1 user user 351515 Jan 28 11:10 yay-9.1.0.tar.gz

Additional info:
$ uname -a
Linux scw-6ef8ee 4.20.4.a-1-hardened #1 SMP PREEMPT Fri Jan 25 01:24:51 CET 2019 x86_64 GNU/Linux

Steps to reproduce:
git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si
This task depends upon

Closed by  Toolybird (Toolybird)
Monday, 02 January 2023, 00:36 GMT
Reason for closing:  Not a bug
Additional comments about closing:  See comments. Issue only arises when systemd standard config is modified.
Comment by whoami (whoami) - Tuesday, 29 January 2019, 15:18 GMT
$ fakeroot bash
^Cfakeroot internal error #43: Identifier removed
semop(2): encountered an error: Invalid argument
/usr/bin/fakeroot: line 1: kill: (10634) - No such process
/usr/bin/fakeroot: line 1: kill: (10634) - No such process
Comment by whoami (whoami) - Tuesday, 29 January 2019, 15:30 GMT
$ pacman -V

.--. Pacman v5.1.2 - libalpm v11.0.2
Comment by whoami (whoami) - Tuesday, 29 January 2019, 16:07 GMT
I've attached to faked process over strace and I can see spamming this lines
...
close(52100911) = -1 EBADF (Bad file descriptor)
close(52100912) = -1 EBADF (Bad file descriptor)
close(52100913) = -1 EBADF (Bad file descriptor)
close(52100914) = -1 EBADF (Bad file descriptor)
close(52100915) = -1 EBADF (Bad file descriptor)
close(52100916) = -1 EBADF (Bad file descriptor)
...
Comment by Allan McRae (Allan) - Tuesday, 29 January 2019, 23:52 GMT
Hrm - fakeroot has not been updated for a long time. Did this start happening around the readline update? Would be good to downgrade your system using the package archive (full downgrade, one day at a time) until you see what packages were updated to break this.
Comment by whoami (whoami) - Wednesday, 30 January 2019, 00:12 GMT
thats not easy, cause downgrade not in repos, but I have makepkg issue. I will try download and downgrade manually

previous update:
[2019-01-14 07:09] [ALPM] upgraded ncurses (6.1-4 -> 6.1-6)
[2019-01-14 07:09] [ALPM] upgraded readline (7.0.005-1 -> 8.0.0-1)
[2019-01-14 07:09] [ALPM] upgraded bash (4.4.023-1 -> 5.0.0-1)
[2019-01-14 07:09] [ALPM] upgraded libxml2 (2.9.8-6 -> 2.9.8-8)
[2019-01-14 07:09] [ALPM] upgraded gdbm (1.18.1-1 -> 1.18.1-2)
[2019-01-14 07:09] [ALPM] upgraded libutil-linux (2.33.1-1 -> 2.33.1-2)
[2019-01-14 07:10] [ALPM] upgraded python (3.7.2-1 -> 3.7.2-3)
[2019-01-14 07:10] [ALPM] upgraded bind-tools (9.13.5-2 -> 9.13.5-3)
[2019-01-14 07:10] [ALPM] upgraded libsystemd (240.0-3 -> 240.34-2)
[2019-01-14 07:10] [ALPM] upgraded device-mapper (2.02.183-1 -> 2.02.183-2)
[2019-01-14 07:10] [ALPM] upgraded gawk (4.2.1-1 -> 4.2.1-2)
[2019-01-14 07:10] [ALPM] upgraded gnutls (3.6.5-1 -> 3.6.5-2)
[2019-01-14 07:10] [ALPM] upgraded sqlite (3.26.0-1 -> 3.26.0-2)
[2019-01-14 07:10] [ALPM] upgraded pcre (8.42-1 -> 8.42-2)
[2019-01-14 07:10] [ALPM] upgraded gnupg (2.2.12-1 -> 2.2.12-2)
[2019-01-14 07:10] [ALPM] upgraded guile (2.2.4-1 -> 2.2.4-2)
[2019-01-14 07:10] [ALPM] upgraded inetutils (1.9.4-6 -> 1.9.4-7)
[2019-01-14 07:10] [ALPM] upgraded libedit (20180525_3.1-1 -> 20181209_3.1-1)
[2019-01-14 07:10] [ALPM] upgraded pcre2 (10.32-1 -> 10.32-2)
[2019-01-14 07:10] [ALPM] upgraded util-linux (2.33.1-1 -> 2.33.1-2)
[2019-01-14 07:10] [ALPM] upgraded systemd (240.0-3 -> 240.34-2)
[2019-01-14 07:10] [ALPM] upgraded linux-hardened (4.19.13.a-1 -> 4.19.15.a-1)
[2019-01-14 07:10] [ALPM] upgraded linux-hardened-headers (4.19.13.a-1 -> 4.19.15.a-1)
[2019-01-14 07:10] [ALPM] upgraded lvm2 (2.02.183-1 -> 2.02.183-2)
[2019-01-14 07:10] [ALPM] upgraded postgresql-libs (11.1-2 -> 11.1-3)
[2019-01-14 07:10] [ALPM] upgraded postgresql (11.1-2 -> 11.1-3)
[2019-01-14 07:10] [ALPM] upgraded python2 (2.7.15-2 -> 2.7.15-4)
[2019-01-14 07:10] [ALPM] upgraded systemd-sysvcompat (240.0-3 -> 240.34-2)
[2019-01-14 07:10] [ALPM] upgraded xfsprogs (4.19.0-1 -> 4.19.0-2)
Comment by Allan McRae (Allan) - Wednesday, 30 January 2019, 00:18 GMT
Have a look at this for downgrades - https://wiki.archlinux.org/index.php/Arch_Linux_Archive

Set the date in your mirror and do a -Syyuu.
Comment by Allan McRae (Allan) - Wednesday, 30 January 2019, 00:19 GMT
Hrm... linux-hardened. Does it work with the non-hardened kernel?
Comment by whoami (whoami) - Wednesday, 30 January 2019, 01:04 GMT
well, 2019/01/07 works. I will update day-by-day until failing
Comment by whoami (whoami) - Wednesday, 30 January 2019, 01:06 GMT
In first message I wrote, I tried -lts kernel, but it not helps
Comment by Dan Martins (dmartins) - Wednesday, 30 January 2019, 01:39 GMT
I can't reproduce this with linux-hardened 4.19.15.a-1 or 4.20.5.a-1 on an up to date system.

whoami, Could you post the output from "sudo pacman -Qkk | grep warning"?

Have you done any other hardening steps on this system?
Comment by whoami (whoami) - Wednesday, 30 January 2019, 01:42 GMT
I switched to linux-lts for excluding influence -hardening kernel for this case

OK. double checked, 2019/01/08 - works, 2019/01/09 - not works after reboot

List all pkgs changed 2019/01/09 on this system:
core/iana-etc 20180913-1 20181219-1 0.01 MiB 0.36 MiB
core/iproute2 4.19.0-1 4.20.0-1 0.02 MiB 0.80 MiB
core/libsystemd 239.370-1 240.0-3 0.13 MiB 0.38 MiB
core/libutil-linux 2.33-2 2.33-3 0.01 MiB 0.36 MiB
extra/libxslt 1.1.32+3+g32c88216-1 1.1.33-1 0.01 MiB 0.35 MiB
core/man-db 2.8.4-1 2.8.5-1 0.16 MiB 0.95 MiB
core/systemd 239.370-1 240.0-3 1.43 MiB 4.48 MiB
core/systemd-sysvcompat 239.370-1 240.0-3 0.02 MiB 0.01 MiB
core/util-linux 2.33-2 2.33-3 0.33 MiB 2.03 MiB
Comment by whoami (whoami) - Wednesday, 30 January 2019, 01:44 GMT
on 2019/01/09

$ sudo pacman -Qkk | grep warning
[sudo] password for user:
warning: filesystem: /etc/hosts (Permissions mismatch)
warning: filesystem: /root (Permissions mismatch)
warning: grub: /etc/default/grub (Permissions mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.alias (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.alias (Size mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.alias.bin (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.alias.bin (Size mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.builtin.bin (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.dep (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.dep (Size mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.dep.bin (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.dep.bin (Size mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.devname (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.softdep (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.symbols (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.symbols (Size mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.symbols.bin (Modification time mismatch)
warning: linux-hardened: /usr/lib/modules/4.19.13.a-1-hardened/modules.symbols.bin (Size mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.alias (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.alias (Size mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.alias.bin (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.alias.bin (Size mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.builtin.bin (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.dep (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.dep (Size mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.dep.bin (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.dep.bin (Size mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.devname (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.softdep (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.symbols (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.symbols (Size mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.symbols.bin (Modification time mismatch)
warning: linux-lts: /usr/lib/modules/4.19.13-1-lts/modules.symbols.bin (Size mismatch)
warning: mkinitcpio: /etc/mkinitcpio.conf (Permissions mismatch)
warning: nginx: /var/lib/nginx/proxy (UID mismatch)
warning: openssh: /etc/ssh/sshd_config (Permissions mismatch)
warning: pacman: /var/cache/pacman/pkg (No such file or directory)
warning: pinentry: /usr/bin/pinentry (File type mismatch)
warning: sudo: /etc/sudoers.d (Permissions mismatch)
Comment by whoami (whoami) - Wednesday, 30 January 2019, 02:17 GMT
on 2019/01/09 I just update /etc/systemd/system.conf (cp /etc/systemd/systemd.conf.pacnew /etc/systemd/system.conf), reboot and it works now

$ diff -u /etc/systemd/system.conf /etc/systemd/system.conf.pacnew
--- /etc/systemd/system.conf 2019-01-30 02:15:28.560000000 +0000
+++ /etc/systemd/system.conf.pacnew 2019-01-08 00:40:51.000000000 +0000
@@ -23,9 +23,9 @@
#CrashReboot=no
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=1 2
-#JoinControllers=cpu,cpuacct net_cls,net_prio
#RuntimeWatchdogSec=0
#ShutdownWatchdogSec=10min
+#WatchdogDevice=
#CapabilityBoundingSet=
#NoNewPrivileges=no
#SystemCallArchitectures=
@@ -52,9 +52,7 @@
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
-#DefaultLimitNOFILE=
-#DefaultLimitNOFILE=1000000
-DefaultLimitNOFILE=infinity
+#DefaultLimitNOFILE=1024:524288
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=
@@ -64,5 +62,3 @@
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
-#IPAddressAllow=
-#IPAddressDeny=
Comment by whoami (whoami) - Wednesday, 30 January 2019, 02:18 GMT
now system rebooting much-much more faster (or placebo)
Comment by Dan Martins (dmartins) - Wednesday, 30 January 2019, 03:41 GMT
It looks like it is caused by DefaultLimitNOFILE=infinity

In faked.c from fakeroot, line 1490, getdtablesize returns a large value (1,073,741,816) due to the infinity setting.
faked loops, calling close on every possible file descriptor from 0 to 1073741816

Breakpoint 2, main (argc=<optimized out>, argv=0x7020a00e55c0) at faked.c:1500
1500 close(fl);
(gdb) info locals
fl = 36574955
num_fds = 1073741816

Eventually, it should carry on, but it takes a long time to get to 1073741816.

I'll report this to fakeroot upstream.

if(!foreground){
/* literally copied from the linux klogd code, go to background */
if ((pid=fork()) == 0){
int fl;
int num_fds = getdtablesize();

fflush(stdout);

/* This is the child closing its file descriptors. */
for (fl= 0; fl <= num_fds; ++fl)
#ifdef FAKEROOT_FAKENET
if (fl != sd)
#endif /* FAKEROOT_FAKENET */
close(fl);
Comment by Dan Martins (dmartins) - Wednesday, 30 January 2019, 04:00 GMT
Actually, now that I think about it, I'm not sure about reporting this upstream. While setting DefaultLimitNOFILE to infinity is "valid", I'm not sure there's a real use case for this, and fakeroot will finish eventually, it just has to try to close a billion file descriptors first.

whoami, did you have this set to infinity for a particular reason?
Allan, what are your thoughts on this?
Comment by whoami (whoami) - Wednesday, 30 January 2019, 04:03 GMT
I setting it to infinity because I am greedy and lazy. I wanted to never think about it again just by setting the maximum limit.
Comment by whoami (whoami) - Wednesday, 30 January 2019, 04:07 GMT
Now I have no special requirements for this option. But it seems in any case affects the performance, although it should not
Comment by Allan McRae (Allan) - Wednesday, 30 January 2019, 04:11 GMT
Upstream could set their own internal limit with the number they receive is too large. But it is up to them whether they consider this a bug.
Comment by Dan Martins (dmartins) - Wednesday, 30 January 2019, 16:24 GMT

Loading...