Compare commits

...

No commits in common. "c8" and "c9s" have entirely different histories.
c8 ... c9s

15 changed files with 818 additions and 65 deletions

18
.gitignore vendored
View File

@ -1 +1,17 @@
SOURCES/kdump-anaconda-addon-ffd365e.tar.gz /kdump-anaconda-addon-8b243e3.tar.gz
/kdump-anaconda-addon-966223e.tar.gz
/kdump-anaconda-addon-b16ea2c.tar.gz
/kdump-anaconda-addon-c109552.tar.gz
/kdump-anaconda-addon-122ccd9.tar.gz
/kdump-anaconda-addon-80aab11.tar.gz
/kdump-anaconda-addon-4ba507e.tar.gz
/kdump-anaconda-addon-d046d22.tar.gz
/kdump-anaconda-addon-ce26db0.tar.gz
/kdump-anaconda-addon-5b74c1d.tar.gz
/kdump-anaconda-addon-400359b.tar.gz
/kdump-anaconda-addon-2026d20.tar.gz
/kdump-anaconda-addon-725e4c4.tar.gz
/kdump-anaconda-addon-641a7b7.tar.gz
/kdump-anaconda-addon-4c5a91d.tar.gz
/kdump-anaconda-addon-44fe737.tar.gz
/kdump-anaconda-addon-9603258.tar.gz

View File

@ -1 +0,0 @@
683f2874ba7eecb5208b86fa2253caadf3215a6e SOURCES/kdump-anaconda-addon-ffd365e.tar.gz

29
0001.patch Normal file
View File

@ -0,0 +1,29 @@
From aa335261b2c4771442d82ee1622f189603d4a43d Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 2 Jun 2021 16:44:08 +0800
Subject: [PATCH 1/2] Make kdump options visible by default
Currently this addon is completely hidden unless kdump_addon=on
is set, make it visible by default. Kdump is still disabled by default,
just show the kdump tab.
Signed-off-by: Kairui Song <kasong@redhat.com>
---
com_redhat_kdump/service/initialization.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/com_redhat_kdump/service/initialization.py b/com_redhat_kdump/service/initialization.py
index 2bdbe6e..0e247df 100644
--- a/com_redhat_kdump/service/initialization.py
+++ b/com_redhat_kdump/service/initialization.py
@@ -27,6 +27,6 @@ __all__ = ["check_initial_conditions"]
def check_initial_conditions():
"""Can the Kdump service run?"""
- if not kernel_arguments.is_enabled("kdump_addon"):
+ if kernel_arguments.get("kdump_addon", 1) in ["0", "off", False]:
log.debug("The kdump add-on is disabled. Quit.")
sys.exit(1)
--
2.31.1

60
0002.patch Normal file
View File

@ -0,0 +1,60 @@
From fd7b5edbb777d216ba9f94e5023f793fb01583cd Mon Sep 17 00:00:00 2001
From: Kairui Song <kasong@redhat.com>
Date: Wed, 21 Jul 2021 02:06:36 +0800
Subject: [PATCH 2/2] Enable kdump by default
Signed-off-by: Kairui Song <kasong@redhat.com>
---
com_redhat_kdump/service/kdump.py | 2 +-
com_redhat_kdump/service/kickstart.py | 2 +-
test/unit_tests/test_kickstart.py | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/com_redhat_kdump/service/kdump.py b/com_redhat_kdump/service/kdump.py
index 46e7242..4f4cdd1 100755
--- a/com_redhat_kdump/service/kdump.py
+++ b/com_redhat_kdump/service/kdump.py
@@ -41,7 +41,7 @@ class KdumpService(KickstartService):
def __init__(self):
"""Create a service."""
super().__init__()
- self._kdump_enabled = False
+ self._kdump_enabled = True
self.kdump_enabled_changed = Signal()
self._fadump_enabled = False
diff --git a/com_redhat_kdump/service/kickstart.py b/com_redhat_kdump/service/kickstart.py
index c2455a4..32c532f 100644
--- a/com_redhat_kdump/service/kickstart.py
+++ b/com_redhat_kdump/service/kickstart.py
@@ -36,7 +36,7 @@ class KdumpKickstartData(AddonData):
def __init__(self):
super().__init__()
- self.enabled = False
+ self.enabled = True
self.reserve_mb = "auto"
self.enablefadump = False
diff --git a/test/unit_tests/test_kickstart.py b/test/unit_tests/test_kickstart.py
index 49d73d2..f833504 100644
--- a/test/unit_tests/test_kickstart.py
+++ b/test/unit_tests/test_kickstart.py
@@ -26,12 +26,12 @@ class KdumpKickstartTestCase(TestCase):
self.assertEqual(output.strip(), dedent(ks_out).strip())
def test_ks_default(self):
- self.assertEqual(self._service.kdump_enabled, False)
+ self.assertEqual(self._service.kdump_enabled, True)
self.assertEqual(self._service.fadump_enabled, False)
self.assertEqual(self._service.reserved_memory, "auto")
self._check_ks_output("""
- %addon com_redhat_kdump --disable
+ %addon com_redhat_kdump --enable --reserve-mb='auto'
%end
""")
--
2.31.1

