fsck.btrfs -a doesn’t work (called from mountall)

Bug #460246 reported by Anders Kaseorg
42
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Linux Mint
New
Undecided
Unassigned
btrfs-tools (Debian)
Fix Released
Unknown
btrfs-tools (Ubuntu)
Fix Released
Undecided
Surbhi Palande

Bug Description

Binary package hint: btrfs-tools

With a btrfs filesystem in fstab, mountall tries to call ‘fsck.btrfs -a <device>’. This fails with:

Could not open -a

Related branches

Changed in btrfs-tools (Ubuntu):
status: New → Confirmed
Surbhi Palande (csurbhi)
Changed in btrfs-tools (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Surbhi Palande (csurbhi)
Revision history for this message
Rocko (rockorequin) wrote :

Debian has a bug report at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=567681 for this.

Revision history for this message
Gary M (garym) wrote :

Using maverick, the symlink fsck.btrfs doesn't exist, as mentioned in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=571300 .

Changed in btrfs-tools (Debian):
status: Unknown → Confirmed
Revision history for this message
god (humper) wrote :

Is there some ppa which could be used to help with testing of fix?

Revision history for this message
Gary M (garym) wrote :

@MSU : no, there has been no relevant upstream software release yet.

Revision history for this message
Martin Pitt (pitti) wrote :

I agree that we should rather fix btrfsck to ignore -a and -y (until it can handle it properly) instead of working around this in mountall, udisks, perhaps gparted, and other places.

Revision history for this message
Loïc Minier (lool) wrote :

See also bug #660649

Revision history for this message
Loïc Minier (lool) wrote :

I created a /sbin/fsck.btrfs with:

#!/bin/sh

opts=""

for arg; do
    case "$arg" in
      -*)
        continue
      ;;
      *)
        opts="$opts $arg"
      ;;
    esac
done

exec echo /sbin/btrfsck $opts

it's a bit crude, but seems to call btrfsck correctly, however I still can't boot:
Begin: Running /scripts/init-premount ... done.
Begin: Mounting root file system ... Begin: Running /scripts/local-top ... done.
Begin: Running /scripts/local-premount ... [ 3.909118] usb 1-1.1: new high speed USB device using ehci-omap and address 3
done.
[ 4.003784] device label rootfs devid 1 transid 59 /dev/disk/by-uuid/ff40f0eb-61ad-43d5-a494-ea19859ac634
[ 4.033538] Btrfs detected SSD devices, enabling SSD mode
Begin: Running /scripts/local-bottom ... done.
done.
Begin: Running /scripts/init-bottom ... done.
fsck from util-linux-ng 2.17.2
/sbin/btrfsck /dev/mmcblk0p2
mount: / not mounted already, or bad option
mountall: mount / [240] terminated with status 32
mountall: Filesystem could not be mounted: /
An error occurred while mounting /
Press S to skip mounting or M for manual recovery

Revision history for this message
Loïc Minier (lool) wrote :

Gah, I had left a debug "echo" in the script; I removed it now, but it fails with:
fsck from util-linux-ng 2.17.2
found 432455680 bytes used err is 0
total csum bytes: 383952
total tree bytes: 39288832
total fs tree bytes: 37183488
btree space waste bytes: 11138633
file data blocks allocated: 393166848
 referenced 393068544
Btrfs Btrfs v0.19
An error occurred while mounting /
Press S to skip mounting or M for manual recovery

Revision history for this message
Loïc Minier (lool) wrote :

Ok, the issue was errors=remount-ro in fstab; replacing this with "defaults" and I could successfully boot at last. This latter issue is a bug in linaro-image-tools, bug #745771.

Revision history for this message
Loïc Minier (lool) wrote :

I've pushed a btrfs-tools package in my PPA with the symlink and a patch to skip "-*" flags passed to btrfsck; would someone please test it? I can test on armel, but I don't have an armel build of it (and I'm lazy).

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package btrfs-tools - 0.19+20100601-3ubuntu2

---------------
btrfs-tools (0.19+20100601-3ubuntu2) natty; urgency=low

  * New patch, ignore all arguments starting with "-" as to be compatible with
    the way mountall and other programs call fsck.btrfs (for instance with
    -a); this helps checking of btrfs filesystems by mountall on boot, but the
    proper fix would be to implement support for these flags; patch by
    Sten Heinze found in Debian #567681; LP: #460246.
  * Re-add fsck.btrfs -> btrfsck symlink; LP: #660649.
 -- Loic Minier <email address hidden> Wed, 30 Mar 2011 16:32:20 +0200

Changed in btrfs-tools (Ubuntu):
status: In Progress → Fix Released
Changed in btrfs-tools (Debian):
status: Confirmed → Fix Released
Revision history for this message
chemicalfan (mike-lumsden) wrote :

Does this bug apply to any of the currently supported Mint releases (i.e. Maya, Petra or Qiana)? If not, this bug should be closed.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.