<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.3">Jekyll</generator><link href="https://random.xdiez.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://random.xdiez.com/" rel="alternate" type="text/html" /><updated>2024-02-05T10:11:55+00:00</updated><id>https://random.xdiez.com/feed.xml</id><title type="html">/xdiez/random</title><subtitle>Blog of a part-time aspiring nerd</subtitle><entry><title type="html">How to do BIOS updates (or downgrades) on Lenovo hardware under Linux</title><link href="https://random.xdiez.com/it/2024/02/03/Lenovo-BIOS-update-downgrade-under-Linux.html" rel="alternate" type="text/html" title="How to do BIOS updates (or downgrades) on Lenovo hardware under Linux" /><published>2024-02-03T20:31:13+00:00</published><updated>2024-02-03T20:31:13+00:00</updated><id>https://random.xdiez.com/it/2024/02/03/Lenovo-BIOS-update-downgrade-under-Linux</id><content type="html" xml:base="https://random.xdiez.com/it/2024/02/03/Lenovo-BIOS-update-downgrade-under-Linux.html">&lt;h1 id=&quot;disclaimer&quot;&gt;Disclaimer&lt;/h1&gt;
&lt;p&gt;I am not assuming any responsibility or liability. You are following this tutorial at your own risk. BIOS updates are inherently risky and might brick your device!&lt;/p&gt;
&lt;h1 id=&quot;prerequisites&quot;&gt;Prerequisites&lt;/h1&gt;
&lt;p&gt;This post assumes you have already&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;downloaded the relevant BIOS update as described in &lt;a href=&quot;/it/2024/02/03/Downgrade-Lenovo-BIOS-fix-sleep-problems.html&quot;&gt;this blogpost&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;manually extracted the BIOS update package as described in &lt;a href=&quot;/it/2024/02/03/Manually-unpack-Lenovo-update-packages.html&quot;&gt;this blogpost&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;h1 id=&quot;generate-boot-media&quot;&gt;Generate boot media&lt;/h1&gt;
&lt;p&gt;The easiest way to flash your Lenovo BIOS under Linux is to create a bootable USD thumbdrive.&lt;/p&gt;
&lt;h2 id=&quot;script-to-prepare-the-media&quot;&gt;Script to prepare the media&lt;/h2&gt;
&lt;p&gt;Unfortunately, in the update package, Lenovo is only providing a batch file to create a boot media under Windows. The relevant file is called &lt;code&gt;mkusbkey.bat&lt;/code&gt;. Thus, we have to create a Linux-compatible script. I have &amp;quot;translated&amp;quot; the batch file into a bash script.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download the USB media creation script from &lt;a href=&quot;/mkusbkey.sh&quot;&gt;here&lt;/a&gt;. Save it to the same directory where &lt;code&gt;mkusbkey.bat&lt;/code&gt; resides.&lt;/li&gt;
&lt;li&gt;Plug a USB thumbdrive into your computer. Make sure it's formatted with FAT32 and backup it before the next step.&lt;/li&gt;
&lt;li&gt;Mark the downloaded script as executable by running
&lt;code&gt;# chmod +x ./mkusbkey.sh&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Now, execute the script by running
&lt;code&gt;# ./mkusbkey.sh &amp;lt;mountpoint_of_thumbdrive&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Once the process is completed, restart your computer. Make sure that booting from external media is enabled by repeatedly pressing the &lt;code&gt;Enter&lt;/code&gt; key during the boot process and press the &lt;code&gt;F1&lt;/code&gt; key to enter the BIOS setup. Once in there, go to &lt;code&gt;Boot&lt;/code&gt;, &lt;code&gt;Startup&lt;/code&gt; or similar and make sure the respective settings are in place.&lt;/li&gt;
&lt;li&gt;Boot from the USB thumbdrive and follow the steps to update or downgrade your BIOS.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;If this post was valuable for you, consider &lt;a href=&quot;https://www.paypal.com/donate/?hosted_button_id=FW2YGYBRUPYBS&quot;&gt;donating&lt;/a&gt;.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;</content><author><name></name></author><category term="it" /><summary type="html">Disclaimer I am not assuming any responsibility or liability. You are following this tutorial at your own risk. BIOS updates are inherently risky and might brick your device!</summary></entry><entry><title type="html">How to manually unpack Lenovo update packages</title><link href="https://random.xdiez.com/it/2024/02/03/Manually-unpack-Lenovo-update-packages.html" rel="alternate" type="text/html" title="How to manually unpack Lenovo update packages" /><published>2024-02-03T20:29:00+00:00</published><updated>2024-02-03T20:29:00+00:00</updated><id>https://random.xdiez.com/it/2024/02/03/Manually-unpack-Lenovo-update-packages</id><content type="html" xml:base="https://random.xdiez.com/it/2024/02/03/Manually-unpack-Lenovo-update-packages.html">&lt;h1 id=&quot;deepdive-into-the-lenovo-update-packages-format&quot;&gt;Deepdive into the Lenovo update packages format&lt;/h1&gt;
&lt;p&gt;Lenovo is supplying the drivers in exe files which can easily be unpacked in Windows (by double-clicking), but if you're working under another operating system, you'll have a harder time. Let's figure out what's contained in these files and how they work.&lt;/p&gt;
&lt;h2 id=&quot;zip&quot;&gt;7zip&lt;/h2&gt;
&lt;p&gt;A quick analysis with 7z shows gives the following output:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ 7z l R22UJ60W.exe&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,16 CPUs AMD Ryzen 7 PRO 6850U with Radeon Graphics      (A40F41),ASM,AES-NI)