58
0003.patch Normal file
View File

@ -0,0 +1,58 @@
From 1434290fa4b5cfdf4aeb944df17b2221954bb722 Mon Sep 17 00:00:00 2001
From: Coiby Xu <coiby.xu@gmail.com>
Date: Wed, 19 Mar 2025 17:10:46 +0800
Subject: [PATCH] Disable kdump.service explicitly if users request to
Resolves: https://issues.redhat.com/browse/RHEL-41082
Currently, kdump.service isn't disabled even users request to. This
happens because RHEL/CentOS systemd presets have kdump.service enabled.
So explicitly disable kdump.service to address this case.
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
---
com_redhat_kdump/service/installation.py | 7 ++++---
test/unit_tests/test_installation.py | 6 +++++-
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/com_redhat_kdump/service/installation.py b/com_redhat_kdump/service/installation.py
index bb5bad2..5c5d9c2 100644
--- a/com_redhat_kdump/service/installation.py
+++ b/com_redhat_kdump/service/installation.py
@@ -138,12 +138,13 @@ class KdumpInstallationTask(Task):
def run(self):
"""Run the task."""
+ systemctl_action = "enable"
if not self._kdump_enabled:
- log.debug("Kdump is disabled. Skipping.")
- return
+ log.debug("kdump.serivce will be disabled.")
+ systemctl_action = "disable"
util.execWithRedirect(
"systemctl",
- ["enable", "kdump.service"],
+ [systemctl_action, "kdump.service"],
root=self._sysroot
)
diff --git a/test/unit_tests/test_installation.py b/test/unit_tests/test_installation.py
index f100dda..e1234be 100644
--- a/test/unit_tests/test_installation.py
+++ b/test/unit_tests/test_installation.py
@@ -187,7 +187,11 @@ class KdumpInstallationTestCase(TestCase):
kdump_enabled=False
)
task.run()
- mock_util.execWithRedirect.assert_not_called()
+ mock_util.execWithRedirect.assert_called_once_with(
+ "systemctl",
+ ["disable", "kdump.service"],
+ root="/mnt/sysroot"
+ )
@patch("com_redhat_kdump.service.installation.util")
def test_installation_kdump_enabled(self, mock_util):
--
2.48.1

137
0004.patch Normal file
View File

