mkfs with -t option on btrfs fails on wily
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
util-linux (Debian) |
Fix Released
|
Unknown
|
|||
util-linux (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
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(
brk(0) = 0xba3000
access(
mmap(NULL, 8192, PROT_READ|
access(
open("/
fstat(3, {st_mode=
mmap(NULL, 155913, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b0e8ed000
close(3) = 0
access(
open("/
read(3, "\177ELF\
fstat(3, {st_mode=
mmap(NULL, 3972864, PROT_READ|
mprotect(
mmap(0x7f8b0e6e
mmap(0x7f8b0e6e
close(3) = 0
mmap(NULL, 4096, PROT_READ|
mmap(NULL, 4096, PROT_READ|
mmap(NULL, 4096, PROT_READ|
arch_prctl(
mprotect(
mprotect(0x601000, 4096, PROT_READ) = 0
mprotect(
munmap(
brk(0) = 0xba3000
brk(0xbc4000) = 0xbc4000
open("/
fstat(3, {st_mode=
mmap(NULL, 2919792, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f8b0e060000
close(3) = 0
execve(
execve(
execve(
execve(
execve(
execve(
execve(
execve(
execve(
execve(
execve(
execve(
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:
root@lenovo:~# mkfs -t btrfs -f test.img
btrfs-progs v4.0
See http://
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
affects: | fwts → util-linux-ng |
affects: | util-linux-ng → util-linux (Ubuntu) |
Changed in util-linux (Debian): | |
status: | Unknown → New |
Changed in util-linux (Debian): | |
status: | New → Fix Released |
this bug has been present upstream in util-linux for a decade, but has been exposed by btrfs-tools in wily moving mkfs.btrfs from /sbin to /bin.