Bug 1159430 - /dev/loop-control does not exist, losetup fails
Summary: /dev/loop-control does not exist, losetup fails
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: systemd
Version: 21
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: systemd-maint
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-01 01:01 UTC by rvcsaba
Modified: 2015-02-04 20:14 UTC (History)
13 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2015-02-04 20:14:21 UTC


Attachments (Terms of Use)
Latest changed packages (34.76 KB, text/plain)
2014-12-01 00:19 UTC, rvcsaba
no flags Details

Description rvcsaba 2014-11-01 01:01:26 UTC
Description of problem:

I mount ext4 on sdb:

mount -o loop,rw,noatime,nodiratime,offset=$[1536*1048576] /dev/sdb /mnt/pen

mount: /mnt/pen: mount failed: Unknown error -1

Workaround:

modprobe loop
mount -o loop,rw,noatime,nodiratime,offset=$[1536*1048576] /dev/sdb /mnt/pen
mount | grep sdb

/dev/sdb on /mnt/pen type ext4 (rw,noatime,nodiratime,seclabel,data=ordered)


Version-Release number of selected component (if applicable):

rpm -q systemd; uname -r

systemd-216-5.fc21.x86_64
3.17.2-300.fc21.x86_64


Actual results:

loop module not loaded

Expected results:

Loading loop kernel module.

Comment 1 rvcsaba 2014-11-01 14:37:21 UTC
This is other subsystem bug? Kernel, kmod, udev?

Comment 2 Zbigniew Jędrzejewski-Szmek 2014-11-01 15:01:36 UTC
Yeah, that should work. I just tried something similar (on F20, and with a file not a device, so not identical), and it works as expected. You could try running the command with LIBMOUNT_DEBUG=0xffff and see if anything interesting pops up.

Anyway, systemd is not involved here, reassigning.

Comment 3 Karel Zak 2014-11-04 12:18:38 UTC
It would be nice to know util-linux version
 
 # mount --version

We did some changes to userspace loop dev code in version v2.25 (now in f21 testing).

Anyway, losetup/mount never directly loads any kernel module. The currently used method is to open /dev/loop-control by lopsetup/mount and ask for new loop device, the rest is udevd and kernel business.

Example (f20, util-linux 2.24.2):

# rmmod loop
rmmod: ERROR: Module loop is not currently loaded

# LOOPDEV_DEBUG=yes losetup -f --show /home/fs-images 2g.img                                                             
loopdev:  [0x7fffa5058810]: init: ignore ioctls
loopdev:  [0x7fffa5058810]: init: loop-control detected 
loopdev:  [0x7fffa5058810]: find_unused requested
loopdev:  [0x7fffa5058810]: loop0 successfully assigned
loopdev:  [0x7fffa5058810]: find_unused by loop-control [rc=0]
loopdev:  [0x7fffa5058810]: set backing file=/home/fs-images/2g.img
loopdev:  [0x7fffa5058810]: device setup requested
loopdev:  [0x7fffa5058810]: setup: backing file open: OK
loopdev:  [0x7fffa5058810]: open /dev/loop0 [rw]: Success
loopdev:  [0x7fffa5058810]: setup: device open: OK
loopdev:  [0x7fffa5058810]: setup: LOOP_SET_FD: OK
loopdev:  [0x7fffa5058810]: setup: LOOP_SET_STATUS64: OK
loopdev:  [0x7fffa5058810]: setup success [rc=0]
/dev/loop0
loopdev:  [0x7fffa5058810]: de-initialize
loopdev:  [0x7fffa5058810]: closing old open fd
loopdev:  [0x7fffa5058810]: iter: de-initialize


in the same time another terminal:

# udevadm monitor 
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