@ -0,0 +1,137 @@
From 05a6faed1c0f89d21acc0c0d21cda32a9ee75d11 Mon Sep 17 00:00:00 2001
From: Coiby Xu <coiby.xu@gmail.com>
Date: Tue, 15 Apr 2025 10:19:16 +0800
Subject: [PATCH] Handle the case where systemd isn't installed
Resolvs: https://issues.redhat.com/browse/RHEL-86873
Anaconda may be used to create [1] minimal container image which doesn't
have systemd/systemctl installed.
When using the following kickstart to create a container image,
bootloader --disabled
# boot partitions are irrelevant as the final container image is a tarball
zerombr
clearpart --all
autopart --noboot --nohome --noswap --nolvm --fstype=ext4
%addon com_redhat_kdump --disable
%end
%packages --nocore --excludedocs
redhat-release
bash
rootfiles
coreutils-single
curl-minimal
libcurl-minimal
glibc-minimal-langpack
crypto-policies-scripts
-kernel
-dosfstools
-e2fsprogs
# s390utils-base needs fuse-libs. Comment it for now.
#-fuse-libs
-gnupg2-smime
-libss # used by e2fsprogs
-pinentry
# gdk-pixbuf2-2.40.0-3.el9.s390x requires shared-mime-info
#-shared-mime-info
-trousers
-xkeyboard-config
-xfsprogs
-qemu-guest-agent
# For minimal
microdnf
libusbx
-crypto-policies-scripts
%end
rootpw --lock --iscrypted locked
Anaconda installation will fail with the following error,
No such file or directory: 'systemctl
So skip KdumpInstallationTask when systemd/systemctl isn't installed.
[1] https://issues.redhat.com/browse/RHEL-86873?focusedId=26986146&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-26986146
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
---
com_redhat_kdump/service/installation.py | 9 +++++++++
test/unit_tests/test_installation.py | 19 +++++++++++++++++--
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/com_redhat_kdump/service/installation.py b/com_redhat_kdump/service/installation.py
index 5c5d9c2..1e0096a 100644
--- a/com_redhat_kdump/service/installation.py
+++ b/com_redhat_kdump/service/installation.py
@@ -17,6 +17,7 @@
#
import logging
import os
+import shutil
from pyanaconda.core import util
from pyanaconda.modules.common.constants.objects import BOOTLOADER
@@ -138,6 +139,14 @@ class KdumpInstallationTask(Task):
def run(self):
"""Run the task."""
+
+ # Anaconda may be used to create minimal container image which doesn't
+ # have systemd installed
+ # https://issues.redhat.com/browse/RHEL-41082?focusedId=26969576&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-26969576
+ if not shutil.which(self._sysroot + "/systemctl"):
+ log.debug("systemd not installed, skip KdumpInstallationTask")
+ return
+
systemctl_action = "enable"
if not self._kdump_enabled:
log.debug("kdump.serivce will be disabled.")
diff --git a/test/unit_tests/test_installation.py b/test/unit_tests/test_installation.py
index e1234be..43f5166 100644
--- a/test/unit_tests/test_installation.py
+++ b/test/unit_tests/test_installation.py
@@ -181,7 +181,9 @@ class KdumpInstallationTestCase(TestCase):
assert mock_exec.call_count == 2
@patch("com_redhat_kdump.service.installation.util")
- def test_installation_kdump_disabled(self, mock_util):
+ @patch("shutil.which")
+ def test_installation_kdump_disabled(self, mock_shutil, mock_util):
+ mock_shutil.return_value = True
task = KdumpInstallationTask(
sysroot="/mnt/sysroot",
kdump_enabled=False
@@ -194,7 +196,9 @@ class KdumpInstallationTestCase(TestCase):
)
@patch("com_redhat_kdump.service.installation.util")
- def test_installation_kdump_enabled(self, mock_util):
+ @patch("shutil.which")
+ def test_installation_kdump_enabled(self, mock_shutil, mock_util):
+ mock_shutil.return_value = True
task = KdumpInstallationTask(
sysroot="/mnt/sysroot",
kdump_enabled=True
@@ -205,3 +209,14 @@ class KdumpInstallationTestCase(TestCase):
["enable", "kdump.service"],
root="/mnt/sysroot"
)
+
+ @patch("com_redhat_kdump.service.installation.util")
+ @patch("shutil.which")
+ def test_installation_kdump_disable_no_systemctl(self, mock_shutil, mock_util):
+ mock_shutil.return_value = False
+ task = KdumpInstallationTask(
+ sysroot="/mnt/sysroot",
+ kdump_enabled=False
+ )
+ task.run()
+ mock_util.execWithRedirect.assert_not_called()
--
2.49.0

84
0005.patch Normal file
View File

