Skip to content

losetup /dev/loopdev /dev/diskdevice -b 4096 -P still not working #1784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
h8ohmh opened this issue Aug 29, 2022 · 5 comments
Open

losetup /dev/loopdev /dev/diskdevice -b 4096 -P still not working #1784

h8ohmh opened this issue Aug 29, 2022 · 5 comments
Labels
NEEDINFO Need more information from reporter

Comments

@h8ohmh
Copy link

h8ohmh commented Aug 29, 2022

Cloned newest branch on
Linux 4.4.218.alpine.1 #1 SMP Sun Nov 7 15:26:42 UTC 2021 armv7l GNU/Linux, 2GB RAM
and compiled it, but still not working:

losetup /dev/loopdev /dev/diskdevice -b 4096 -P

example:
losetup /dev/loop5 /dev/sdc -b 4096 -P

losetup: /dev/sdb: failed to set up loop device: Invalid argument

@karelzak
Copy link
Collaborator

karelzak commented Sep 1, 2022

It works for me (on 5.18.11-200.fc36.x86_64).

Please, copy & past output from LOOPDEV_DEBUG=all losetup /dev/loop5 /dev/sdc -b 4096 -P

@karelzak karelzak added the NEEDINFO Need more information from reporter label Sep 1, 2022
@h8ohmh
Copy link
Author

h8ohmh commented Sep 1, 2022

at first Thanks for answer!!!

Here the output:
root@arm_pc:/home/user# losetup /dev/loop5 /dev/sdd -b 4096 -P
14907: loopdev: CXT: [0xbec437e0]: initialize context
14907: loopdev: CXT: [0xbec437e0]: init: ignore ioctls
14907: loopdev: CXT: [0xbec437e0]: init: loop-control detected
14907: loopdev: CXT: [0xbec437e0]: /dev/loop5 name assigned
14907: loopdev: CXT: [0xbec437e0]: add_device 5
14907: loopdev: CXT: [0xbec437e0]: add_device done [rc=-1]
14907: loopdev: CXT: [0xbec437e0]: set flags=8
14907: loopdev: CXT: [0xbec437e0]: set blocksize=4096
14907: loopdev: CXT: [0xbec437e0]: set backing file=/dev/sdd
14907: loopdev: SETUP: [0xbec437e0]: device setup requested
14907: loopdev: SETUP: [0xbec437e0]: backing file open: OK
14907: loopdev: CXT: [0xbec437e0]: open /dev/loop5 [rw]: Success
14907: loopdev: SETUP: [0xbec437e0]: device open: OK
14907: loopdev: SETUP: [0xbec437e0]: LOOP_SET_FD: OK
14907: loopdev: SETUP: [0xbec437e0]: calling LOOP_SET_BLOCK_SIZE
14907: loopdev: CXT: [0xbec437e0]: LOOP_SET_BLOCK_SIZE failed: Invalid argument
14907: loopdev: SETUP: [0xbec437e0]: failed [rc=-22]
losetup: /dev/sdd: failed to set up loop device: Invalid argument
14907: loopdev: CXT: [0xbec437e0]: de-initialize
14907: loopdev: CXT: [0xbec437e0]: closing old open fd
14907: loopdev: ITER: [0xbec439b8]: de-initialize

@h8ohmh
Copy link
Author

h8ohmh commented Sep 1, 2022

Btw how did you do that with the environment var set and then disassemble the code lines inside of the progam. An internal LDE (Sorry, I am just stuck in ancient development methods : { and in case of the problem: Is there any way to get around e.g.. by blockdev did not work) Thanks in advance

@karelzak
Copy link
Collaborator

karelzak commented Sep 2, 2022

It seems like the old version of util-linux (2.36 or so), right? The latest versions use LOOP_CONFIGURE ioctl to configure all in one step.

Anyway, I'm not sure where the problem is. It seems losetup does it right; maybe the old kernel has not backported all necessary patches to work with loop device blocksize properly. You can also try strace to see more details about the syscalls.

Ad debugging, it's pretty simple, LOOPDEV_DEBUG=all activates debug messages (just printf() calls) in the code.

@h8ohmh
Copy link
Author

h8ohmh commented Sep 2, 2022

Thanks. No, I downloaded the util-linux here last week from this site. As far to mention to the kernel it is a newer one (uname-r) but the kernel is specific for the ARM machine by the vendor. That's bad... Anyway thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NEEDINFO Need more information from reporter
Projects
None yet
Development

No branches or pull requests

2 participants