Coder Social home page Coder Social logo

Comments (3)

karelzak avatar karelzak commented on July 18, 2024 1

Maybe losetup should be more competent when testing if the device is used.

Now (in your case) it checks for "offset" (sysfs file loop/offset, the file is missing so it assumes the device is unused). Maybe when it scans for the devices in sysfs it should also check for the device lost and ignore such devices.

from util-linux.

karelzak avatar karelzak commented on July 18, 2024

The file /dev/loop-control is optional, and if it's not available, then it scans for /dev/loopN files. It seems that it was able to get /dev/loop0, but later it disappeared, so it's reported as lost.

LOOPDEV_DEBUG=all losetup --find may provide more details.

Not sure why do you see the problem (maybe more tests running in parallel, udevadm settle is good friend).
I'm not able to reproduce it:

# systemd-nspawn -D / --volatile=yes bash
Spawning container vm-10-0-187-68.hosted.upshift.rdu2.redhat.com on /.
Press Ctrl-] three times within 1s to kill container.

bash-5.2#  losetup --find
/dev/loop0
bash-5.2# losetup -V
losetup from util-linux 2.40-rc1

from util-linux.

mrc0mmand avatar mrc0mmand commented on July 18, 2024

Ah, interesting, thank you. I think the reason here why this happens is that I have (or had) /dev/loop0 used on the host machine, so it's then reported as lost in the container, since it's not there (but it's still present in /sys).

[root@localhost ~]# losetup --find
/dev/loop0
[root@localhost ~]# systemd-nspawn -D / --volatile=yes --bind $PWD:/build bash
Spawning container localhost.localdomain on /.
Press Ctrl-] three times within 1s to kill container.
bash-5.2# LOOPDEV_DEBUG=all losetup --find
2: loopdev:      CXT: [0x7ffc49e1e7d0]: initialize context
2: loopdev:      CXT: [0x7ffc49e1e7d0]: init: ignore ioctls
2: loopdev:      CXT: [0x7ffc49e1e7d0]: find_unused requested
2: loopdev:      CXT: [0x7ffc49e1e7d0]: using loop scan
2: loopdev:     ITER: [0x7ffc49e1e9b8]: initialize
2: loopdev:     ITER: [0x7ffc49e1e9b8]: next
2: loopdev:     ITER: [0x7ffc49e1e9b8]: next: default check
2: loopdev:      CXT: [0x7ffc49e1e7d0]: loop0 name assigned
2: loopdev:      CXT: [0x7ffc49e1e7d0]: get_offset [rc=-22]
2: loopdev:     ITER: [0x7ffc49e1e9b8]: de-initialize
2: loopdev:      CXT: [0x7ffc49e1e7d0]: find_unused by scan [rc=0]
/dev/loop0 (lost)
2: loopdev:      CXT: [0x7ffc49e1e7d0]: de-initialize
2: loopdev:     ITER: [0x7ffc49e1e9b8]: de-initialize
# ls /sys/block/
loop0  vda  zram0

So I guess the test needs to be updated on our side, to not use losetup --find to check if loop devices are available.

from util-linux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.