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

virtme: fix virtme's kernel modules directory check #65

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

winnscode
Copy link
Contributor

No description provided.

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]>
If preparation process of .virtme_mods is interrupted, the directory
will be in an inconsistent state and needs to updated on the next
run.

Now we use $MODDIR/modules.dep file in run.py to check if virtme_mods
needs to be updated, so we can delete the modules.dep file at the
beginning to ensure that if the command is interrupted, we will update
the directory on the next run.

Signed-off-by: Winston Wen <[email protected]>
@arighi arighi merged commit abfca37 into arighi:main Feb 2, 2024
4 checks passed
@arighi
Copy link
Owner

arighi commented Feb 2, 2024

Applied, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants