Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1596481 - Creating raw image with virt-builder for User Mode Linux
Summary: Creating raw image with virt-builder for User Mode Linux
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.7-Alt
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-29 05:45 UTC by Lakshmipathi
Modified: 2018-06-29 16:36 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-29 09:20:16 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Lakshmipathi 2018-06-29 05:45:07 UTC
Description of problem:

I'd like to create raw image with virt-builder and then use it with User Mode Linux. But UML refuses to boot. 

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

How reproducible:


Steps to Reproduce:
1.virt-builder fedora-26 --root-password password:webminal --install emacs,gcc --format raw
2.vmlinux ubda=/tmpuserdata/fedora-26.img mem=1024m
3.

Actual results:
<snip>
[    0.080000] 6200         6291456 ubda  driver: uml-blkdev
[    0.080000]   6201         1048576 ubda1 755af962-01
[    0.080000]   6202          629760 ubda2 755af962-02
[    0.080000]   6203         4612096 ubda3 755af962-03
[    0.080000] No filesystem could mount root, tried:  ext3 ext4 iso9660 fuseblk udf
[    0.080000] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(98,0)
[    0.080000] CPU: 0 PID: 1 Comm: swapper Not tainted 4.3.5 #4
[    0.080000] Stack:
[    0.080000]  a0457d80 6006b532 6022c5d4 605248cd
[    0.080000]  6009accd 600f4a30 a0457d90 602219ad
[    0.080000]  a0457eb0 6009aad7 00000000 a0457ed0
[    0.080000] Call Trace:
[    0.080000]  [<6009accd>] ? printk+0x0/0x94
[    0.080000]  [<60025b3e>] show_stack+0xfe/0x15b
[    0.080000]  [<6006b532>] ? dump_stack_print_info+0xe1/0xea
[    0.080000]  [<6022c5d4>] ? bust_spinlocks+0x0/0x4f
[    0.080000]  [<6009accd>] ? printk+0x0/0x94
[    0.080000]  [<600f4a30>] ? SyS_mount+0x0/0xc8
[    0.080000]  [<602219ad>] dump_stack+0x2a/0x2c
[    0.080000]  [<6009aad7>] panic+0x13e/0x2b3
[    0.080000]  [<6009a999>] ? panic+0x0/0x2b3
[    0.080000]  [<6022b1b7>] ? scnprintf+0x0/0x86
[    0.080000]  [<60037cfa>] ? unblock_signals+0x0/0x81
[    0.080000]  [<60406c50>] ? __poll_nocancel+0x7/0x57
[    0.080000]  [<600680fd>] ? log_next+0x0/0x27
[    0.080000]  [<6009accd>] ? printk+0x0/0x94
[    0.080000]  [<602287f3>] ? strlen+0x0/0x16
[    0.080000]  [<600f4a30>] ? SyS_mount+0x0/0xc8
[    0.080000]  [<600017eb>] change_floppy+0x0/0x1a2
[    0.080000]  [<602285c7>] ? strcpy+0x0/0x18
[    0.080000]  [<60001a29>] mount_root+0x9c/0xa0
[    0.080000]  [<6022873b>] ? strncmp+0x0/0x25
[    0.080000]  [<60001c61>] prepare_namespace+0x234/0x28e
[    0.080000]  [<60037cfa>] ? unblock_signals+0x0/0x81
[    0.080000]  [<600f0616>] ? SyS_dup+0x0/0x5e
[    0.080000]  [<600012bb>] kernel_init_freeable+0x2f7/0x31e
[    0.080000]  [<6005caa2>] ? finish_task_switch+0x37/0x9b
[    0.080000]  [<60453374>] kernel_init+0x12/0x148
[    0.080000]  [<600247b4>] new_thread_handler+0x81/0xa3
[    0.080000] 

</snip>


Expected results:

Should boot properly

Additional info:
$file /tmpuserdata/fedora-26.img 
/tmpuserdata/fedora-26.img: x86 boot sector; partition 1: ID=0x83, active, starthead 4, startsector 2048, 2097152 sectors; partition 2: ID=0x82, starthead 254, startsector 2099200, 1259520 sectors; partition 3: ID=0x83, starthead 254, startsector 3358720, 9224192 sectors, code offset 0x63

$cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core) 

