Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 738390

Summary: genkernel 4.1.0-r2 running from chrooted environment creates zombie sh processes while using install livecd
Product: Gentoo Hosted Projects Reporter: Juozas Pocius <juozaspo>
Component: genkernelAssignee: Gentoo Genkernel Maintainers <genkernel>
Status: RESOLVED WORKSFORME    
Severity: major CC: juozaspo
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: /var/log/genkernel.log, partial output
lscpu output
kernel .config file
lspci -k
/var/log/messages from livecd
lsmod
dmesg capture
ps -Alf
Screenshot of top program showing zombie process created by genkernel while in process tree mode

Description Juozas Pocius 2020-08-21 12:42:21 UTC
Created attachment 655890 [details]
/var/log/genkernel.log, partial output

While building kernel using genkernel 4.1.0-r2 program zombie processes are generated during kernel compilation. Trying to kill zombie process using command
# kill -9 <pid>
does not work as the process does not disappear, kill program does not return any error. The only solution is to run
# kill -s SIGCHLD <parent pid>
on parent and hope it would not break program operation.

Installation media: install-amd64-minimal-20200819T214503Z.iso from official mirror, booted on a virtual machine
Virtualization software: VirtualBox 6.1.12, Host cpu: Intel Pentium(R) Dual-Core CPU E6300 @ 2.80GHz

Configuration during boot:
- optional: enter gentoo vga=ask on boot: command line, select screen resolution smaller than screen, e.g. 800x600x32
- select default keymap when prompted

Commands executed upon initial boot, running kernel version: 5.4.48, entered according to instructions from amd64 handbook, with comments where needed

tty1# cfdisk /dev/sda #created a DOS label, 1G swap and used remaining space for root partition
tty1# mkswap /dev/sda1
tty1# mkfs.ext4 /dev/sda2
tty1# swapon /dev/sda1
tty1# mount /dev/sda2 /mnt/gentoo
tty1# cd /mnt/gentoo
tty1# links https://www.gentoo.org #download amd64 stage3 archive and save to folder /mnt/gentoo
tty1# tar xpvf stage3-amd64-20200819T214503Z.tar.xz --xattrs-include='*.*' --numeric-owner
tty1# rm stage3-amd64-20200819T214503Z.tar.xz
tty1# nano -w /mnt/gentoo/etc/portage/make.conf #add modifications listed below
tty1# mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
tty1# mkdir --parents /mnt/gentoo/etc/portage/repos.conf
tty1# cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf
tty1# cp --dereference /etc/resolv.conf /mnt/gentoo/etc/
tty1# mount --types proc /proc /mnt/gentoo/proc
tty1# mount --rbind /sys /mnt/gentoo/sys
tty1# mount --make-rslave /mnt/gentoo/sys
tty1# mount --rbind /dev /mnt/gentoo/dev
tty1# mount --make-rslave /mnt/gentoo/dev
tty1# chroot /mnt/gentoo /bin/bash
tty1 chroot# source /etc/profile
tty1 chroot# export PS1="(chroot) ${PS1}"
tty1 chroot# emerge-webrsync
tty1 chroot# eselect news read
tty1 chroot# emerge --sync --quiet
tty1 chroot# emerge --ask --verbose --update --deep --newuse @world
tty1 chroot# exit
tty1# reboot #a package update recommended a reboot after updating it

Commands executed right after reboot:

tty1# swapon /dev/sda1
tty1# mount /dev/sda2 /mnt/gentoo
tty1# mount --types proc /proc /mnt/gentoo/proc
tty1# mount --rbind /sys /mnt/gentoo/sys
tty1# mount --make-rslave /mnt/gentoo/sys
tty1# mount --rbind /dev /mnt/gentoo/dev
tty1# mount --make-rslave /mnt/gentoo/dev
tty1# chroot /mnt/gentoo /bin/bash
tty1 chroot# source /etc/profile
tty1 chroot# export PS1="(chroot) ${PS1}" 
tty1 chroot# emerge --ask sys-kernel/gentoo-sources #version 5.4.48
tty1 chroot# emerge --ask sys-kernel/genkernel #license file for a dependency needs to be updated
tty1 chroot# etc-update # update any configuration files (accept license)
tty1 chroot# emerge --ask sys-kernel/genkernel
tty1 chroot# emerge --ask --deep --newuse sys-boot/grub
tty1 chroot# grub-install /dev/sda
tty1 chroot# nano -w /etc/locale.gen #input your locales here (e.g. en_US.UTF-8 UTF-8)
tty1 chroot# locale-gen
tty1 chroot# eselect locale list
tty1 chroot# eselect locale set <number>
tty1 chroot# genkernel all --no-nice #faster compilation

Commands run before and after reboot

