Bug 1001063

Summary: livecd-creator hangs when working in mock chroot
Product: [Fedora] Fedora EPEL Reporter: Aleksey Avdeev <solo>
Component: livecd-toolsAssignee: Brian Lane <bcl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: el6CC: apevec, bcl, katzj, vanmeeuwen+fedora
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-27 23:07:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1002227    

Description Aleksey Avdeev 2013-08-26 12:29:27 UTC
Description of problem:

  livecd-creator hangs when creating the image of a mock chroot:

$ sudo -H /usr/sbin/mock -r koji/ext-centos6-livecd-build-21-41.t2 --verbose --cwd /tmp --chroot -- /usr/bin/livecd-creator -c /tmp/koji-image-ext-centos6-livecd-build-170.ks -d -v --logfile /tmp/livecd.log --cache /tmp/koji-livecd -f test-LiveCD-CentOS6-0.0.1-1
INFO: mock.py version 1.1.32 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
...
DEBUG: Executing command: ['/bin/mount', '-n', '-t', 'proc', 'proc', '/var/lib/mock/ext-centos6-livecd-build-21-41.t2/root/proc'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: Child return code was: 0
DEBUG: Executing command: ['/bin/mount', '-n', '-t', 'sysfs', 'mock_chroot_sys', '/var/lib/mock/ext-centos6-livecd-build-21-41.t2/root/sys'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: Child return code was: 0
DEBUG: Executing command: ['/bin/mount', '-n', '-t', 'tmpfs', 'mock_chroot_shmfs', '/var/lib/mock/ext-centos6-livecd-build-21-41.t2/root/dev/shm'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: Child return code was: 0
DEBUG: Executing command: ['/bin/mount', '-n', '-t', 'devpts', '-o', 'gid=5,mode=0620,ptmxmode=0666,newinstance', 'mock_chroot_devpts', '/var/lib/mock/ext-centos6-livecd-build-21-41.t2/root/dev/pts'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: Child return code was: 0
DEBUG: Executing command: ['/bin/mount', '-n', '--bind', '/dev', '/var/lib/mock/ext-centos6-livecd-build-21-41.t2/root/dev'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: Child return code was: 0
DEBUG: Executing command: ['/bin/mount', '-n', '--bind', '/selinux', '/var/lib/mock/ext-centos6-livecd-build-21-41.t2/root/selinux'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: Child return code was: 0
DEBUG: Executing command: ['/bin/mount', '-n', '--bind', '/tmp/mock-selinux-plugin.DxBDX5', '/var/lib/mock/ext-centos6-livecd-build-21-41.t2/root/proc/filesystems'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: Child return code was: 0
Start: chroot ['/usr/bin/livecd-creator', '-c', '/tmp/koji-image-ext-centos6-livecd-build-170.ks', '-d', '-v', '--logfile', '/tmp/livecd.log', '--cache', '/tmp/koji-livecd', '-f', 'test-LiveCD-CentOS6-0.0.1-1']
DEBUG: Executing command: ['/usr/bin/livecd-creator', '-c', '/tmp/koji-image-ext-centos6-livecd-build-170.ks', '-d', '-v', '--logfile', '/tmp/livecd.log', '--cache', '/tmp/koji-livecd', '-f', 'test-LiveCD-CentOS6-0.0.1-1'] with env {'LANG': 'ru_RU.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
DEBUG: mke2fs 1.41.12 (17-May-2010)
mke2fs 1.41.12 (17-May-2010)
DEBUG: Discarding device blocks: done
...
resize2fs 1.41.12 (17-May-2010)
DEBUG: Resizing the filesystem on /var/tmp/imgcreate-fjgtPt/tmp-ynWFTe/ext3fs.img to 262144 (4k) blocks.
DEBUG: The filesystem on /var/tmp/imgcreate-fjgtPt/tmp-ynWFTe/ext3fs.img is now 262144 blocks long.
Resizing the filesystem on /var/tmp/imgcreate-fjgtPt/tmp-ynWFTe/ext3fs.img to 262144 (4k) blocks.
The filesystem on /var/tmp/imgcreate-fjgtPt/tmp-ynWFTe/ext3fs.img is now 262144 blocks long.

DEBUG: e2fsck 1.41.12 (17-May-2010)
e2fsck 1.41.12 (17-May-2010)
DEBUG: Pass 1: Checking inodes, blocks, and sizes
Pass 1: Checking inodes, blocks, and sizes
DEBUG: Pass 2: Checking directory structure
Pass 2: Checking directory structure
DEBUG: Pass 3: Checking directory connectivity
Pass 3: Checking directory connectivity
DEBUG: Pass 4: Checking reference counts
Pass 4: Checking reference counts
DEBUG: Pass 5: Checking group summary information
Pass 5: Checking group summary information
DEBUG: _test-LiveCD-Cen: 16490/65536 files (0.3% non-contiguous), 142244/262144 blocks
_test-LiveCD-Cen: 16490/65536 files (0.3% non-contiguous), 142244/262144 blocks

  Then you can just prirvat process.


Version-Release number of selected component (if applicable):

  CentOS 6.4 + EPEL 6:

$ uname -a
Linux kojicos.office.altell.ru 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

$ rpm -qa| grep 'livecd\|udev\|lvm\|device-mapper'
lvm2-libs-2.02.98-9.el6.x86_64
device-mapper-persistent-data-0.1.4-1.el6.x86_64
device-mapper-libs-1.02.77-9.el6.x86_64
libudev-devel-147-2.46.el6.x86_64
lvm2-2.02.98-9.el6.x86_64
libudev-147-2.46.el6.x86_64
udev-147-2.46.el6.x86_64
device-mapper-1.02.77-9.el6.x86_64
livecd-tools-13.4.4-2.el6.x86_64
device-mapper-event-libs-1.02.77-9.el6.x86_64
python-pyudev-0.15-1.el6.noarch
device-mapper-event-1.02.77-9.el6.x86_64


How reproducible:

Steps to Reproduce:
1. Customize mock the mount /dev and /selinux from the base system.
2. Create a chroot.
3. Start the assembly of the image, using a mock.


Actual results:

  The build process hangs at the stage of handling to the /sbin/dmsetup.


Expected results:

  Creating an image or priryvanie process of returning an error flag.


Additional info:

  If the parameters causing the / sbin / dmsetup (see) add keys "," we see that the dmsetup expects what that events from udev.

<mock-chroot>[root@kojicos /]# /usr/bin/livecd-creator -c /tmp/koji-image-ext-centos6-livecd-build-170.ks -d -v --logfile /tmp/livecd.log --cache /tmp/koji-liviveCD-CentOS6-0.0.1-1
mke2fs 1.41.12 (17-May-2010)
Discarding device blocks: done                            
Filesystem label=_test-LiveCD-Cen
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
65536 inodes, 262144 blocks
2621 blocks (1.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=268435456
8 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 29 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds
...
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
_test-LiveCD-Cen: 16490/65536 files (0.6% non-contiguous), 142245/262144 blocks
dm version   OF   [16384] (*1)
Udev cookie 0xd4dbce6 (semid 0) created
Udev cookie 0xd4dbce6 (semid 0) incremented to 1
Udev cookie 0xd4dbce6 (semid 0) incremented to 2
Udev cookie 0xd4dbce6 (semid 0) assigned to CREATE task(0) with flags (0x0)
dm create imgcreate-2087-20709 LIVECD-imgcreate-2087-20709 OF   [16384] (*1)
dm reload imgcreate-2087-20709  OF   [16384] (*1)
dm resume imgcreate-2087-20709  OF   [16384] (*1)
imgcreate-2087-20709: Stacking NODE_ADD (253,5) 0:6 0660 [verify_udev]
Udev cookie 0xd4dbce6 (semid 0) decremented to 1
Udev cookie 0xd4dbce6 (semid 0) waiting for zero

  This freeze does not occur if the call /sbin/dmsetup to use the key --noudevsync.

Comment 1 Aleksey Avdeev 2013-08-28 12:37:17 UTC
(In reply to Aleksey Avdeev from comment #0)
>   This freeze does not occur if the call /sbin/dmsetup to use the key
> --noudevsync.

In repository https://github.com/solooboroten/fedora-livecd offer options to add options --noudevsync:

1. Branch el6/noudevsync (see https://github.com/solooboroten/fedora-livecd/tree/el6/noudevsync), for EPEL6: https://github.com/solooboroten/fedora-livecd/commit/6e98bec0cc16195d776096886db102461e174312 . This version of checked package livecd-tools-13.4.4. This variant works. Tested self-assembled package  livecd-tools-13.4.4-2.el6.altell1.1 (see https://github.com/solooboroten/fedora-livecd/commit/b049ccc9daafdad57092788dc10747f5ab794cb7).

2. Branch noudevsync (see https://github.com/solooboroten/fedora-livecd/tree/noudevsync), for master: https://github.com/solooboroten/fedora-livecd/commit/a65871f531c48d32084dd4ad039ac0724ef47014 .

Comment 2 Brian Lane 2015-02-27 23:07:46 UTC
You shouldn't be running mock as the root user. Add a user to the mock group and run it from that account, doing it as root can result in odd behavior.