public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] pbs2to3: add check for dkms modules
Date: Wed, 29 Nov 2023 15:17:14 +0100	[thread overview]
Message-ID: <20231129141715.219393-2-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20231129141715.219393-1-s.ivanov@proxmox.com>

ported over from pve-manager: 'pve7to8: Add check for dkms modules'
`0329876ccf1d78b848897718bb0c2337c6a55fbb`

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
 src/bin/pbs2to3.rs | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/bin/pbs2to3.rs b/src/bin/pbs2to3.rs
index 9a18d7b2..a9b537fd 100644
--- a/src/bin/pbs2to3.rs
+++ b/src/bin/pbs2to3.rs
@@ -263,12 +263,38 @@ impl Checker {
         Ok(())
     }
 
+    fn check_dkms_modules(&mut self) -> Result<(), Error> {
+        let kver = std::process::Command::new("uname")
+            .arg("-r")
+            .output()
+            .map_err(|err| format_err!("failed to retrieve running kernel version - {err}"))?;
+
+        let output = std::process::Command::new("dkms")
+            .arg("status")
+            .arg("-k")
+            .arg(std::str::from_utf8(&kver.stdout)?)
+            .output();
+        match output {
+            Err(_err) => self.output.log_skip("could not get dkms status")?,
+            Ok(ret) => {
+                let num_dkms_modules = std::str::from_utf8(&ret.stdout)?.lines().count();
+                if num_dkms_modules == 0 {
+                    self.output.log_pass("no dkms modules found")?;
+                } else {
+                    self.output.log_warn("dkms modules found, this might cause issues during upgrade.")?;
+                }
+            }
+        }
+        Ok(())
+    }
+
     pub fn check_misc(&mut self) -> Result<(), Error> {
         self.output.print_header("MISCELLANEOUS CHECKS")?;
         self.check_pbs_services()?;
         self.check_time_sync()?;
         self.check_apt_repos()?;
         self.check_bootloader()?;
+        self.check_dkms_modules()?;
         Ok(())
     }
 
-- 
2.39.2





  reply	other threads:[~2023-11-29 14:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-29 14:17 [pbs-devel] [PATCH proxmox-backup 0/2] port 2 checks from pve7to8 to pbs2to3 Stoiko Ivanov
2023-11-29 14:17 ` Stoiko Ivanov [this message]
2023-11-29 14:17 ` [pbs-devel] [PATCH proxmox-backup 2/2] pbs2to3: check for proper grub meta-package for bootmode Stoiko Ivanov
2023-11-29 14:26 ` [pbs-devel] applied: [PATCH proxmox-backup 0/2] port 2 checks from pve7to8 to pbs2to3 Thomas Lamprecht

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231129141715.219393-2-s.ivanov@proxmox.com \
    --to=s.ivanov@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal