[Bug 1474473] Re: mkfs with -t option on btrfs fails on wily

Steve Langasek steve.langasek at canonical.com
Tue Jul 21 21:30:33 UTC 2015


** Project changed: util-linux-ng => util-linux (Ubuntu)

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

Title:
  mkfs with -t option on btrfs fails on wily

Status in util-linux package in Ubuntu:
  New

Bug description:
  How to reproduce:

  As root:

  # dd if=/dev/zero of=test.img bs=1M count=1024
  # mkfs -t btrfs -f test.img
  mkfs: failed to execute mkfs.btrfs: No such file or directory

  Does it exist?

  # which mkfs.btrfs
  /bin/mkfs.btrfs

  Yes!

  stracing mkfs shows why it fails:

  # strace -f mkfs -t btrfs -f test.img
  execve("/sbin/mkfs", ["mkfs", "-t", "btrfs", "-f", "test.img"], [/* 41 vars */]) = 0
  brk(0)                                  = 0xba3000
  access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
  mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8b0e914000
  access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
  open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
  fstat(3, {st_mode=S_IFREG|0644, st_size=155913, ...}) = 0
  mmap(NULL, 155913, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b0e8ed000
  close(3)                                = 0
  access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or directory)
  open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
  read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\v\2\0\0\0\0\0"..., 832) = 832
  fstat(3, {st_mode=S_IFREG|0755, st_size=1869392, ...}) = 0
  mmap(NULL, 3972864, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f8b0e329000
  mprotect(0x7f8b0e4e9000, 2097152, PROT_NONE) = 0
  mmap(0x7f8b0e6e9000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x7f8b0e6e9000
  mmap(0x7f8b0e6ef000, 16128, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f8b0e6ef000
  close(3)                                = 0
  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8b0e8ec000
  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8b0e8eb000
  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f8b0e8ea000
  arch_prctl(ARCH_SET_FS, 0x7f8b0e8eb700) = 0
  mprotect(0x7f8b0e6e9000, 16384, PROT_READ) = 0
  mprotect(0x601000, 4096, PROT_READ)     = 0
  mprotect(0x7f8b0e916000, 4096, PROT_READ) = 0
  munmap(0x7f8b0e8ed000, 155913)          = 0
  brk(0)                                  = 0xba3000
  brk(0xbc4000)                           = 0xbc4000
  open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3
  fstat(3, {st_mode=S_IFREG|0644, st_size=2919792, ...}) = 0
  mmap(NULL, 2919792, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b0e060000
  close(3)                                = 0
  execve("/sbin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/sbin/fs.d/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/sbin/fs/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/home/king/android/android-ndk-r10e/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/home/king/bin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/home/king/coverity/cov-analysis-linux64-7.6.0/bin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/usr/local/sbin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/usr/local/bin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/usr/sbin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/usr/bin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/sbin/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)
  execve("/bin\n/mkfs.btrfs", ["mkfs.btrfs", "-f", "test.img"], [/* 41 vars */]) = -1 ENOENT (No such file or directory)

  
  What? the path is /bin\n/mkfs.btrfs?  That is clearly why it is wrong.   Hypothesis is that it is picking up the "\n" from the end of the $PATH env string.  Add a dummy path at the end and it works!

  PATH=$PATH:/bin/dummy
  root at lenovo:~# mkfs -t btrfs -f test.img
  btrfs-progs v4.0
  See http://btrfs.wiki.kernel.org for more information.

  Turning ON incompat feature 'extref': increased hardlink limit per file to 65536
  Turning ON incompat feature 'skinny-metadata': reduced-size metadata extent refs
  ERROR: device scan failed 'test.img' - Block device required
  fs created label (null) on test.img
  	nodesize 16384 leafsize 16384 sectorsize 4096 size 1.00GiB

  Can this be fixed as it's screwing up a lot of regression tests we're
  doing with btrfs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1474473/+subscriptions



More information about the foundations-bugs mailing list