KERNEL[2522353.220810] add      /module/loop (module)
KERNEL[2522353.221024] add      /devices/virtual/misc/loop-control (misc)
KERNEL[2522353.221447] add      /devices/virtual/bdi/7:0 (bdi)
UDEV  [2522353.221465] add      /module/loop (module)
KERNEL[2522353.221882] add      /devices/virtual/block/loop0 (block)
UDEV  [2522353.221899] add      /devices/virtual/misc/loop-control (misc)
KERNEL[2522353.221913] change   /devices/virtual/block/loop0 (block)
UDEV  [2522353.222030] add      /devices/virtual/bdi/7:0 (bdi)
UDEV  [2522353.223782] add      /devices/virtual/block/loop0 (block)
UDEV  [2522353.225647] change   /devices/virtual/block/loop0 (block)


Please, try to debug the issue.

Comment 4 rvcsaba 2014-11-04 22:46:46 UTC
modprobe -r loop

mount --version
mount from util-linux 2.25.2 (libmount 2.25.0: selinux, assert, debug)

LOOPDEV_DEBUG=yes losetup -o $[1536*1048576] --show -f /dev/sdb
loopdev:  [0x7fff80386070]: init: ignore ioctls
loopdev:  [0x7fff80386070]: find_unused requested
loopdev:  [0x7fff80386070]: iter: initialize
loopdev:  [0x7fff80386070]: iter: next
loopdev:  [0x7fff80386070]: iter: next: default check
loopdev:  [0x7fff80386070]: loop0 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop0 does not exist
loopdev:  [0x7fff80386070]: loop1 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop1 does not exist
loopdev:  [0x7fff80386070]: loop2 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop2 does not exist
loopdev:  [0x7fff80386070]: loop3 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop3 does not exist
loopdev:  [0x7fff80386070]: loop4 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop4 does not exist
loopdev:  [0x7fff80386070]: loop5 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop5 does not exist
loopdev:  [0x7fff80386070]: loop6 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop6 does not exist
loopdev:  [0x7fff80386070]: loop7 name assigned
loopdev:  [0x7fff80386070]: iter: /dev/loop7 does not exist
loopdev:  [0x7fff80386070]: iter: next: scan /dev
loopdev:  [0x7fff80386070]: iter: de-initialize
loopdev:  [0x7fff80386070]: iter: de-initialize
loopdev:  [0x7fff80386070]: find_unused by scan [rc=1]
losetup: cannot find an unused loop device
loopdev:  [0x7fff80386070]: de-initialize
loopdev:  [0x7fff80386070]: iter: de-initialize

;----------------------------------

Same time:

udevadm monitor
monitor will print the received events for:
UDEV - the event which udev sends out after rule processing
KERNEL - the kernel uevent

;----------------------------------

rpm -q kernel systemd util-linux
kernel-3.17.2-300.fc21.x86_64
systemd-216-10.fc21.x86_64
util-linux-2.25.2-1.fc21.x86_64

Comment 5 Richard W.M. Jones 2014-11-19 17:23:54 UTC
Happens for me with:

util-linux-2.25.2-1.fc21.x86_64
kernel-3.17.2-300.fc21.x86_64
systemd-216-11.fc21.x86_64

Comment 6 Richard W.M. Jones 2014-11-19 17:31:42 UTC
The debug info:

