Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
The command
losetup /dev/loop1 -f /tmp/tfile_loop1
does not make sense. The option -f is mutually exclusive to <device>. You cannot force losetup to use loop1 and in the same time ask to use the first free device (-f).
The right way is:
losetup /dev/loop1 /tmp/tfile_loop1
or
losetup -f /tmp/tfile
Yes, losetup should be more smart when it checks command line options. The current behaviour when it tries to blindly use <device> as well as -f is stupid.
This issue is improved by upstream commit c3f5a0f1d47dbc47f6d21da232d4eb1cfb7905db.
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHBA-2018:3178
Description of problem: losetup: /dev/loop1: failed to set up loop device: No such device or address Version-Release number of selected component (if applicable): util-linux-2.23.2-52.el7.x86_64 How reproducible: not sure Steps to Reproduce: 1. generate a local file with dd # dd if=/dev/zero of=/tmp/tfile_loop1 bs=1M count=1000 2. associate loop1 device to local file losetup /dev/loop1 -f /tmp/tfile_loop1 Actual results: # losetup -a /dev/loop0: [64768]:1001699 (/tmp/tfile_loop0) # lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 1 465.8G 0 disk ├─sda1 8:1 1 1G 0 part /boot └─sda2 8:2 1 464.8G 0 part ├─rhel_storageqe--52-root 253:0 0 50G 0 lvm / ├─rhel_storageqe--52-swap 253:1 0 3.9G 0 lvm [SWAP] └─rhel_storageqe--52-home 253:2 0 410.9G 0 lvm /home sr0 11:0 1 1024M 0 rom loop0 7:0 0 1000M 0 loop └─luks-d34a76ac-538b-4e10-814f-9682613935b8 253:3 0 998M 0 crypt # losetup /dev/loop1 -f /tmp/tfile_loop1 losetup: /dev/loop1: failed to set up loop device: No such file or directory # losetup --find /dev/loop1 # strace losetup /dev/loop1 -f /tmp/tfile_loop1 execve("/usr/sbin/losetup", ["losetup", "/dev/loop1", "-f", "/tmp/tfile_loop1"], [/* 39 vars */]) = 0 brk(NULL) = 0x1375000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f97bec4a000 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=44171, ...}) = 0 mmap(NULL, 44171, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f97bec3f000 close(3) = 0 open("/lib64/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\340$\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=2151832, ...}) = 0 mmap(NULL, 3981792, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f97be65d000 mprotect(0x7f97be820000, 2093056, PROT_NONE) = 0 mmap(0x7f97bea1f000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c2000) = 0x7f97bea1f000 mmap(0x7f97bea25000, 16864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f97bea25000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f97bec3e000 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f97bec3c000 arch_prctl(ARCH_SET_FS, 0x7f97bec3c740) = 0 mprotect(0x7f97bea1f000, 16384, PROT_READ) = 0 mprotect(0x611000, 4096, PROT_READ) = 0 mprotect(0x7f97bec4b000, 4096, PROT_READ) = 0 munmap(0x7f97bec3f000, 44171) = 0 brk(NULL) = 0x1375000 brk(0x1396000) = 0x1396000 brk(NULL) = 0x1396000 open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=106070960, ...}) = 0 mmap(NULL, 106070960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f97b8134000 close(3) = 0 stat("/sys/block", {st_mode=S_IFDIR|0755, st_size=0, ...}) = 0 uname({sysname="Linux", nodename="storageqe-52.rhts.eng.pek2.redhat.com", ...}) = 0 stat("/dev/loop-control", {st_mode=S_IFCHR|0660, st_rdev=makedev(10, 237), ...}) = 0 open("/dev/loop-control", O_RDWR|O_CLOEXEC) = 3 ioctl(3, LOOP_CTL_GET_FREE) = 1 close(3) = 0 readlink("/dev", 0x7ffce763d7d0, 4096) = -1 EINVAL (Invalid argument) readlink("/dev/loop1", 0x7ffce763d7d0, 4096) = -1 EINVAL (Invalid argument) open("/dev/loop1", O_RDWR|O_CLOEXEC) = 3 open("/dev/loop1", O_RDWR|O_CLOEXEC) = 4 ioctl(4, LOOP_SET_FD, 3) = -1 EBUSY (Device or resource busy) close(3) = 0 ioctl(4, LOOP_CLR_FD) = -1 ENXIO (No such device or address) open("/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=2502, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f97bec49000 read(3, "# Locale name alias data base.\n#"..., 4096) = 2502 read(3, "", 4096) = 0 close(3) = 0 munmap(0x7f97bec49000, 4096) = 0 open("/usr/share/locale/en_US.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_US/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en.utf8/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/util-linux.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "losetup: ", 9losetup: ) = 9 write(2, "/dev/loop1: failed to set up loo"..., 40/dev/loop1: failed to set up loop device) = 40 write(2, ": ", 2: ) = 2 open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "No such device or address\n", 26No such device or address ) = 26 close(4) = 0 close(1) = 0 close(2) = 0 exit_group(1) = ? +++ exited with 1 +++ Expected results: no error Additional info: