Skip to content

Commit b4101e8

Browse files
committed
adding check for depmod version
1 parent d02d7d7 commit b4101e8

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

lisa/transformers/kernel_source_installer.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,27 @@ def _update_kmod(self, os, node: Node) -> None:
474474
# Update kmod package
475475
node.execute("tdnf update -y kmod", sudo=True)
476476

477+
result = node.execute("depmod --version", sudo=True)
478+
if result.exit_code == 0:
479+
self._log.info(f"Current depmod version: {result.stdout}")
480+
481+
# Check if we need to rebuild the module.builtin files
482+
# This is needed if depmod version is too old
483+
import re
484+
version_match = re.search(r"kmod version (\d+)", result.stdout)
485+
if version_match:
486+
version = int(version_match.group(1))
487+
if version < 29: # Versions below 29 may have issues with newer kernel formats
488+
self._log.warning(f"depmod version {version} is old, may cause issues")
489+
# Try to update from backports or newer repos
490+
if isinstance(os, Ubuntu):
491+
# Try to get a newer version from backports
492+
node.execute(
493+
"apt-get install -y -t $(lsb_release -cs)-backports kmod 2>/dev/null || true",
494+
sudo=True,
495+
shell=True
496+
)
497+
477498
class BaseLocation(subclasses.BaseClassWithRunbookMixin):
478499
def __init__(
479500
self,

0 commit comments

Comments
 (0)