Skip to content

Instantly share code, notes, and snippets.

@not-a-feature
Last active March 9, 2024 23:17
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save not-a-feature/ce30cbb2e996c65379ad2da1b4bf8126 to your computer and use it in GitHub Desktop.
Save not-a-feature/ce30cbb2e996c65379ad2da1b4bf8126 to your computer and use it in GitHub Desktop.
Updates the firmware of Western Digital SSDs on Ubuntu / Linux Mint.
⚠️ News: Use the interactive tool wd-fw-update.
- Install it via pip: `pip install wd-fw-update`
- Then run `wd-fw-update`
- See https://github.com/not-a-feature/wd_fw_update for more information.
A shell version is also available and was merged into a proper repository: https://github.com/not-a-feature/wd_ssd_firmware_update
@rmeissn
Copy link

rmeissn commented Jan 3, 2024

This script didn't work for me on Fedora 39 for an SN850X 1TB. After I've successfully updated the firmware manually, the script says "Current firmware version is not in the dependencies. Please upgrade to one of these versions first: ..." which suggests to downgrade to the initial firmware version. https://gist.github.com/Klaas-/ffa1e0759f0b9e6a1fcc94c2fb1aa8d7 worked as expected.

@not-a-feature
Copy link
Author

not-a-feature commented Jan 3, 2024

Yes, the initial version of this script threw this error if the current firmware was already the newest one.

I've updated it using the fork of @Klaas-

@Klaas-
Copy link

Klaas- commented Jan 3, 2024

Yes, the initial version of this script threw this error if the current firmware was already the newest one.

I've updated it using the fork ok @Klaas-

that's nice to hear, I've deleted my fork, no need for this to be in multiple places :)

I've left some more comments in the frame.work forum, but I'll post them here if anyone else feels like improving on this; the changes I made are a quick hack to get it to update drives that have multiple firmware versions in the wd xml.

  1. Multiple Firmware options selection: I am guessing this can be easily improved by looking at the dependencies of the firmware updates and figuring out which one we need to update to according to the currently installed firmware, it also means you may need to run it multiple times if you have a old firmware that needs a intermediate-firmware update first

  2. currently the script always uses slot 2. It may be a good idea to look at the number of firmware slots ( $ nvme id-ctrl /dev/nvme0 -H |grep 'Number of Firmware Slots' ) and figure out which slot has the currently running firmware version and how many slots are free. Also you'd need to look if the first slot is read/write or just read)

  3. currently the script always uses action 3 (activate immediately) -- this may be unsupported, it should look at $ nvme id-ctrl /dev/nvme0 -H | grep 'Firmware Activate Without Reset' it will show Supported/Not Supported

I would play around with this some more myself but I am not looking to brick my primary notebook disk (which is the only wd disk I have)

@not-a-feature
Copy link
Author

This gist was merged into a proper repository:
https://github.com/not-a-feature/wd_ssd_firmware_update

@not-a-feature
Copy link
Author

⚠️ News: Use the interactive tool wd-fw-update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment