RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1040122 - tune2fs -f option does not work as described (will not forcibly remove journal)
Summary: tune2fs -f option does not work as described (will not forcibly remove journal)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: e2fsprogs
Version: 6.5
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Eric Sandeen
QA Contact: XuWang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-10 18:58 UTC by Jim Faulkner
Modified: 2015-04-16 06:46 UTC (History)
4 users (show)

Fixed In Version: e2fsprogs-1.41.12-20.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1212376 (view as bug list)
Environment:
Last Closed: 2014-10-14 07:54:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Debian BTS 559301 0 None None None Never
Red Hat Product Errata RHBA-2014:1566 0 normal SHIPPED_LIVE e2fsprogs bug fix and enhancement update 2014-10-14 01:27:40 UTC

Description Jim Faulkner 2013-12-10 18:58:01 UTC
Description of problem:
According to the tune2fs man page: -f     Force the tune2fs operation to complete even in the face of errors.  This option is  useful  when  removing  the has_journal  filesystem  feature  from  a filesystem which has an external journal (or is corrupted such that it appears to have an external journal), but that external journal is not available.

This option does not work as described in the man page, as you can see:
[root@kstest ~]# tune2fs -f -O ^has_journal /dev/zoo/home 
tune2fs 1.41.12 (17-May-2010)
The needs_recovery flag is set.  Please run e2fsck before clearing
the has_journal flag.
[root@kstest ~]#

The reason I am doing this is that this is a snapshot of an iSCSI device with an external journal.  The journal is not available, so I want to remove it so that I can mount the filesystem.  Running e2fsck is not possible:
[root@kstest ~]# e2fsck /dev/zoo/home 
e2fsck 1.41.12 (17-May-2010)
External journal has bad superblock
[root@kstest ~]#

Either this is a bug in tune2fs, or a bug in the tune2fs man page.  This issue is also discussed here:
http://www.redhat.com/archives/ext3-users/2013-June/msg00010.html
and here:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=559301

