dozzie / yumbootstrap

Linux chroot installer for Yum-based distributions
http://dozzie.jarowit.net/trac/wiki/yumbootstrap
GNU General Public License v3.0
119 stars 45 forks source link

Failed to mount /sysroot centos7 #26

Closed zohaibtechknox closed 7 years ago

zohaibtechknox commented 7 years ago

Let me explain my scenario in detail below are commands and script I have used to create a centos-7 image using yumbootstrap .Here is procedure how I bootstrap centos-7 on an ubuntu 14.04 and create a qcow2 image to run in kvm .

sudo mkdir -p /tmp/centos
/usr/sbin/yumbootstrap --verbose centos-7 /tmp/centos
sudo mount proc /tmp/centos/proc -t proc
sudo mount sysfs /tmp/centos/sys -t sysfs
Installation scripts installing yum packages , configurations etc
create-users
sudo bash -c 'tar cf - . | sudo pigz > /tmp/centos.tar.gz'
cp ~/centos.dcso.tar.gz /tmp
./define-domain.sh centos 1024 1 # it is a script which will create centos.xml file for domain defination
sudo qemu-img create -f raw /tmp/centos 30G
sudo mkfs.ext3 -F /tmp/centos
sudo mount -o loop /tmp/centos /mnt
sudo tar -C /mnt -zxf /tmp/centos.dcso.tar.gz
sudo umount /mnt
sudo qemu-img convert -O qcow2 /tmp/centos /var/lib/libvirt/images/centos.qcow2
virsh start centos

FYI I am not installing grub in the image and trying direct kernel boot method to run kvm instance as

<os>
<type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type>
<kernel>/boot/vmlinuz_redhat</kernel>
<initrd>/boot/initramfs_redhat.img</initrd>
<cmdline>root=/dev/vda</cmdline>
</os>

After all this when I have started vm I am getting this issue which is strange to me 2error

dozzie commented 7 years ago

It doesn't seem like it's a problem with yumbootstrap at all. Your initramdisk cannot mount your root filesystem, which doesn't even hit the OS yumbootstrap installed for you.

zohaibtechknox commented 7 years ago

thanks 4 reply