LOOPDEV_DEBUG=yes mount -o loop /sysroot/LiveOS/squashfs.img /tmp
loopdev:  [0x7fff4d56ddc0]: init: ignore ioctls
loopdev:  [0x7fff4d56ddc0]: find_unused requested
loopdev:  [0x7fff4d56ddc0]: iter: initialize
loopdev:  [0x7fff4d56ddc0]: iter: next
loopdev:  [0x7fff4d56ddc0]: iter: next: default check
loopdev:  [0x7fff4d56ddc0]: loop0 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop0 does not exist
loopdev:  [0x7fff4d56ddc0]: loop1 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop1 does not exist
loopdev:  [0x7fff4d56ddc0]: loop2 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop2 does not exist
loopdev:  [0x7fff4d56ddc0]: loop3 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop3 does not exist
loopdev:  [0x7fff4d56ddc0]: loop4 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop4 does not exist
loopdev:  [0x7fff4d56ddc0]: loop5 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop5 does not exist
loopdev:  [0x7fff4d56ddc0]: loop6 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop6 does not exist
loopdev:  [0x7fff4d56ddc0]: loop7 name assigned
loopdev:  [0x7fff4d56ddc0]: iter: /dev/loop7 does not exist
loopdev:  [0x7fff4d56ddc0]: iter: next: scan /dev
loopdev:  [0x7fff4d56ddc0]: iter: de-initialize
loopdev:  [0x7fff4d56ddc0]: iter: de-initialize
loopdev:  [0x7fff4d56ddc0]: find_unused by scan [rc=1]
loopdev:  [0x7fff4d56ddc0]: de-initialize
loopdev:  [0x7fff4d56ddc0]: iter: de-initialize
mount: /tmp: mount failed: Unknown error -1


/dev/loop-control does not exist.

Comment 7 Karel Zak 2014-11-20 12:49:29 UTC
We need /dev/loop-control node or loaded loop kernel module after reboot. All the problem seems like regression in way how modules or /dev/loop-control are initialized by udev.

I don't think losetup or mount is able to fix this problem. Reassigning to systemd/udev.

Comment 8 Richard W.M. Jones 2014-11-20 12:52:49 UTC
What is it that's supposed to create /dev/loop-control?

Comment 9 Richard W.M. Jones 2014-11-20 12:55:46 UTC
OK I'm guessing it's either 'kmod static-nodes' or 'systemd-tmpfiles'.

/dev/loop-control is not listed in any of the tmpfiles control
files, but it is listed in a udev control file:

$ grep loop-control /usr/lib/udev/rules.d/50-udev-default.rules
KERNEL=="loop-control", GROUP="disk", OPTIONS+="static_node=loop-control"

Comment 10 Richard W.M. Jones 2014-11-20 13:07:32 UTC
So in fact the dependent bug is *not* the same as this one.
I've fixed my bug.  I can't speak for the original reporter however.