Version-Release number of selected component (if applicable):
[root@kstest ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[root@kstest ~]# uname -a
Linux kstest.its.yale.edu 2.6.32-431.el6.x86_64 #1 SMP Sun Nov 10 22:19:54 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@kstest ~]# rpm -q e2fsprogs
e2fsprogs-1.41.12-18.el6.x86_64
[root@kstest ~]#

How reproducible:
every time

Steps to Reproduce:
1. create ext4 filesystem with external journal (say, on a usb stick)
2. unplug the power (leaving the filesystem's needs_recovery flag set) and unplug the usb stick
3. attempt to forcibly remove the ext4 journal as described in the tune2fs man page

Actual results:
does not work as described in man page

Expected results:
tune2fs should work as described in man page

Additional info:
[root@kstest ~]# tune2fs -l /dev/zoo/home 
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   <none>
Last mounted on:          /home
Filesystem UUID:          433fa4ee-6cbd-4fb0-a5ed-c28bac35591a
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super large_file huge_file uninit_bg dir_nlink extra_isize
Filesystem flags:         signed_directory_hash 
Default mount options:    (none)
Filesystem state:         clean
Errors behavior:          Remount read-only
Filesystem OS type:       Linux
Inode count:              100671488
Block count:              402656256
Reserved block count:     0
Free blocks:              44738705
Free inodes:              56033621
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      927
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
RAID stride:              1
RAID stripe width:        16
Flex block group size:    16
Filesystem created:       Mon Jul 11 21:29:18 2011
Last mount time:          Fri Oct 25 16:02:18 2013
Last write time:          Fri Oct 25 16:02:18 2013
Mount count:              9
Maximum mount count:      -1
Last checked:             Tue Jul 10 09:17:17 2012
Check interval:           0 (<none>)
Lifetime writes:          16 TB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Journal UUID:             046f7c36-e693-4ffb-9923-6a2b8724743c
Journal device:           0xfd06
First orphan inode:       34366576
Default directory hash:   half_md4
Directory Hash Seed:      08dd6251-808f-43bd-9e64-af461b8d0060
Journal backup:           inode blocks
[root@kstest ~]#

Comment 1 Jim Faulkner 2013-12-10 19:50:24 UTC
I have the contents of /var/crash/127.0.0.1-2013-12-10-11:19:48 and /var/crash/127.0.0.1-2013-12-10-14:09:01 if you give me somewhere to upload them.  They are around 80 megabytes each (looks like I can't attach anything bigger than 20 megs to this bug).

Comment 2 Jim Faulkner 2013-12-10 19:51:42 UTC
whoops ignore Comment 1, meant to add that to this bug report (same filesystem, different bug): https://bugzilla.redhat.com/show_bug.cgi?id=1040136

Comment 4 Eric Sandeen 2014-01-09 19:45:42 UTC
It's not clear that this should behave as you wish.

On the one hand, the generic explanation:  "Force the tune2fs operation to complete even in the face of errors" does sound that way.

But then it goes on to list examples about missing external journals, but doesn't make specific mention of missing but *dirty* journals, which is a bit of a different situation than maybe was originally intended.

Still, it seems like it would make sense to allow this - maybe with two "forces" for good measure or something, I'll discuss it upstream.

(In the meantime, I think Ted suggested a workaround in that debian bug?)

Comment 5 Jim Faulkner 2014-01-09 19:50:36 UTC
Yes, I do have a workaround.  Thanks for discussing upstream.  Even if it is decided that it will not remove dirty journals, the tune2fs man page should be updated to reflect that.

Comment 6 Eric Sandeen 2014-01-09 20:05:14 UTC
I'll send a patch upstream which will remove it with "-ff" :


[root@sandeen e2fsprogs]# misc/tune2fs -f -O ^has_journal fsfile.img
tune2fs 1.43-WIP (28-Dec-2013)
The needs_recovery flag is set.  Please run e2fsck before clearing
the has_journal flag.

[root@sandeen e2fsprogs]# misc/tune2fs -ff -O ^has_journal fsfile.img
tune2fs 1.43-WIP (28-Dec-2013)

[root@sandeen e2fsprogs]# dumpe2fs -h fsfile.img  | grep -i featu
dumpe2fs 1.41.12 (17-May-2010)
Filesystem features:      ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize

Comment 7 Eric Sandeen 2014-04-28 19:04:18 UTC
commit 5fe2bd60844cfe5d805e62a4316afaa5cd9d7c83
Author: Eric Sandeen <sandeen>
Date:   Thu Feb 20 20:18:41 2014 -0500

    tune2fs: allow removal of dirty journal with two "-f" options
    
    Jim pointed out that "tune2fs -f -O ^has_journal" won't remove the
    journal if the needs_recovery flag is set; the manpage seems to indicate
    that it should.  And if you've lost an external journal and can no longer
    replay it, how should one proceed?
    
    Change tune2fs so that two "-f" options will allow removal of a dirty
    journal from a filesystem, even if the filesystem needs recovery.
    
    e2fsck can then do its best to pick up the pieces.
    
    Addresses-Debian-Bug: #559301
    
    Reported-by: Jim Faulkner <james.faulkner>
    Signed-off-by: Eric Sandeen <sandeen>
    Signed-off-by: "Theodore Ts'o" <tytso>

Comment 8 Eric Sandeen 2014-05-02 18:53:49 UTC
Built in e2fsprogs-1.41.12-19.el6

Comment 10 XuWang 2014-08-21 06:59:34 UTC
This problem is trigered under such condition:
1. ext3/ext4 file system with external journal device;
2. external journal device is lost;
3. the file system must get the "has_journal" and "needs_recovery" flag.

I use the way of "freeze->thaw" the sepecified file system to add the "needs_recovery" flag to the distro system, and then do the reproduction and verification.

With the e2fsprogs-1.41.4-el10, e2fsprogs-1.41.12-el14, e2fsprogs-1.41.12-el19, the problem is reproduced, shows as below:
:: [  BEGIN   ] :: Running 'tune2fs -f -O ^has_journal /tmp/18054data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1'
:: [   PASS   ] :: Command 'tune2fs -f -O ^has_journal /tmp/18054data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'e2fsck /tmp/18054data.bk.img'
e2fsck 1.41.12 (17-May-2010)
e2fsck: need terminal for interactive repairs
:: [   PASS   ] :: Command 'e2fsck /tmp/18054data.bk.img' (Expected 2-12, got 8)
:: [  BEGIN   ] :: Running 'tune2fs -l /tmp/18054data.bk.img | grep has_journal 1>/dev/null 2>&1'

With the e2fsprogs-1.41.12-el20, with the "-ff" option, the problem is fixed. The result is shown as below:
: [  BEGIN   ] :: Running 'tune2fs -f -O ^has_journal /tmp/21158data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1'
:: [   PASS   ] :: Command 'tune2fs -f -O ^has_journal /tmp/21158data.bk.img 2>&1 | grep has_journal 1>/dev/null 2>&1' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'e2fsck /tmp/21158data.bk.img'
e2fsck 1.41.12 (17-May-2010)
e2fsck: need terminal for interactive repairs
:: [   FAIL   ] :: Command 'e2fsck /tmp/21158data.bk.img' (Expected 12, got 8)
:: [  BEGIN   ] :: Running 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1'
:: [   PASS   ] :: Command 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'tune2fs -ff -O ^has_journal /tmp/21158data.bk.img'
tune2fs: Invalid argument while trying to open external journal
tune2fs 1.41.12 (17-May-2010)
Journal removed
:: [   PASS   ] :: Command 'tune2fs -ff -O ^has_journal /tmp/21158data.bk.img' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1'
:: [   PASS   ] :: Command 'tune2fs -l /tmp/21158data.bk.img | grep has_journal 1>/dev/null 2>&1' (Expected 1, got 1)
:: [ 14:26:12 ] :: [ INFO    ] :: Verify the bug 1040122 successfully

More info please check the beaker job:
https://beaker.engineering.redhat.com/jobs/727330.

Comment 11 errata-xmlrpc 2014-10-14 07:54:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-1566.html


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