Skip to content

Unable to insert kernel modules while running kernel in a separate chroot #141

@comeillfoo

Description

@comeillfoo

I've encountered a broken symbolic link for /lib/modules/$kver if the --root points to a rootfs directory that is not the parent of the directory where the kernel sources are located.
E.g. kernel sources at directory linux and rootfs is sibling directory to sources:

.
|-- linux
`-- rootfs

So, when running vng --root ../rootfs being at linux I have modules at linux/.virtme_mods/lib/modules/0.0.0 and virtme_link_mods will be set to /../linux/.virtme_mods/lib/modules/0.0.0 because of os.path.relpath(kernel.moddir, args.root) (virtme/commands/run.py#L991).

Hence, virtme-init tries to symlink /lib/modules/$kver outside of the provided rootfs.

As a workaround I add a disk image (using --disk) with the missing directory, mount it to /tmp and manually relink /lib/modules/$kver to /tmp/my_disk/.virtme_mods/lib/modules/0.0.0. But are there other solutions besides this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions