Bug 1273199 - livemedia-creator --make-ostree-live error
Summary: livemedia-creator --make-ostree-live error
Alias: None
Product: Fedora
Classification: Fedora
Component: lorax
Version: 22
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Brian Lane
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2015-10-19 22:27 UTC by Jon Disnard
Modified: 2015-11-11 01:09 UTC (History)
2 users (show)

Fixed In Version: lorax-24.4-1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2015-11-11 01:09:06 UTC
Type: Bug

Attachments (Terms of Use)
The kickstart used (1.09 KB, text/plain)
2015-10-19 22:27 UTC, Jon Disnard
no flags Details
This patch fixed it (537 bytes, patch)
2015-10-20 02:42 UTC, Jon Disnard
no flags Details | Diff

Description Jon Disnard 2015-10-19 22:27:11 UTC
Created attachment 1084551 [details]
The kickstart used

Description of problem:

  Trying to get LMC to generate Live Atomic PXE via --make-os-tree & --no-virt. 
It creates a disk image file, but then fails trying to loop-mount the partitioned image.

2015-10-19 21:59:31,196: Partition mounted on /var/tmp/tmpC6pfKp size=6291456000
loop deleted : /dev/loop0
2015-10-19 21:59:42,564: Disk Image install successful
2015-10-19 21:59:42,569: working dir is /var/tmp/tmpgH2KBm
mount: /dev/loop0 is write-protected, mounting read-only
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
Traceback (most recent call last):
  File "/sbin/livemedia-creator", line 1498, in <module>
  File "/sbin/livemedia-creator", line 1459, in main
    with Mount(disk_img, opts="loop") as mnt_dir:
  File "/usr/lib/python2.7/site-packages/pylorax/imgutils.py", line 301, in __enter__
    self.mnt = mount(self.dev, self.opts, self.mnt)
  File "/usr/lib/python2.7/site-packages/pylorax/imgutils.py", line 185, in mount
  File "/usr/lib/python2.7/site-packages/pylorax/executils.py", line 419, in runcmd
    return execWithRedirect(cmd[0], cmd[1:], **kwargs)
  File "/usr/lib/python2.7/site-packages/pylorax/executils.py", line 187, in execWithRedirect
    raise subprocess.CalledProcessError(ret, [command]+argv)
subprocess.CalledProcessError: Command '['mount', '-o', 'loop', '/var/tmp/diskjt5tO8.img', '/var/tmp/lorax.imgutils.W7_ySR']' returned non-zero exit status 32

  Using fdisk shows the disk image layout:

# fdisk -l /var/tmp/diskjt5tO8.img 
Disk /var/tmp/diskjt5tO8.img: 6.4 GiB, 6817841152 bytes, 13316096 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xf78b8271

Device                   Boot   Start      End  Sectors  Size Id Type
/var/tmp/diskjt5tO8.img1 *       2048  1026047  1024000  500M 83 Linux
/var/tmp/diskjt5tO8.img2      1026048 13314047 12288000  5.9G 83 Linux

  Seeing the partitions I'm surprised the tool is trying to directly loop mount the disk image without providing a starting offset and size so it latches on to one of the two filesystems. Using kpartx on the disk image works fine, and I'm able to mount the rootfs within.

# kpartx -av /var/tmp/diskjt5tO8.img 
add map loop0p1 (253:0): 0 1024000 linear /dev/loop0 2048
add map loop0p2 (253:2): 0 12288000 linear /dev/loop0 1026048

[root@localhost lorax]# mount /dev/mapper/loop0p2 /mnt/

[root@localhost lorax]# ls /mnt/
bin  boot  dev  etc  home  lib  lib64  lost+found  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var

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

# rpm -q fedora-release lorax

How reproducible:

I've attached the kickstart file used in the process. It's how you would reproduce. This is a slightly modified kickstart provided by lorax in "/usr/local/doc/lorax/rhel-atomic-pxe-live.ks"

Steps to Reproduce:
1. livemedia-creator --no-virt --make-ostree-live --ks rhel-atomic-pxe-live.ks

Actual results:

Expected results:

Additional info:

Comment 1 Brian Lane 2015-10-19 22:54:05 UTC
Note to self: Looks like the make-ostree-live code is assuming that no-virt always means a fsimage, which isn't true.

Comment 2 Jon Disnard 2015-10-20 02:42:50 UTC
Created attachment 1084579 [details]
This patch fixed it

Applies against recent https://github.com/rhinstaller/lorax.git

This wasn't my idea, Brian mentioned it as a possible fix, and it work.

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