tty2# links https://www.gentoo.org #visit Gentoo site to open amd64 handbook
tty3# top #watch for any zombie process, shown on top row

Related configuration changes:

/etc/portage/make.conf:

COMMON_FLAGS="-march=native -02 -pipe"
MAKEOPTS="j2"

added to /etc/fstab:

#/dev/sda1
UUID=d706258b-6d44-493f-bed1-092b866aa8c4 swap swap sw 0 0
#/dev/sda2
UUID=e269842a-a12a-4aab-a235-b7a1aed8283f / ext4 errors=remount-ro 0 1
Comment 1 Juozas Pocius 2020-08-21 12:44:18 UTC
Created attachment 655892 [details]
lscpu output
Comment 2 Juozas Pocius 2020-08-21 12:46:04 UTC
Created attachment 655894 [details]
kernel .config file
Comment 3 Juozas Pocius 2020-08-21 12:46:49 UTC
Created attachment 655896 [details]
lspci -k
Comment 4 Juozas Pocius 2020-08-21 12:47:26 UTC
Created attachment 655898 [details]
/var/log/messages from livecd
Comment 5 Juozas Pocius 2020-08-21 12:47:58 UTC
Created attachment 655900 [details]
lsmod
Comment 6 Juozas Pocius 2020-08-21 12:48:31 UTC
Created attachment 655902 [details]
dmesg capture
Comment 7 Juozas Pocius 2020-08-21 12:49:01 UTC
Created attachment 655904 [details]
ps -Alf
Comment 8 Juozas Pocius 2020-08-21 12:49:53 UTC
Created attachment 655906 [details]
Screenshot of top program showing zombie process created by genkernel while in process tree mode
Comment 9 Juozas Pocius 2020-08-21 13:11:43 UTC
Virtualbox VM Configuration

VM Type: Linux, Gentoo (64-bit)
992 MB ram on host with 2GB ram
PIIX3 Chipset, PS2 Mouse emulation
I/O APIC on, 2 processors, PAE/NX on
128 MB video ram, VMSVGA with 3D acceleration on
Network: Bridged Adapter
Comment 10 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-21 14:05:58 UTC
Where did you run genkernel? From ps tree it looks like within the livecd environment so I guess you run out of space. You are supposed to do that in chroot...
Comment 11 Juozas Pocius 2020-08-21 14:21:01 UTC
I run it from chrooted environment entered from within livecd. On main livecd environment genkernel cannot be installed as there's no portage tools such as emerge coming with livecd, also ps -Alf shows all processes even when on livecd.
Comment 12 Juozas Pocius 2020-08-21 14:28:07 UTC
(In reply to Juozas Pocius from comment #11)
> I run it from chrooted environment entered from within livecd. On main
> livecd environment genkernel cannot be installed as there's no portage tools
> such as emerge coming with livecd, also ps -Alf shows all processes even
> when on livecd.

Clarification: ^__ ps -Alf on chroot, not livecd
Comment 13 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-21 15:42:50 UTC
I cannot reproduce:

I run your commands in HyperV instead of VirtualBox.

Had a problem with grub (grub-install: error: cannot find EFI directory.) so I had to specify "--target=i386-pc" but this is unrelated.

Yes, during kernel build and even initramfs creation, zombie counter in top will change from 0 to >=0. But for me it went down to 0 again and when genkernel was finished, no zombies were left.

System was able to boot.


So, are you really having a problem or are you just only concerned?
Comment 14 Juozas Pocius 2020-08-21 15:58:58 UTC
Some zombies would remain, but I was able to get arround by issuing SIGCHLD signal to the parent of zombie process and that fixed it. The kernel boots fine after running grub-mkconfig -o /boot/grub/grub.cfg while in chroot to generate config file.
Comment 15 Thomas Deutschmann (RETIRED) gentoo-dev 2020-08-21 16:01:12 UTC
> Some zombies would remain

Did they block you in any way? I.e. did genkernel hang until you killed them? Or did genkernel just normally like expected but you noticed the zombies?
Comment 16 Juozas Pocius 2020-08-21 16:05:16 UTC
(In reply to Thomas Deutschmann from comment #15)
> > Some zombies would remain
> 
> Did they block you in any way? I.e. did genkernel hang until you killed
> them? Or did genkernel just normally like expected but you noticed the
> zombies?

Genkernel would hang if no jobs were left free w/o killing the zombies or sending SIGCHLD to their parent.
Comment 17 Thomas Deutschmann (RETIRED) gentoo-dev 2021-11-15 15:56:15 UTC
Sorry, I don't know what to do with this bug report. I cannot reproduce. If this is happening as described, it shouldn't have any negative impact until you run genkernel in loop and will run out of PIDs at one point (that you cannot kill zombies is normal).

Feel free to suggest a patch if you can reproduce and find the root cause.