Updating firmware with fwupdmgr

Is this possible in Guix? I just added this to my home.scm.

diff --git a/home.scm b/home.scm
index 08240d2..c047c36 100644
--- a/home.scm
+++ b/home.scm
@@ -6,6 +6,7 @@
              (gnu packages admin)
              (gnu packages base)
              (gnu packages file)
+             (gnu packages firmware)
              (gnu packages freedesktop)
              (gnu packages glib)
              (gnu packages librewolf)
@@ -26,6 +27,7 @@
                   difftastic
                   file
                   flatpak
+                  fwupd
                   git
                   `(,glib "bin")
                   glibc

and then ran guix home reconfigure home.scm.

But then I got this error.

$ fwupdmgr get-updates
Failed to connect to daemon: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.fwupd was not provided by any .service files

I’ve tried to use it as well but in my system config with KDE Plasma and in the info tool I get the same error.

There is one Guix System service which should fix this error and one fwupd-nonfree package in nonguix, it should be possible to put them together and try but I never had the time

I’ve recently tried adding fwupd (at the system level) and originally got the same error. Thought perhaps guix-fwupd-service-type existed, but seems to still be pending based the following issues thread: [PATCH 1/2] gnu: Add fwupd service.

However, in that thread it does gives the following work-around:

   (simple-service 'dbus-fwupd
                   dbus-root-service-type
                   (list fwupd))

   (simple-service 'polkit-fwupd
                   polkit-service-type
                   (list fwupd))

I gave this a go, and it worked in resolving the above error. But, now I get the following errors(?) when trying the following:

logoraz@framework ~$ fwupdmgr refresh --force
Failed to open polkit agent: missing executable pkttyagent in PATH
No remotes are currently enabled so no metadata is available.
Metadata can be obtained from the Linux Vendor Firmware Service.
Enable this remote? [Y|n]: y
Authenticating…          [ -                                     ]
Failed to obtain auth

…and

logoraz@framework ~$ fwupdmgr get-updates
Failed to open polkit agent: missing executable pkttyagent in PATH
Devices with no available firmware updates: 
 • Fingerprint Sensor
 • Laptop Webcam Module (2nd Gen)
 • System Firmware
 • UEFI dbx
 • WD BLACK SN850X 1000GB
No updatable devices

This is as far as I’ve got on this… Any ideas?

Here is my fwupd-service-type :

(define-module (trev-guix services fwupd)
  #:use-module (gnu services)
  #:use-module (gnu services admin)
  #:use-module (gnu services dbus)
  #:use-module (gnu services shepherd)
  #:use-module (guix gexp)
  #:use-module (guix records)
  #:use-module (nongnu packages firmware))

(define-record-type* <fwupd-configuration>
  fwupd-configuration make-fwupd-configuration
  fwupd-configuration?
  (fwupd fwupd-configuration-fwupd
         (default fwupd-nonfree)))

(define (fwupd-activation config)
    (with-imported-modules '((guix build utils))
      #~(begin
          (use-modules (guix build utils))
          (mkdir-p "/var/cache/fwupd")
          (mkdir-p "/var/lib/fwupd/local.d")
          (mkdir-p "/var/lib/fwupd/"))))

(define-public fwupd-service-type
  (let ((fwupd-package (compose list fwupd-configuration-fwupd)))
    (service-type
     (name 'fwupd)
     (extensions
      (list (service-extension polkit-service-type fwupd-package)
	    (service-extension dbus-root-service-type fwupd-package)
            (service-extension activation-service-type fwupd-activation)))
     (default-value (fwupd-configuration))
     (description "A service that runs the necessary daemons for fwupd."))))

Works for me!

2 Likes

Thanks - I’ll give this a try and see if it works for me as well, appreciate the help!

EDIT: Just tried it and it works! Needed the fwupd-activation you implemented.

fwupdmgr refresh --force still complains:

Failed to open polkit agent: missing executable pkttyagent in PATH

But suppose this is not needed on guix, wonder if the fwupd package should be patched so that it doesn’t emit this message…

Again, thanks a lot for the help!

I didn’t see this message before. Did you restart? I used fwupdmgr refresh –-force. BTW I am using the nonguix fwupd-nonfree package.

I just trialed fwupd-nonfree from (nongnu packages firmeware) and am still getting that message as well. :thinking:

Either way, it is better for me to have fwupd-nonfree as it has support for nonfree LVFS repository.

1 Like

Installing polkit fixed missing executable pkttyagent in PATH for me.

2 Likes

Awesome- thank you! I forgot about this, but just installed polkit and the warning message vanished!

1 Like