Comment 11 rvcsaba 2014-11-20 22:03:48 UTC
(In reply to Richard W.M. Jones from comment #10)

> I can't speak for the original reporter however.

Why can't speak?

Comment 12 Zbigniew Jędrzejewski-Szmek 2014-11-24 02:22:50 UTC
Things should work with up-to-date systemd and kmod.
systemd-216-11.fc21.x86_64 (>= 216-9 should be fine)
kmod-19-1.fc21.x86_64   (>= 18-4 is fine)

Does anyone see this bug with updated systemd and kmod?

Comment 13 rvcsaba 2014-11-25 10:02:50 UTC
rpm -q systemd kmod util-linux
systemd-216-11.fc21.x86_64
kmod-19-1.fc21.x86_64
util-linux-2.25.2-1.fc21.x86_64

uname -r
3.17.4-300.fc21.x86_64

modprobe -r loop; lsmod | grep loop; echo $?
1

mount -o loop,rw,noatime,nodiratime,offset=$[1536*1048576] /dev/sdb /mnt/pen
mount: /mnt/pen: mount failed: Unknown error -1

mount | grep /mnt/pen; echo $?
1

modprobe loop

mount -o loop,rw,noatime,nodiratime,offset=$[1536*1048576] /dev/sdb /mnt/pen

mount | grep /mnt/pen
/dev/sdb on /mnt/pen type ext4 (rw,noatime,nodiratime,seclabel,data=ordered)

This bug is exist latest kernel, kmod, systemd and util-linux.

Comment 14 rvcsaba 2014-11-25 10:07:58 UTC
Workaround, statically load loop module:

echo loop >>/etc/modules-load.d/usr.conf

Comment 15 Tom Gundersen 2014-11-30 13:49:01 UTC
rvcsaba: could you attach /run/modules-load.d/kmod.conf and /usr/lib/modules/`uname -r`/modules.devname ? And also attach the output of 'systemctl status systemd-tmpfiles-setup-dev.service'?

Comment 16 rvcsaba 2014-12-01 00:19:24 UTC
Created attachment 963055 [details]
Latest changed packages

Hm... I tested, work it now, if I don't remove module. I edited my /etc/modules-load.d/usr.conf file, commented out relevant line:

# loop

Rebooted my computer, but loop module loaded automatically. Why?

lsmod | grep loop
loop                   28197  0

I removed module:

modprobe -r loop

Tested it:

lsmod | grep loop; echo $?
1

Tested originally problem:

mount -o loop,rw,noatime,nodiratime,offset=$[1536*1048576] /dev/sdb /mnt/pen
mount: /mnt/pen: mount failed: Unknown error -1

systemctl status systemd-tmpfiles-setup-dev.service
● systemd-tmpfiles-setup-dev.service - Create Static Device Nodes in /dev
   Loaded: loaded (/usr/lib/systemd/system/systemd-tmpfiles-setup-dev.service; static)
   Active: active (exited) since Mon 2014-12-01 00:19:56 CET; 14min ago
     Docs: man:tmpfiles.d(5)
           man:systemd-tmpfiles(8)
  Process: 522 ExecStart=/usr/bin/systemd-tmpfiles --prefix=/dev --create --boot (code=exited, status=0/SUCCESS)
 Main PID: 522 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/systemd-tmpfiles-setup-dev.service

cat /usr/lib/modules/`uname -r`/modules.devname
# Device nodes to trigger on-demand module loading.
fuse fuse c10:229
btrfs btrfs-control c10:234
loop loop-control c10:237
tun net/tun c10:200
ppp_generic ppp c108:0
uinput uinput c10:223
uhid uhid c10:239
vfio vfio/vfio c10:196
hci_vhci vhci c10:137
vhost_net vhost-net c10:238
snd_timer snd/timer c116:33
snd_seq snd/seq c116:1

cat /run/modules-load.d/kmod.conf
cat: /run/modules-load.d/kmod.conf: No such file or directory

cd /run/modules-load.d
-bash: cd: /run/modules-load.d: No such file or directory

ls -1d /run/m*
/run/mdadm
/run/mount

Missing /run/modules-load.d directory (and kmod.conf file). If I lodad loop module, /dev/loop-control created:

ls -1d /dev/loop*
ls: cannot access /dev/loop*: No such file or directory

modprobe loop

ls -1d /dev/loop*
/dev/loop-control

modprobe -r loop

ls -1d /dev/loop*
ls: cannot access /dev/loop*: No such file or directory

Originally problem: loop module not loaded automatically. If I load manually, device file created automatically, and mount work. Since latest update(?) loop module loaded statically, and working my computer. Is this a workaround, or problem solved?

Versions:

uname -r; rpm -q util-linux selinux-policy kmod systemd
3.17.4-301.fc21.x86_64
util-linux-2.25.2-2.fc21.x86_64
selinux-policy-3.13.1-100.fc21.noarch
kmod-19-1.fc21.x86_64
systemd-216-12.fc21.x86_64

Latest changed packages in attachment.

seq 2000 2013 | xargs -n1 yum history info >yumhist.txt

Comment 17 rvcsaba 2014-12-07 11:46:19 UTC
This problem solved, thanks!

Versions:

kernel-3.17.4-302.fc21.x86_64
kmod-19-1.fc21.x86_64
selinux-policy-3.13.1-101.fc21.noarch
systemd-216-12.fc21.x86_64
util-linux-2.25.2-2.fc21.x86_64

Comment 18 Lennart Poettering 2015-02-04 20:14:21 UTC
OK, if this is fixed now we can close the bug.


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