Skip to content
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

Requires -v /dev:/dev for reliable loopback #352

Closed
cgwalters opened this issue Feb 15, 2024 · 3 comments · Fixed by #431
Closed

Requires -v /dev:/dev for reliable loopback #352

cgwalters opened this issue Feb 15, 2024 · 3 comments · Fixed by #431
Assignees
Labels
area/install Issues related to `bootc install`

Comments

@cgwalters
Copy link
Collaborator

Sometimes I see:

DEBUG exec: "losetup" "--show" "-P" "--find" "/output/bootc.raw"
losetup: /output/bootc.raw: failed to set up loop device: No such file or directory

I think we may need to wait on udev on the host.

@cgwalters
Copy link
Collaborator Author

This isn't a race at all, it's simply that by default that docker from the very start has created a static snapshot of /dev as a tmpfs and this behavior was copied into podman. So the first time we run, we won't see the loop device we created. But when it's created, the next run we will. There's a bunch of issues around this and generally it's suggested to just -v /dev:/dev. I'm tempted to do that...but it's yet another thing in our install invocations...so it'd be nicer to do a dynamic remount.

@mvo5
Copy link
Contributor

mvo5 commented Feb 28, 2024

Indeed, we ran into a similar issue in bib - we did osbuild/osbuild#1468 to fix it, i.e. if we know what loop device we need and it's not available in the container we just create the device node.

@cgwalters cgwalters changed the title occasional race with losetup Requires -v /dev:/dev for reliable loopback Feb 28, 2024
bcrochet added a commit to bcrochet/bootc that referenced this issue Mar 26, 2024
Not a race condition, but more of a timing issue. Just needed to make
sure the /dev mount was happening before any of the losetup calls.

Fixes containers#352

Signed-off-by: Brad P. Crochet <brad@redhat.com>

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
bcrochet added a commit to bcrochet/bootc that referenced this issue Mar 26, 2024
Not a race condition, but more of a timing issue. Just needed to make
sure the /dev mount was happening before any of the losetup calls.

Fixes containers#352

Signed-off-by: Brad P. Crochet <brad@redhat.com>

rh-pre-commit.version: 2.2.0
rh-pre-commit.check-secrets: ENABLED
bcrochet added a commit to bcrochet/bootc that referenced this issue Apr 2, 2024
At container start, /dev is snapshotted, so any new device files
don't get added unless /dev is bindmounted in. For now, check that
/dev is the same as the host's /dev via fsid. If they differ, it
means that /dev is not bindmounted.

Fixes containers#352

Signed-off-by: Brad P. Crochet <brad@redhat.com>
bcrochet added a commit to bcrochet/bootc that referenced this issue Apr 2, 2024
At container start, /dev is snapshotted, so any new device files
don't get added unless /dev is bindmounted in. For now, check that
/dev is the same as the host's /dev via fsid. If they differ, it
means that /dev is not bindmounted.

Fixes containers#352

Signed-off-by: Brad P. Crochet <brad@redhat.com>
bcrochet added a commit to bcrochet/bootc that referenced this issue Apr 2, 2024
At container start, /dev is snapshotted, so any new device files
don't get added unless /dev is bindmounted in. For now, check that
/dev is the same as the host's /dev via fsid. If they differ, it
means that /dev is not bindmounted.

Fixes containers#352

Signed-off-by: Brad P. Crochet <brad@redhat.com>
@bcrochet bcrochet self-assigned this Apr 2, 2024
@ericcurtin
Copy link
Contributor

ericcurtin commented Apr 6, 2024

Something may have changed recently that this is now required.

Have been building images using a similar technique with loopback mounts, all of a sudden -v /dev:dev is needed (it wasn't last week for me 🤷 ):

https://gitlab.com/CentOS/automotive/sample-images/-/merge_requests/481

Note ublue hit something similar recently also:

ublue-os/isogenerator#22

The lorax pointed out showed a possible alternate technique that could be use in containers also, the osbuild scripts could do something like this maybe:

if (we_are_a_container)
{
  mknod
  losetup
}

https://github.com/rhinstaller/anaconda/blob/master/dockerfile/anaconda-iso-creator/lorax-build#L27

but maybe this is bikeshed since -v /dev:/dev works

cgwalters added a commit to containers/podman-bootc that referenced this issue Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/install Issues related to `bootc install`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants