Skip to content

Commit

Permalink
virtme: use $MODDIR/modules.dep to check the module folder
Browse files Browse the repository at this point in the history
If vng is interrupted during the virtme-prep-kdir-mods command,
the next time we run vng we'll get the following error report:

    Traceback (most recent call last):
      File "/usr/bin/virtme-run", line 33, in <module>
	sys.exit(load_entry_point('virtme-ng==1.19', 'console_scripts', 'virtme-run')())
		 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/virtme/commands/run.py", line 1314, in main
	return do_it()
	       ^^^^^^^
      File "/usr/lib/python3/dist-packages/virtme/commands/run.py", line 783, in do_it
	kernel = find_kernel_and_mods(arch, args)
		 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/virtme/commands/run.py", line 486, in find_kernel_and_mods
	if not os.path.exists(virtme_mods) or is_file_more_recent(
					      ^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3/dist-packages/virtme/commands/run.py", line 307, in is_file_more_recent
	return os.stat(a).st_mtime > os.stat(b).st_mtime
				     ^^^^^^^^^^
    FileNotFoundError: [Errno 2] No such file or directory: './.virtme_mods/lib/modules/0.0.0/modules.dep'

This is because the .virtme_mods folder has been created while the
.virtme_mods/lib/modules/0.0.0/modules.dep file is still missing.

So use the $MODDIR/modules.dep file to check if virtme's kernel
modules directory needs to be updated.

This fixes issue arighi#87:
amluto/virtme#87

Signed-off-by: Winston Wen <[email protected]>
  • Loading branch information
winnscode committed Feb 2, 2024
1 parent 28e29e2 commit 22bedd8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virtme/commands/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def find_kernel_and_mods(arch, args) -> Kernel:
# Check if modules.order exists, otherwise fallback to mods=none
if os.path.exists(mod_file):
# Check if virtme's kernel modules directory needs to be updated
if not os.path.exists(virtme_mods) or is_file_more_recent(
if not os.path.exists(virtme_mod_file) or is_file_more_recent(
mod_file, virtme_mod_file
):
if modmode == "use":
Expand Down

0 comments on commit 22bedd8

Please sign in to comment.