Bug 669655

Summary: mkdumprd failed to build initrd in read-only root
Product: Red Hat Enterprise Linux 6 Reporter: Chao Ye <cye>
Component: kexec-toolsAssignee: Cong Wang <amwang>
Status: CLOSED ERRATA QA Contact: Chao Ye <cye>
Severity: medium Docs Contact:
Priority: low    
Version: 6.3CC: czhang, phan, rkhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: kexec-tools-2_0_0-162_el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 14:15:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test patch none

Description Chao Ye 2011-01-14 10:29:20 UTC
Description of problem:
In read only root, mkdumprd failed to create tmnt to mount the DUMP_TARGET. In this condition the code should use the readable dir to make the tmnt dir, such as /boot, instead of /tmp.

Version-Release number of selected component (if applicable):
kexec-tools-2.0.0-160.el6

How reproducible:
100%

Steps to Reproduce:
1.Setup read-only root
2./sbin/mkdumprd -d -f /boot/initrd-in-read-only-root.img $(uname -r | sed 's/smp//g')
3.
  
Actual results:
mkdumprd failed

Expected results:
mkdumprd use /boot to create tmnt dir

Additional info:

Comment 2 Cong Wang 2011-01-21 09:22:31 UTC
But you can still 'cd /boot;' before running mkdumprd.

Comment 3 Chao Ye 2011-01-21 10:27:12 UTC
(In reply to comment #2)
> But you can still 'cd /boot;' before running mkdumprd.

Yes, I did that.
==================================================
    # Switch to a readable fs
    cd /boot
    
    # Mount root as read only
    mount -o remount,ro /
    touch /testmountrootasreadonly
    if [ -f /testmountrootasreadonly ]; then
        echo "Failed to mount / as read only" | tee -a /boot/test.result
        return
    fi
    
    # Test mkdumprd
    /sbin/mkdumprd -d -f /boot/initrd-in-read-only-root.img $(uname -r | sed 's/smp//g')

Comment 4 Cong Wang 2011-01-21 10:34:10 UTC
Created attachment 474609 [details]
Test patch

Please try this patch.

Comment 5 Chao Ye 2011-01-24 02:37:56 UTC
Patch don't works:
=====================================================================

[root@ibm-x3550m3-02 /]# mount -o remount,ro /
[root@ibm-x3550m3-02 /]# cd /boot/
[root@ibm-x3550m3-02 boot]# /sbin/mkdumprd -d -f /boot/initrd-in-read-only-rooimg $(uname -r | sed 's/smp//g')
WARNING: using /boot for temporary files
tac: cannot create temporary file in `/tmp': Read-only file system
++ mktemp -dq
+ tmnt=
+ kdump_chk 'mount -t ext4 /dev/mapper/vg_ibmx3550m302-lv_root ' 'Bad mount point /dev/mapper/vg_ibmx3550m302-lv_root'
++ eval mount -t ext4 /dev/mapper/vg_ibmx3550m302-lv_root
+++ mount -t ext4 /dev/mapper/vg_ibmx3550m302-lv_root
Usage: mount -V                 : print version
       mount -h                 : print this help
       mount                    : list mounted filesystems
       mount -l                 : idem, including volume labels
So far the informational part. Next the mounting.
The command is `mount [-t fstype] something somewhere'.
Details found in /etc/fstab may be omitted.
       mount -a [-t|-O] ...     : mount all stuff from /etc/fstab
       mount device             : mount device at the known place
       mount directory          : mount known device here
       mount -t type dev dir    : ordinary mount command
Note that one does not really mount a device, one mounts
a filesystem (of the given type) found on the device.
One can also mount an already visible directory tree elsewhere:
       mount --bind olddir newdir
or move a subtree:
       mount --move olddir newdir
One can change the type of mount containing the directory dir:
       mount --make-shared dir
       mount --make-slave dir
       mount --make-private dir
       mount --make-unbindable dir
One can change the type of all the mounts in a mount subtree
containing the directory dir:
       mount --make-rshared dir
       mount --make-rslave dir
       mount --make-rprivate dir
       mount --make-runbindable dir
A device can be given by name, say /dev/hda1 or /dev/cdrom,
or by label, using  -L label  or by uuid, using  -U uuid .
Other options: [-nfFrsvw] [-o options] [-p passwdfd].
For many more details, say  man 8 mount .
+ rc=
+ echo '/etc/kdump.conf: Bad mount point /dev/mapper/vg_ibmx3550m302-lv_root'
/etc/kdump.conf: Bad mount point /dev/mapper/vg_ibmx3550m302-lv_root
+ cleanup_and_exit 1
+ rm -rf /boot/initrd.go7ZSD
+ rm -f /boot/initrd.img.15wdnb
+ rm -f /boot/disklist.eccJTl
+ exit 1

Comment 7 Chao Ye 2011-02-28 07:53:54 UTC
Tested with latest build:
=================================================================
[root@storageqe-01 boot]# mount -o remount,ro /
[root@storageqe-01 boot]# rpm -q kernel kexec-tools
kernel-2.6.32-118.el6.x86_64
kexec-tools-2.0.0-166.el6.x86_64
[root@storageqe-01 boot]# /sbin/mkdumprd -d -f /boot/initrd-in-read-only-root.img $(uname -r)
WARNING: using /boot for temporary files
mount: /dev/cciss/c0d0p2 already mounted or /boot/tmp.2SpKyF0uWe busy
mount: according to mtab, /dev/cciss/c0d0p2 is mounted on /
/etc/kdump.conf: Bad mount point /dev/cciss/c0d0p2
[root@storageqe-01 boot]# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2    273887600   2459420 257515504   1% /
tmpfs                  2930052         0   2930052   0% /dev/shm
/dev/cciss/c0d0p1       198337     30829    157268  17% /boot

Comment 8 Chao Ye 2011-03-14 02:19:38 UTC
Tested with latest build:
===============================================================
[root@ibm-hs21-01 boot]# mount -o remount,ro /
[root@ibm-hs21-01 boot]# cat /etc/kdump.conf 
ext4 /dev/sda1
[root@ibm-hs21-01 boot]# rpm -q kernel kexec-tools
kernel-2.6.32-122.el6.x86_64
kexec-tools-2.0.0-169.el6.x86_64
[root@ibm-hs21-01 boot]# /etc/init.d/kdump restart
Stopping kdump:[  OK  ]
Detected change(s) the following file(s):
  
  /etc/kdump.conf
Rebuilding /boot/initrd-2.6.32-122.el6.x86_64kdump.img
WARNING: using /boot for temporary files
Warning: There is not enough space to save a vmcore.
         The size of /dev/sda1 should be much greater than 16333940 kilo bytes.
Your running kernel is using more than 70% of the amount of space you reserved for kdump, you should consider increasing your crashkernel reservation[WARNING]
Starting kdump:[  OK  ]

Change status to VERIFIED.

Comment 9 errata-xmlrpc 2011-05-19 14:15:55 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0736.html