@ -0,0 +1,84 @@
From: Coiby Xu <coiby.xu@gmail.com>
Subject: Check /usr/bin/systemctl instead of /systemctl
Relates: https://issues.redhat.com/browse/RHEL-29039
Conflict: None
commit 067afd2904bb77d3f87b241506216eae98e111c0
Author: Coiby Xu <coiby.xu@gmail.com>
Date: Wed Aug 13 12:06:33 2025 +0800
Check /usr/bin/systemctl instead of /systemctl
The early patch checks sysroot/systemctl by mistake. Fix it.
Fixes: 25c549c ("Handle the case where systemd isn't installed")
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
diff --git a/com_redhat_kdump/service/installation.py b/com_redhat_kdump/service/installation.py
index 1e0096aa5edb6c054228ff9eec9cc528731c7ed3..aae58c173cc4e879a2ff772417eb17fd8ca29864 100644
--- a/com_redhat_kdump/service/installation.py
+++ b/com_redhat_kdump/service/installation.py
@@ -17,7 +17,6 @@
#
import logging
import os
-import shutil
from pyanaconda.core import util
from pyanaconda.modules.common.constants.objects import BOOTLOADER
@@ -143,7 +142,7 @@ class KdumpInstallationTask(Task):
# Anaconda may be used to create minimal container image which doesn't
# have systemd installed
# https://issues.redhat.com/browse/RHEL-41082?focusedId=26969576&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-26969576
- if not shutil.which(self._sysroot + "/systemctl"):
+ if not os.path.exists(self._sysroot + "/usr/bin/systemctl"):
log.debug("systemd not installed, skip KdumpInstallationTask")
return
diff --git a/test/unit_tests/test_installation.py b/test/unit_tests/test_installation.py
index 43f51669303c147d6528728f26a4d8ffca2a103a..e0d4109ad2fd9996c62a7c746e558fc09f1f5315 100644
--- a/test/unit_tests/test_installation.py
+++ b/test/unit_tests/test_installation.py
@@ -181,9 +181,9 @@ class KdumpInstallationTestCase(TestCase):
assert mock_exec.call_count == 2
@patch("com_redhat_kdump.service.installation.util")
- @patch("shutil.which")
- def test_installation_kdump_disabled(self, mock_shutil, mock_util):
- mock_shutil.return_value = True
+ @patch("os.path.exists")
+ def test_installation_kdump_disabled(self, mock_os_path, mock_util):
+ mock_os_path.return_value = True
task = KdumpInstallationTask(
sysroot="/mnt/sysroot",
kdump_enabled=False
@@ -196,9 +196,9 @@ class KdumpInstallationTestCase(TestCase):
)
@patch("com_redhat_kdump.service.installation.util")
- @patch("shutil.which")
- def test_installation_kdump_enabled(self, mock_shutil, mock_util):
- mock_shutil.return_value = True
+ @patch("os.path.exists")
+ def test_installation_kdump_enabled(self, mock_os_path, mock_util):
+ mock_os_path.return_value = True
task = KdumpInstallationTask(
sysroot="/mnt/sysroot",
kdump_enabled=True
@@ -211,9 +211,9 @@ class KdumpInstallationTestCase(TestCase):
)
@patch("com_redhat_kdump.service.installation.util")
- @patch("shutil.which")
- def test_installation_kdump_disable_no_systemctl(self, mock_shutil, mock_util):
- mock_shutil.return_value = False
+ @patch("os.path.exists")
+ def test_installation_kdump_disable_no_systemctl(self, mock_os_path, mock_util):
+ mock_os_path.return_value = False
task = KdumpInstallationTask(
sysroot="/mnt/sysroot",
kdump_enabled=False

202
0006.patch Normal file
View File

@ -0,0 +1,202 @@
From: Coiby Xu <coiby.xu@gmail.com>
Subject: Call kdumpctl setup-crypttab so kdump will work on boot for encrypted dump target
Resolves: https://issues.redhat.com/browse/RHEL-29039
Conflict: None
commit 181815c59574005582e4ff769e50638f4a0e0214
Author: Coiby Xu <coiby.xu@gmail.com>
Date: Wed Sep 17 14:59:29 2025 +0800
Call kdumpctl setup-crypttab so kdump will work on boot for encrypted dump target
Resolves: https://issues.redhat.com/browse/RHEL-29039
Call "kdumpctl setup-crypttab" to set up /etc/crypttab so the volume
keys can be passed to the crash kernel.
Note Anaconda writes to /etc/crypttab at "Early storage configuration"
phase. So we set up /etc/crypttab at "Anaconda addon configuration"
phase which happens before Anaconda generates initramfs. So the updated
crypttab will be built into the initramfs.
01:52:19,877 INF installation: Queue started: Early storage configuration (3/18)
...
...
01:56:17,041 INF installation: Queue started: Anaconda addon configuration (15/18)
01:56:17,044 INF installation: Queue started: Initramfs generation (16/18)
One benefit of setting up crypttab via kdump is "kdumpctl setup-crypttab" will
continue only the dumping target is truly encrypted and the logic to
detect encrypted dumping target is already there.
After all architectures supports encrypted dump target, the current
implementing of detecting if any volume has been encrypted which may not
necessary be a dump target can be dropped.
Assisted-by: Claude Code
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
diff --git a/com_redhat_kdump/service/installation.py b/com_redhat_kdump/service/installation.py
index aae58c173cc4e879a2ff772417eb17fd8ca29864..9f65a81e50037212559553882de425c91f5fb6f8 100644
--- a/com_redhat_kdump/service/installation.py
+++ b/com_redhat_kdump/service/installation.py
@@ -29,7 +29,7 @@ from com_redhat_kdump.common import getLuksDevices
log = logging.getLogger(__name__)
-__all__ = ["KdumpBootloaderConfigurationTask", "KdumpInstallationTask"]
+__all__ = ["KdumpBootloaderConfigurationTask", "KdumpInstallationTask", "KdumpCrypttabSetupTask"]
class KdumpBootloaderConfigurationTask(Task):
@@ -156,3 +156,40 @@ class KdumpInstallationTask(Task):
[systemctl_action, "kdump.service"],
root=self._sysroot
)
+
+
+class KdumpCrypttabSetupTask(Task):
+ """The task for setting up crypttab for kdump."""
+
+ def __init__(self, sysroot):
+ """Create a task."""
+ super().__init__()
+ self._sysroot = sysroot
+
+ @property
+ def name(self):
+ return "Setup crypttab for kdump"
+
+ def _has_setup_crypttab_command(self):
+ """Check if kdumpctl has setup-crypttab subcommand by checking help output."""
+ try:
+ help_output = util.execWithCapture("kdumpctl", ["help"], root=self._sysroot)
+ return "setup-crypttab" in help_output
+ except FileNotFoundError:
+ log.debug("kdumpctl command not found")
+ return False
+ except Exception as e:
+ log.warning("Failed to check kdumpctl help: %s", e)
+ return False
+
+ def run(self):
+ """Run the task."""
+ if not self._has_setup_crypttab_command():
+ log.debug("kdumpctl setup-crypttab command not available, skipping")
+ return
+
+ try:
+ util.execWithRedirect("kdumpctl", ["setup-crypttab"], root=self._sysroot)
+ log.debug("Successfully executed kdumpctl setup-crypttab")
+ except Exception as e:
+ log.warning("Failed to execute kdumpctl setup-crypttab: %s", e)
diff --git a/com_redhat_kdump/service/kdump.py b/com_redhat_kdump/service/kdump.py
index 8356d193e58000b35cb807e75862f34f1d845ffb..cecbfc3ec6ae34ab9602809091398b3f64917589 100755
--- a/com_redhat_kdump/service/kdump.py
+++ b/com_redhat_kdump/service/kdump.py
@@ -26,7 +26,7 @@ from pyanaconda.modules.common.structures.requirement import Requirement
from com_redhat_kdump.common import getMemoryBounds
from com_redhat_kdump.constants import KDUMP
-from com_redhat_kdump.service.installation import KdumpBootloaderConfigurationTask, KdumpInstallationTask
+from com_redhat_kdump.service.installation import KdumpBootloaderConfigurationTask, KdumpInstallationTask, KdumpCrypttabSetupTask
from com_redhat_kdump.service.kdump_interface import KdumpInterface
from com_redhat_kdump.service.kickstart import KdumpKickstartSpecification
@@ -137,13 +137,22 @@ class KdumpService(KickstartService):
:return: a list of tasks
"""
- return [
+ tasks = [
KdumpInstallationTask(
sysroot=conf.target.system_root,
kdump_enabled=self.kdump_enabled,
)
]
+ if self.kdump_enabled:
+ tasks.append(
+ KdumpCrypttabSetupTask(
+ sysroot=conf.target.system_root
+ )
+ )
+
+ return tasks
+
def configure_bootloader_with_tasks(self, kernels):
return [
KdumpBootloaderConfigurationTask(
diff --git a/test/unit_tests/test_installation.py b/test/unit_tests/test_installation.py
index e0d4109ad2fd9996c62a7c746e558fc09f1f5315..8bff6059db4a5ba926cbd70f8df852ec854aaf34 100644
--- a/test/unit_tests/test_installation.py
+++ b/test/unit_tests/test_installation.py
@@ -1,7 +1,7 @@
from unittest.case import TestCase
from unittest.mock import patch
from com_redhat_kdump.constants import FADUMP_CAPABLE_FILE
-from com_redhat_kdump.service.installation import KdumpBootloaderConfigurationTask, KdumpInstallationTask
+from com_redhat_kdump.service.installation import KdumpBootloaderConfigurationTask, KdumpInstallationTask, KdumpCrypttabSetupTask
SYSROOT = "/sysroot"
@@ -220,3 +220,55 @@ class KdumpInstallationTestCase(TestCase):
)
task.run()
mock_util.execWithRedirect.assert_not_called()
+
+ @patch("pyanaconda.core.util.execWithCapture")
+ def test_crypttab_setup_check_help_with_setup_crypttab(self, mock_exec):
+ mock_exec.return_value = "setup-crypttab Setup crypttab for kdump"
+ task = KdumpCrypttabSetupTask(sysroot="/mnt/sysroot")
+ result = task._has_setup_crypttab_command()
+ mock_exec.assert_called_once_with("kdumpctl", ["help"], root="/mnt/sysroot")
+ assert result is True
+
+ @patch("pyanaconda.core.util.execWithCapture")
+ def test_crypttab_setup_check_help_without_setup_crypttab(self, mock_exec):
+ mock_exec.return_value = "start Start kdump\nstop Stop kdump"
+ task = KdumpCrypttabSetupTask(sysroot="/mnt/sysroot")
+ result = task._has_setup_crypttab_command()
+ mock_exec.assert_called_once_with("kdumpctl", ["help"], root="/mnt/sysroot")
+ assert result is False
+
+ @patch("pyanaconda.core.util.execWithCapture")
+ def test_crypttab_setup_check_help_kdumpctl_not_found(self, mock_exec):
+ mock_exec.side_effect = FileNotFoundError()
+ task = KdumpCrypttabSetupTask(sysroot="/mnt/sysroot")
+ result = task._has_setup_crypttab_command()
+ mock_exec.assert_called_once_with("kdumpctl", ["help"], root="/mnt/sysroot")
+ assert result is False
+
+ @patch("pyanaconda.core.util.execWithRedirect")
+ @patch("com_redhat_kdump.service.installation.KdumpCrypttabSetupTask._has_setup_crypttab_command")
+ def test_crypttab_setup_run_with_command_available(self, mock_has_command, mock_exec):
+ mock_has_command.return_value = True
+ task = KdumpCrypttabSetupTask(sysroot="/mnt/sysroot")
+ task.run()
+ mock_has_command.assert_called_once()
+ mock_exec.assert_called_once_with("kdumpctl", ["setup-crypttab"], root="/mnt/sysroot")
+
+ @patch("pyanaconda.core.util.execWithRedirect")
+ @patch("com_redhat_kdump.service.installation.KdumpCrypttabSetupTask._has_setup_crypttab_command")
+ def test_crypttab_setup_run_without_command_available(self, mock_has_command, mock_exec):
+ mock_has_command.return_value = False
+ task = KdumpCrypttabSetupTask(sysroot="/mnt/sysroot")
+ task.run()
+ mock_has_command.assert_called_once()
+ mock_exec.assert_not_called()
+
+ @patch("pyanaconda.core.util.execWithRedirect")
+ @patch("com_redhat_kdump.service.installation.KdumpCrypttabSetupTask._has_setup_crypttab_command")
+ def test_crypttab_setup_run_execution_failure(self, mock_has_command, mock_exec):
+ mock_has_command.return_value = True
+ mock_exec.side_effect = Exception("Command failed")
+ task = KdumpCrypttabSetupTask(sysroot="/mnt/sysroot")
+ task.run()
+ mock_has_command.assert_called_once()
+ mock_exec.assert_called_once_with("kdumpctl", ["setup-crypttab"], root="/mnt/sysroot")

64
0007.patch Normal file
View File

@ -0,0 +1,64 @@
From: Coiby Xu <coiby.xu@gmail.com>
Subject: Don't emit ENCRYPTION_WARNING for x86_64
Resolves: https://issues.redhat.com/browse/RHEL-29039
Conflict: None
commit a6c2cf4313e937e1ff43d6907c9df445f982e0ef
Author: Coiby Xu <coiby.xu@gmail.com>
Date: Wed Sep 17 09:43:55 2025 +0800
Don't emit ENCRYPTION_WARNING for x86_64
Resolves: https://issues.redhat.com/browse/RHEL-29039
x86_64 now supports encrypted dump target. There is no need for this
warning.
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
Signed-off-by: Coiby Xu <coiby.xu@gmail.com>
diff --git a/com_redhat_kdump/gui/spokes/kdump.py b/com_redhat_kdump/gui/spokes/kdump.py
index c313f43479142d23c94e74bc329d8f3af70dc0c4..1339cff1713a23136ec8382dd702309ba6af55b0 100644
--- a/com_redhat_kdump/gui/spokes/kdump.py
+++ b/com_redhat_kdump/gui/spokes/kdump.py
@@ -31,6 +31,7 @@ from pyanaconda.ui.categories.system import SystemCategory
from pyanaconda.ui.gui.spokes import NormalSpoke
from pyanaconda.ui.gui.utils import fancy_set_sensitive
from pyanaconda.ui.communication import hubQ
+import blivet.arch
from com_redhat_kdump.i18n import _, N_
from com_redhat_kdump.constants import FADUMP_CAPABLE_FILE, KDUMP, ENCRYPTION_WARNING
@@ -135,7 +136,7 @@ class KdumpSpoke(NormalSpoke):
self._enableButton.emit("toggled")
self.clear_info()
- if self._luks_devs:
+ if self._luks_devs and blivet.arch.get_arch() != "x86_64":
self.set_warning(_(ENCRYPTION_WARNING))
def apply(self):
diff --git a/com_redhat_kdump/service/kdump.py b/com_redhat_kdump/service/kdump.py
index cecbfc3ec6ae34ab9602809091398b3f64917589..33d329089fb4e6ea76947f90815bd01ea25c8980 100755
--- a/com_redhat_kdump/service/kdump.py
+++ b/com_redhat_kdump/service/kdump.py
@@ -29,6 +29,7 @@ from com_redhat_kdump.constants import KDUMP
from com_redhat_kdump.service.installation import KdumpBootloaderConfigurationTask, KdumpInstallationTask, KdumpCrypttabSetupTask
from com_redhat_kdump.service.kdump_interface import KdumpInterface
from com_redhat_kdump.service.kickstart import KdumpKickstartSpecification
+import blivet.arch
log = logging.getLogger(__name__)
@@ -144,7 +145,7 @@ class KdumpService(KickstartService):
)
]
- if self.kdump_enabled:
+ if self.kdump_enabled and blivet.arch.get_arch() == "x86_64":
tasks.append(
KdumpCrypttabSetupTask(
sysroot=conf.target.system_root

View File

@ -1,63 +0,0 @@
%global gitcommit ffd365e8b1885b6f7dd285685f3b94ac0bc83e52
%global gitshortcommit %(c=%{gitcommit}; echo ${c:0:7})
%global snapshotdate 20220519
Name: kdump-anaconda-addon
Version: 003
Release: 8.%{snapshotdate}git%{gitshortcommit}%{?dist}
Url: https://github.com/daveyoung/kdump-anaconda-addon
License: GPLv2
Summary: Kdump configuration anaconda addon
BuildArch: noarch
Requires: anaconda >= 32.18
Requires: hicolor-icon-theme
BuildRequires: intltool gettext
Obsoletes: kexec-tools-anaconda-addon < 2.0.17-12
Provides: kexec-tools-anaconda-addon = %{version}-%{release}
Source0: https://github.com/daveyoung/kdump-anaconda-addon/archive/%{gitcommit}/kdump-anaconda-addon-%{gitshortcommit}.tar.gz
%description
Kdump anaconda addon
%prep
%autosetup -n %{name}-%{gitcommit}
%build
%install
%make_install
%find_lang kdump-anaconda-addon
%files -f kdump-anaconda-addon.lang
%doc README
%license LICENSE
%{_datadir}/anaconda/addons/com_redhat_kdump
%{_datadir}/icons/hicolor/scalable/apps/kdump.svg
%changelog
* Thu May 19 2022 Coiby Xu <coxu@redhat.com> - 003-8.20220519gitffd365e
- return False instead of None for the mandatory property
* Thu Oct 21 2021 Kairui Song <kasong@redhat.com> - 003-7.20211021gitcb5edde
- Warn the user when encrypted storage is in-use
* Thu Feb 04 2021 Kairui Song <kasong@redhat.com> - 003-6.20210204git43c39c1
- Set default crashkernel value to 'auto'
* Mon Aug 10 2020 Kairui Song <kasong@redhat.com> - 003-5.20200810git0202fa1
- Update kdump icon
* Fri Jul 10 2020 Kairui Song <kasong@redhat.com> - 003-4.20200526gita0c4527
- Fix CI gating
* Tue May 26 2020 Kairui Song <kasong@redhat.com> - 003-3.20200526gita0c4527
- Rebase to latest upstream
* Wed Nov 07 2018 Kairui Song <kasong@redhat.com> - 003-2.20181107git443d7ed
- Define help_id for Kdump spokes (#1637546)
* Wed Aug 29 2018 Kairui Song <kasong@redhat.com> - 003-1.20180730git06ad891
- Initial package for kdump-anaconda-addon

6
gating.yaml Normal file
View File

@ -0,0 +1,6 @@
--- !Policy
product_versions:
- rhel-9
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

132
kdump-anaconda-addon.spec Normal file
View File

@ -0,0 +1,132 @@
%global gitcommit 960325885aa3b2b2b0af8343951ea86dcacec27a
%global gitshortcommit %(c=%{gitcommit}; echo ${c:0:7})
%global snapshotdate 20220128
Name: kdump-anaconda-addon
Version: 006
Release: 16.%{snapshotdate}git%{gitshortcommit}%{?dist}
Url: https://github.com/daveyoung/kdump-anaconda-addon
License: GPLv2
Summary: Kdump configuration anaconda addon
BuildArch: noarch
Requires: anaconda >= 34.25
Requires: hicolor-icon-theme
BuildRequires: intltool gettext
BuildRequires: make
Obsoletes: kexec-tools-anaconda-addon < 2.0.17-9
Provides: kexec-tools-anaconda-addon = %{version}-%{release}
Source0: https://github.com/daveyoung/kdump-anaconda-addon/archive/%{gitcommit}/kdump-anaconda-addon-%{gitshortcommit}.tar.gz
Patch1: 0001.patch
Patch2: 0002.patch
Patch3: 0003.patch
Patch4: 0004.patch
Patch5: 0005.patch
Patch6: 0006.patch
Patch7: 0007.patch
%description
Kdump anaconda addon
%prep
%autosetup -n %{name}-%{gitcommit} -p1
%build
%install
%make_install
%find_lang kdump-anaconda-addon
%files -f kdump-anaconda-addon.lang
%doc README
%license LICENSE
%{_datadir}/anaconda/addons/com_redhat_kdump
%{_datadir}/anaconda/dbus/confs/org.fedoraproject.Anaconda.Addons.Kdump.conf
%{_datadir}/anaconda/dbus/services/org.fedoraproject.Anaconda.Addons.Kdump.service
%{_datadir}/icons/hicolor/scalable/apps/kdump.svg
%changelog
* Mon Oct 13 2025 Coiby Xu <coxu@redhat.com> - 006-16.20220128git9603258
- Feature: Set up crypttab
* Tue Apr 29 2025 Coiby Xu <coxu@redhat.com> - 006-15.20220128git9603258
- Handle the case where systemd isn't installed (RHEL-86873)
* Tue Mar 25 2025 Coiby Xu <coxu@redhat.com> - 006-14.20220128git9603258
- Disable kdump.service explicitly if users request to (RHEL-41082)
* Thu Jan 20 2022 Coiby <coxu@redhat.com> - 006-13.20220128git9603258
- Update to latest git snapshot (20220128). Resolves: bz2046612
* Thu Jan 20 2022 Coiby <coxu@redhat.com> - 006-12.20220120git44fe737
- Update to latest git snapshot (20220120). Resolves: bz2003131
* Thu Jan 13 2022 Coiby <coxu@redhat.com> - 006-11.20220113git4c5a91d
- Update to latest git snapshot (20220113). Resolves: bz2034491
* Thu Oct 14 2021 Kairui Song <kasong@redhat.com> - 006-10.20211014git641a7b7
- Update to latest git snapshot, update encryption warning message. Resolves: bz1999662
* Thu Aug 19 2021 Kairui Song <kasong@redhat.com> - 006-9.20210819git2026d20
- Update to latest git snapshot, fix encryption warning still present after disabling encryption. Resolves: bz1937035
* Wed Aug 18 2021 Kairui Song <kasong@redhat.com> - 006-8.20210818git400359b
- Update to latest git snapshot, fix installation failure when reuse old partition. Resolves: bz1937035
* Thu Aug 12 2021 Kairui Song <kasong@redhat.com> - 006-7.20210812git5b74c1d
- Update to latest git snapshot, fix kdump spoke is incomplete after luks device is deleted. Resolves: bz1937035
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 006-6.20210805gitce26db0
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
Related: rhbz#1991688
* Thu Aug 05 2021 Kairui Song <kasong@redhat.com> - 006-5.20210805gitce26db0
- Update to latest git snapshot, automated installation won't be blocked. Resolves: bz1986969
- Update RHEL only patch, fix inst.kdump_addon=0 not working issue. Resolves: bz1986942
* Wed Jul 21 2021 Kairui Song <kasong@redhat.com> - 006-4.20210721gitd046d22
- Update to latest git snapshot (20210721). Resolves: bz1937035, bz1959203
- Apply RHEL only patch to enable kdump by default
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 006-3.20201128git4ba507e
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 006-2.20201128git4ba507e
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Sat Nov 28 2020 Kairui Song <kasong@redhat.com> - 006-1.20201128git4ba507e
- Update to latest git snapshot (20201128)
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 005-9.20200220git80aab11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Thu Feb 20 2020 Kairui Song <kasong@redhat.com> - 005-8.20200220git80aab11
- Update to latest git snapshot (20200220)
* Tue Jan 14 2020 Kairui Song <kasong@redhat.com> - 005-7.20200114git122ccd9
- Update to latest git snapshot (20200114)
* Wed Aug 7 2019 Kairui Song <kasong@redhat.com> - 005-6.20190730gitc109552
- Update to latest git snapshot (20190723)
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 005-5.20190103gitb16ea2c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 005-4.20190103gitb16ea2c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jan 3 2019 Kairui Song <kasong@redhat.com> - 005-3.20190103gitb16ea2c
- Update to latest git snapshot (20190103)
* Tue Aug 7 2018 Kairui Song <kasong@redhat.com> - 005-2.20180730git966223e
- Bump obsoleted kexec-tools-anaconda-addon version
- Remove redundant source files
* Tue Aug 7 2018 Kairui Song <kasong@redhat.com> - 005-1.20180730git966223e
- Update to latest git snapshot (20180730)
* Mon Jul 9 2018 Kairui Song <kasong@redhat.com> - 005-1.20180626git8b243e3
- Initial package for kdump-anaconda-addon

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (kdump-anaconda-addon-9603258.tar.gz) = 35dc12eecd9aade5f542d6e732f747f638e8e496a792fb83f88456e2a94388402f6bb3f5c3e3dd9c5d34d71522afeb0b6440fe57a11242b2ef100d26a66e0207

10
tests/runtest.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
# Install from pip since they are missing in RHEL
pip install --ignore-installed pylint nose
# Run test
pushd source
make test
make unittest
popd

18
tests/tests.yml Normal file
View File

@ -0,0 +1,18 @@
---
- hosts: localhost
roles:
- role: standard-test-source
tags:
- always
- role: standard-test-basic
tags:
- atomic
- classic
required_packages:
- pip
- make
- anaconda
tests:
- smoke:
dir: .
run: ./runtest.sh