Scanning the drive for archives:
1 file, 18459704 bytes (18 MiB)

Listing archive: R22UJ60W.exe

--
Path = R22UJ60W.exe
Type = PE
Physical Size = 18459704
CPU = x86
Characteristics = Executable 32-bit NoRelocs NoLineNums NoLocalSyms Little-Endian Big-Endian
Created = 2020-01-06 08:31:46
Headers Size = 1024
Checksum = 18504171
Image Size = 233472
Section Alignment = 4096
File Alignment = 512
Code Size = 151552
Initialized Data Size = 27648
Uninitialized Data Size = 0
Linker Version = 2.25
OS Version = 5.0
Image Version = 6.0
Subsystem Version = 5.0
Subsystem = Windows GUI
DLL Characteristics = Relocated NX-Compatible TerminalServerAware
Stack Reserve = 1048576
Stack Commit = 16384
Heap Reserve = 1048576
Heap Commit = 4096
Image Base = 4194304
Comment = FileVersion: 4.0.100.1124
FileVersion: 1.30.1.25           
ProductVersion: 1.30.1.25
ProductVersion: 1.30.1.25                                         
Comments: This installation was built with Inno Setup.
CompanyName: Lenovo Group Limited                                        
FileDescription: For Lenovo Updates Catalog                                  
LegalCopyright: Copyright © Lenovo 2021.                                                                            
ProductName: ThinkPad BIOS Update Utility -Package 1.5.11.3
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The following line is of particular interest:
&lt;code&gt;Comments: This installation was built with Inno Setup.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;It seems that Lenovo is packaging its updates with Inno Setup.&lt;/p&gt;
&lt;h2 id=&quot;binwalk&quot;&gt;binwalk&lt;/h2&gt;
&lt;p&gt;We can also use &lt;code&gt;binwalk&lt;/code&gt; to learn more about the structure of the file:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;$ binwalk R22UJ60W.exe&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;DECIMAL       HEXADECIMAL     DESCRIPTION
--------------------------------------------------------------------------------
0             0x0             Microsoft executable, portable (PE)
177264        0x2B470         XML document, version: &amp;quot;1.0&amp;quot;
2512226       0x265562        LZMA compressed data, properties: 0x5D, dictionary size: 8388608 bytes, uncompressed size: 65536 bytes
2852875       0x2B880B        Intel x86 or x64 microcode, sig 0x000906a1, pf_mask 0x82, 2021-11-04, rev 0x011f, size 184320
3229639       0x3147C7        Intel x86 or x64 microcode, sig 0x000906a3, pf_mask 0x80, 2021-12-16, rev 0x0414, size 205824
5344536       0x518D18        Zlib compressed data, best compression
5419579       0x52B23B        Zlib compressed data, best compression
16891496      0x101BE68       LZMA compressed data, properties: 0x5D, dictionary size: 8388608 bytes, uncompressed size: 65536 bytes
17681332      0x10DCBB4       LZMA compressed data, properties: 0x5D, dictionary size: 2097152 bytes, missing uncompressed size
18450440      0x1198808       Object signature in DER format (PKCS header length: 4, sequence length: 9254
18450581      0x1198895       Certificate in DER format (x509 v3), header length: 4, sequence length: 1712
18452297      0x1198F49       Certificate in DER format (x509 v3), header length: 4, sequence length: 1767
18454774      0x11998F6       Object signature in DER format (PKCS header length: 4, sequence length: 4920
18455063      0x1199A17       Certificate in DER format (x509 v3), header length: 4, sequence length: 1782
18456849      0x119A111       Certificate in DER format (x509 v3), header length: 4, sequence length: 1772
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This shows that there are multiple archives nested in the &lt;code&gt;exe&lt;/code&gt; file.&lt;/p&gt;
&lt;h1 id=&quot;how-to-manually-extract-the-update-package&quot;&gt;How to manually extract the update package&lt;/h1&gt;
&lt;p&gt;There is an excellent tool called &lt;code&gt;innoextract&lt;/code&gt;. You can find more information about it on its &lt;a href=&quot;https://constexpr.org/innoextract/&quot;&gt;website&lt;/a&gt; and the &lt;a href=&quot;https://github.com/dscharrer/innoextract&quot;&gt;GitHub repo&lt;/a&gt;.
Now, in order to extract the update file, follow the steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Install &lt;code&gt;innoextract&lt;/code&gt; from its source code or one of the ready-made packages, both can be found on &lt;a href=&quot;https://constexpr.org/innoextract/#packages&quot;&gt;this webpage&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Open a new shell/terminal and run the command
&lt;code&gt;innoextract &amp;lt;exe update file&amp;gt;&lt;/code&gt;, e.g., &lt;code&gt;innoextract R22UJ60W.exe&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The utility will extract the contents of the update package to a subdirectory in the current directory. In my case, the directory was called &lt;code&gt;code$GetExtractPath$&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If you intend to update or downgrade your Lenovo machine's BIOS under Linux, please read the &lt;a href=&quot;/it/2024/02/03/Lenovo-BIOS-update-downgrade-under-Linux.html&quot;&gt;follow-up blogpost&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;If this post was valuable for you, consider &lt;a href=&quot;https://www.paypal.com/donate/?hosted_button_id=FW2YGYBRUPYBS&quot;&gt;donating&lt;/a&gt;.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;</content><author><name></name></author><category term="it" /><summary type="html">Deepdive into the Lenovo update packages format Lenovo is supplying the drivers in exe files which can easily be unpacked in Windows (by double-clicking), but if you're working under another operating system, you'll have a harder time. Let's figure out what's contained in these files and how they work. 7zip A quick analysis with 7z shows gives the following output:</summary></entry><entry><title type="html">How to fix sleep problems on Lenovo laptops by downgrading the BIOS</title><link href="https://random.xdiez.com/it/2024/02/03/Downgrade-Lenovo-BIOS-fix-sleep-problems.html" rel="alternate" type="text/html" title="How to fix sleep problems on Lenovo laptops by downgrading the BIOS" /><published>2024-02-03T17:28:21+00:00</published><updated>2024-02-03T17:28:21+00:00</updated><id>https://random.xdiez.com/it/2024/02/03/Downgrade-Lenovo-BIOS-fix-sleep-problems</id><content type="html" xml:base="https://random.xdiez.com/it/2024/02/03/Downgrade-Lenovo-BIOS-fix-sleep-problems.html">&lt;h1 id=&quot;disclaimer&quot;&gt;Disclaimer&lt;/h1&gt;
&lt;p&gt;&lt;strong&gt;I assume no guarantee or warranty, no responsibility or liability for whatever you might be doing based on the information in this post. Changing your computer's BIOS is inherently risky and, in very rare cases, you might brick your device entirely. Also, there are apparently cases where the operating system (Windows 11) didn't boot anymore after a BIOS downgrade, and users had to reinstall it. Thus, make a backup of all your data first, before proceeding! (Thanks to &lt;a href=&quot;https://forums.lenovo.com/t5/ThinkPad-T400-T500-and-newer-T-series-Laptops/Please-bring-back-S3-sleep/m-p/5285890?page=1#6247782&quot;&gt;crispy42 in the Lenovo Support Forums&lt;/a&gt; for this hint!)&lt;/strong&gt;&lt;/p&gt;
&lt;h1 id=&quot;lenovo-bioses-are-going-downhill&quot;&gt;Lenovo BIOSes are going downhill&lt;/h1&gt;
&lt;p&gt;While I love some Lenovo hardware (especially the T4**s/T14s series), the quality of the BIOSes that Lenovo is putting out these days is getting worse and worse. Currently, my daily driver is a Lenovo T14s Gen 3, and I found that the recent BIOS versions (e.g., 1.35, 1.31) caused serious problems because my the machine would no longer wake up from sleep mode. While with previous BIOS versions this only occurred occassionally, with 1.35/1.31 it became a routine symptom and made life very difficult.&lt;/p&gt;
&lt;p&gt;If you google around, you will find that many users suffer from these symptoms, complaining, for example, in the &lt;a href=&quot;https://forums.lenovo.com/t5/ThinkPad-T400-T500-and-newer-T-series-Laptops/T14-won-t-wake-up-out-sleep/m-p/5155189?page=1&quot;&gt;Lenovo support forums&lt;/a&gt; and on &lt;a href=&quot;https://www.reddit.com/r/thinkpad/comments/w35d1w/new_t14s_gen_3_amd_sleep_issues_already/&quot;&gt;Reddit&lt;/a&gt; (these are just the top search results; there are many more threads). I've tried many different things, such as installing Ubuntu instead of Windows, and changing various power settings under both operating systems -- to no avail.&lt;/p&gt;
&lt;p&gt;Thus I decided to take a more systematic approach. I remembered that initially, when I got the machine, I didn't have these problems. Since then, various BIOS updates were applied via Lenovo's System Updater tool. I figured there might be a connection here, so I decided that, each time the problem would occur, I would downgrade my machine's BIOS to the preceding version (so I went from 1.35 to 1.31 to 1.30). Then, after each downgrade, I would test if the problem was resolved by using the computer normally, which includes putting it to sleep at various times during the day and for the night.&lt;/p&gt;
&lt;p&gt;I found out, that for my configuration, BIOS version 1.30 (from Lenovo software package R22UR60W) was stable and I haven't had a single occurrence of the computer not waking up from sleep anymore in almost three weeks. Since it is not straightforward to find the necessary files on Lenovo's servers, here is a full tutorial on how to do this.&lt;/p&gt;
&lt;h1 id=&quot;how-to-download-previous-bios-versions&quot;&gt;How to download previous BIOS versions&lt;/h1&gt;
&lt;p&gt;The support pages on the Lenovo website routinely only link to the most recent BIOS version. Thus, a little copy/paste gymnastics are required to download older versions:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Go to the &lt;a href=&quot;https://pcsupport.lenovo.com&quot;&gt;Lenovo PC Support website&lt;/a&gt; and select your PC/laptop model. In my case, it's the &lt;a href=&quot;https://pcsupport.lenovo.com/cy/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t14s-gen-3-type-21cq-21cr&quot;&gt;T14s Gen 3 AMD&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;In the menu on the left side, select &lt;code&gt;Drivers &amp;amp; Software&lt;/code&gt; and then under &lt;code&gt;Manual Update&lt;/code&gt;, click &lt;code&gt;Select Drivers&lt;/code&gt;:
&lt;img src=&quot;https://github.com/mdiez/mdiez.github.io/assets/7477044/52b7c1fc-0fb0-4f8b-8953-c2c87bda3c57&quot; alt=&quot;image&quot; /&gt;&lt;/li&gt;
&lt;li&gt;Click on the tile &lt;code&gt;BIOS/UEFI&lt;/code&gt;:
&lt;img src=&quot;https://github.com/mdiez/mdiez.github.io/assets/7477044/72f7da5b-26fe-4559-bf8a-34d6de20c176&quot; alt=&quot;image&quot; /&gt;&lt;/li&gt;
&lt;li&gt;Download the &lt;code&gt;README&lt;/code&gt; textfile and open it in a separate tab.&lt;/li&gt;
&lt;li&gt;Make a right click on the &lt;code&gt;Download&lt;/code&gt; button for the &lt;code&gt;BIOS Update Utility&lt;/code&gt;, and select &lt;code&gt;Copy Link&lt;/code&gt; from the context menu to save the link to the clipboard:
&lt;img src=&quot;https://github.com/mdiez/mdiez.github.io/assets/7477044/61ca2fec-9532-434e-97cf-969762e2b06f&quot; alt=&quot;image&quot; /&gt;
(in my case, the link is &lt;code&gt;https://download.lenovo.com/pccbbs/mobiles/r22uj65w.exe&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;In the README text file, scroll down to the section &lt;code&gt;VERSION HISTORY&lt;/code&gt;. For my BIOS, the section looks like this, and it lists all previous relases, along with their &lt;code&gt;Package  (ID)&lt;/code&gt;:
&lt;img src=&quot;https://github.com/mdiez/mdiez.github.io/assets/7477044/5abe7ac0-a8dc-4fc1-9b9b-0cbeafcec04f&quot; alt=&quot;image&quot; /&gt;&lt;/li&gt;
&lt;li&gt;Now, in order to download a previous release, paste the link you saved under step 4.2 and replace the filename before the extension with the respective &lt;code&gt;Package&lt;/code&gt; identifier. For example, if I want to download UEFI version 1.30, the associated &lt;code&gt;Package ID&lt;/code&gt; would be &lt;code&gt;R22UJ60W&lt;/code&gt; and thus, the download link is:
&lt;code&gt;https://download.lenovo.com/pccbbs/mobiles/R22UJ60W.exe&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;At this point, &lt;strong&gt;I suggest you download all past BIOSes&lt;/strong&gt; while you're at it and just save them to your hard drive. This way you still have them even if Lenovo should remove them from their servers in the future. Also, if you have the former BIOSes readily available, you can downgrade in a few minutes and thus accelerate your troublshooting efforts.&lt;/li&gt;
&lt;li&gt;If you are running Windows, you can now double click on the downloaded exe file and follow the instructions to downgrade your BIOS. If you are running Linux, you'll need to manually unpack the downloaded exe files and create a boot medium. Find out how you can do this in the &lt;a href=&quot;/it/2024/02/03/Manually-unpack-Lenovo-update-packages.html&quot;&gt;follow up blog post about manually extracting Lenovo update packages&lt;/a&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span style=&quot;color: red;&quot;&gt;&lt;strong&gt;If this post was valuable for you, consider &lt;a href=&quot;https://www.paypal.com/donate/?hosted_button_id=FW2YGYBRUPYBS&quot;&gt;donating&lt;/a&gt;.&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;</content><author><name></name></author><category term="it" /><summary type="html">Disclaimer I assume no guarantee or warranty, no responsibility or liability for whatever you might be doing based on the information in this post. Changing your computer's BIOS is inherently risky and, in very rare cases, you might brick your device entirely. Also, there are apparently cases where the operating system (Windows 11) didn't boot anymore after a BIOS downgrade, and users had to reinstall it. Thus, make a backup of all your data first, before proceeding! (Thanks to crispy42 in the Lenovo Support Forums for this hint!)</summary></entry></feed>