yum list | grep libguestfs
libguestfs.x86_64                        1:1.36.10-6.el7_5.2      @updates      
libguestfs-tools.noarch                  1:1.36.10-6.el7_5.2      @updates      
libguestfs-tools-c.x86_64                1:1.36.10-6.el7_5.2      @updates      
libguestfs-bash-completion.noarch        1:1.36.10-6.el7_5.2      updates       
libguestfs-benchmarking.x86_64           1:1.36.10-6.el7_5.2      updates       
libguestfs-debuginfo.x86_64              1:1.36.10-6.el7_5.2      base-debuginfo
libguestfs-devel.x86_64                  1:1.36.10-6.el7_5.2      updates       
libguestfs-gfs2.x86_64                   1:1.36.10-6.el7_5.2      updates       
libguestfs-gobject.x86_64                1:1.36.10-6.el7_5.2      updates       
libguestfs-gobject-devel.x86_64          1:1.36.10-6.el7_5.2      updates       
libguestfs-gobject-doc.noarch            1:1.36.10-6.el7_5.2      updates       
libguestfs-inspect-icons.noarch          1:1.36.10-6.el7_5.2      updates       
libguestfs-java.x86_64                   1:1.36.10-6.el7_5.2      updates       
libguestfs-java-devel.x86_64             1:1.36.10-6.el7_5.2      updates       
libguestfs-javadoc.noarch                1:1.36.10-6.el7_5.2      updates       
libguestfs-man-pages-ja.noarch           1:1.36.10-6.el7_5.2      updates       
libguestfs-man-pages-uk.noarch           1:1.36.10-6.el7_5.2      updates       
libguestfs-rescue.x86_64                 1:1.36.10-6.el7_5.2      updates       
libguestfs-rsync.x86_64                  1:1.36.10-6.el7_5.2      updates       
libguestfs-winsupport.x86_64             7.2-2.el7                base          
libguestfs-xfs.x86_64                    1:1.36.10-6.el7_5.2      updates       
ocaml-libguestfs.x86_64                  1:1.36.10-6.el7_5.2      updates       
ocaml-libguestfs-devel.x86_64            1:1.36.10-6.el7_5.2      updates       
python-libguestfs.x86_64                 1:1.36.10-6.el7_5.2      updates       
ruby-libguestfs.x86_64                   1:1.36.10-6.el7_5.2      updates

Comment 2 Richard W.M. Jones 2018-06-29 07:42:31 UTC
virt-builder produces fully partitioned images.

If you want the raw root filesystem, then you need to add an
extra step to the process after running virt-builder:

$ virt-filesystems -a fedora-26.img --all --long -h
Name       Type        VFS   Label  MBR  Size  Parent
/dev/sda1  filesystem  ext4  -      -    1.0G  -
/dev/sda2  filesystem  swap  -      -    615M  -
/dev/sda3  filesystem  xfs   -      -    4.4G  -           <----
/dev/sda1  partition   -     -      83   1.0G  /dev/sda
/dev/sda2  partition   -     -      82   615M  /dev/sda
/dev/sda3  partition   -     -      83   4.4G  /dev/sda
/dev/sda   device      -     -      -    6.0G  -

$ guestfish -a fedora-26.img run : download /dev/sda3 root.xfs 

and then use root.xfs as the device.

Comment 3 Lakshmipathi 2018-06-29 09:02:56 UTC
I tested above extra setup it worked fine. thanks for the help.

ps: Quickly checking `virt-builder --help`, i don't think it has an option to provide filesystem type(ext4/xfs) for rootfs, it may be helpful in some use-cases.

Comment 4 Richard W.M. Jones 2018-06-29 09:20:16 UTC
The filesystem type is determined by the source template.  In
this case Fedora builds templates by default with XFS.

You could try converting filesystems, eg:

$ virt-builder fedora-26
$ virt-tar-out -a fedora-26.img / root.tar
$ virt-make-fs root.tar root.ext4 --type=ext4 --size=4G
$ file root.ext4 
root.ext4: Linux rev 1.0 ext4 filesystem data, UUID=b78aca44-b069-4cf7-ae56-ed5d074771c3 (extents) (64bit) (large files) (huge files)

Comment 5 Lakshmipathi 2018-06-29 16:36:15 UTC
nice, thank for the details.


Note You need to log in before you can comment on or make changes to this bug.