[Bug 1569576] [NEW] mkfs.vfat exits zero on fatal warning

Ryan Harper 1569576 at bugs.launchpad.net
Tue Apr 12 21:20:55 UTC 2016


Public bug reported:

1. $ lsb_release -rd
Description:	Ubuntu Xenial Xerus (development branch)
Release:	16.04

2. $ apt-cache policy dosfstools
dosfstools:
  Installed: 3.0.28-2
  Candidate: 3.0.28-2
  Version table:
 *** 3.0.28-2 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        100 /var/lib/dpkg/status

3. mkfs.vfat should exit with non-zero value if it cannot create enough
clusters on the target device.  This is fatal to compliant FAT
filesystem parsers since cluster count is the *only* way to determine
the FAT type (12, 16, 32).

$ sudo mkfs.vfat -S 4096 -F 32 /dev/vda1; echo  ?
sudo: unable to resolve host ubuntu
mkfs.fat 3.0.28 (2015-05-16)
WARNING: Not enough clusters for a 32 bit FAT!
1

4. $ sudo mkfs.vfat -S 4096 -F 32 /dev/vda1; echo $?
sudo: unable to resolve host ubuntu
mkfs.fat 3.0.28 (2015-05-16)
WARNING: Not enough clusters for a 32 bit FAT!
0

Tools calling mkfs.vfat expect the tool to return non-zero values when it encounters and error.
Making a FAT32 filesystem on a device that is not big enough means that FAT parsers will fail to
recognize the device.  In particular, UEFI expects a FAT32 partition and will fail to read the boot partition
if it's not formatted properly (ie, not big enough for 65526 clusters[A]).

mkfs.vfat defaults to 8 sectors per cluster, for 4k disks, we set sector size to 4k, which means
for -F 32, we have 65526 clusters * 8 * 4096 wihich is just under 2G, meaning to avoid the warning/error
-F 32 requires either a lower sectors per cluster, or a larger target device.


1. https://staff.washington.edu/dittrich/misc/fatgen103.pdf [Page 15]

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: dosfstools 3.0.28-2
ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
Uname: Linux 4.4.0-18-generic x86_64
ApportVersion: 2.20.1-0ubuntu1
Architecture: amd64
Date: Tue Apr 12 20:10:06 2016
Dependencies:
 gcc-6-base 6-20160405-0ubuntu2
 libc6 2.23-0ubuntu2
 libgcc1 1:6-20160405-0ubuntu2
ProcEnviron:
 TERM=xterm
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: dosfstools
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: dosfstools (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug uec-images xenial

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to dosfstools in Ubuntu.
https://bugs.launchpad.net/bugs/1569576

Title:
  mkfs.vfat exits zero on fatal warning

Status in dosfstools package in Ubuntu:
  New

Bug description:
  1. $ lsb_release -rd
  Description:	Ubuntu Xenial Xerus (development branch)
  Release:	16.04

  2. $ apt-cache policy dosfstools
  dosfstools:
    Installed: 3.0.28-2
    Candidate: 3.0.28-2
    Version table:
   *** 3.0.28-2 500
          500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
          100 /var/lib/dpkg/status

  3. mkfs.vfat should exit with non-zero value if it cannot create
  enough clusters on the target device.  This is fatal to compliant FAT
  filesystem parsers since cluster count is the *only* way to determine
  the FAT type (12, 16, 32).

  $ sudo mkfs.vfat -S 4096 -F 32 /dev/vda1; echo  ?
  sudo: unable to resolve host ubuntu
  mkfs.fat 3.0.28 (2015-05-16)
  WARNING: Not enough clusters for a 32 bit FAT!
  1

  4. $ sudo mkfs.vfat -S 4096 -F 32 /dev/vda1; echo $?
  sudo: unable to resolve host ubuntu
  mkfs.fat 3.0.28 (2015-05-16)
  WARNING: Not enough clusters for a 32 bit FAT!
  0

  Tools calling mkfs.vfat expect the tool to return non-zero values when it encounters and error.
  Making a FAT32 filesystem on a device that is not big enough means that FAT parsers will fail to
  recognize the device.  In particular, UEFI expects a FAT32 partition and will fail to read the boot partition
  if it's not formatted properly (ie, not big enough for 65526 clusters[A]).

  mkfs.vfat defaults to 8 sectors per cluster, for 4k disks, we set sector size to 4k, which means
  for -F 32, we have 65526 clusters * 8 * 4096 wihich is just under 2G, meaning to avoid the warning/error
  -F 32 requires either a lower sectors per cluster, or a larger target device.


  
  1. https://staff.washington.edu/dittrich/misc/fatgen103.pdf [Page 15]

  ProblemType: Bug
  DistroRelease: Ubuntu 16.04
  Package: dosfstools 3.0.28-2
  ProcVersionSignature: User Name 4.4.0-18.34-generic 4.4.6
  Uname: Linux 4.4.0-18-generic x86_64
  ApportVersion: 2.20.1-0ubuntu1
  Architecture: amd64
  Date: Tue Apr 12 20:10:06 2016
  Dependencies:
   gcc-6-base 6-20160405-0ubuntu2
   libc6 2.23-0ubuntu2
   libgcc1 1:6-20160405-0ubuntu2
  ProcEnviron:
   TERM=xterm
   PATH=(custom, no user)
   XDG_RUNTIME_DIR=<set>
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  SourcePackage: dosfstools
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/dosfstools/+bug/1569576/+subscriptions



More information about the foundations-bugs mailing list