Bug 1262621 - CoreOS image: EXT4-fs (sda3): couldn't mount RDWR because of unsupported optional features (ff000000)
CoreOS image: EXT4-fs (sda3): couldn't mount RDWR because of unsupported opti...
Status: CLOSED CANTFIX
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs (Show other bugs)
7.1
x86_64 Linux
unspecified Severity medium
: rc
: ---
Assigned To: Richard W.M. Jones
Virtualization Bugs
:
Depends On: 1262491
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-13 11:47 EDT by Richard W.M. Jones
Modified: 2015-09-13 14:10 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 1262491
Environment:
Last Closed: 2015-09-13 14:10:41 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Richard W.M. Jones 2015-09-13 11:47:24 EDT
Description:

Trying to mount a CoreOS stable image on the RHEL 7 kernel fails
with this error:

[    2.838285] EXT4-fs (sda3): couldn't mount RDWR because of unsupported optional features (ff000000)

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

host kernel: 3.10.0-229.el7.x86_64
libguestfs-1.28.1-1.53.el7.x86_64

How reproducible:

100%

Steps to Reproduce:

Download the CoreOS stable from:
http://stable.release.core-os.net/amd64-usr/766.3.0/coreos_production_qemu_image.img.bz2
and uncompress it.

On Fedora, this image can be opened for write with guestfish.

On RHEL 7.1 however, the image cannot be opened for write:

$ guestfish -a coreos_production_qemu_image.img -m /dev/sda3
libguestfs: error: mount_options: /dev/sda3 on / (options: ''): mount: wrong fs type, bad option, bad superblock on /dev/sda3,

Add the guestfish -v -x parameters to show the kernel error:
$ guestfish -v -x -a coreos_production_qemu_image.img -m /dev/sda3
[...]
mount -o  /dev/sda3 /sysroot/
[   11.882105] EXT4-fs (sda3): couldn't mount RDWR because of unsupported optional features (ff000000)

The same thing happens with loop/kpartx, but it's a bit more complicated
because first you have to convert the format to raw:

$ mkdir /tmp/mnt
$ qemu-img convert coreos_production_qemu_image.img coreos_production_qemu_image.img.raw
$ sudo losetup /dev/loop0 coreos_production_qemu_image.img.raw
$ sudo kpartx -av /dev/loop0 
$ sudo mount /dev/mapper/loop0p3 /tmp/mnt
mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop0p3,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.
$ dmesg | tail
...
[1241914.741858] EXT4-fs (dm-2): couldn't mount RDWR because of unsupported optional features (ff000000)
$ sudo kpartx -d /dev/loop0
$ sudo losetup -d /dev/loop0
Comment 2 Richard W.M. Jones 2015-09-13 14:08:36 EDT
This was solved by Eric Sandeen.  His comment follows:

My best guess is that they're using something similar to the hack around
line 458 of:

https://chromium.googlesource.com/chromiumos/platform/crosutils/+/ea621903e927ac
f77889bcda4fa71636f4af7158/common.sh

  # These two helpers clobber the ro compat value in our root filesystem.

  disable_rw_mount() {
    local rootfs="$1"
    local offset="${2-0}"  # in bytes
    local ro_compat_offset=$((0x464 + 3))  # Set 'highest' byte
    printf '\377' |
      sudo dd of="$rootfs" seek=$((offset + ro_compat_offset)) \
            conv=notrunc count=1 bs=1
  }

There's a new flag upstream that would serve this purpose better:

  commit 2cb5cc8b09c939c77826635956c35995b15c9331
  Author: Darrick J. Wong <darrick.wong@oracle.com>
  Date:   Thu Feb 12 22:31:21 2015 -0500

    ext4: support read-only images

    Add a rocompat feature, "readonly" to mark a FS image as read-only.
    The feature prevents the kernel and e2fsprogs from changing the image;
    the flag can be toggled by tune2fs.
Comment 3 Richard W.M. Jones 2015-09-13 14:10:09 EDT
The link in the previous comment was split.  It should be:
https://chromium.googlesource.com/chromiumos/platform/crosutils/+/ea621903e927acf77889bcda4fa71636f4af7158/common.sh

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