- How to update Lenovo BIOS from Linux without using Windows
- Procedure to update Lenovo BIOS from Linux
- Step 1. Download Lenovo BIOS
- Step 2. Install geteltorito cli on Linux
- Step 3. Extract the image from iso file
- Write x230.img to the USB pen
- Step 4. Updating the BIOS on Lenovo x230 laptop from Linux using a USB flash pen
- Video demo: Updating the BIOS on Lenovo Thinkpad laptops from Linux using a usb pen
- Conclusion
- Обновление UEFI/BIOS в Linux
- FAT32 ESP
- Подготовка
- Flash your Lenovo Ideapad laptop BIOS from Linux using UEFI capsule updates
- Different machines, different firmware updates
- Capsule what?
- Compatible models
- Step 1: locate and extract the firmware update file
- Step 2: install the UEFI Linux firmware update tools
- Step 3: flash the firmware!
- Step 4: reconfigure the BIOS to boot Linux again
- Step 5: restore the UEFI boot entry
How to update Lenovo BIOS from Linux without using Windows
Procedure to update Lenovo BIOS from Linux
- Download Lenovo BIOS Bootable CD for your Laptop model
- Use the geteltorito command to extract bootable image
- Run the dd command to write extracted image to USB stick or pen
- Reboot the laptop
- Interrupt boot process by pressing the ENTER key
- Press F12 key and select USB mass storage device as boot source
- The BIOS update utility should run now
Let us see all steps in details. I am going to update my BIOS for the Lenovo x230 laptop.
The procedure discussed here is for an older model of Lenovo ThinkPad and other models. These days latest models of ThinkPads support direct BIOS/Firmware updates using Linux CLI and GUI. See this guide about those options.
- No ads and tracking
- In-depth guides for developers and sysadmins at Opensourceflare✨
- Join my Patreon to support independent content creators and start reading latest guides:
- How to set up Redis sentinel cluster on Ubuntu or Debian Linux
- How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
- How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
- A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
- How to protect Linux against rogue USB devices using USBGuard
Join Patreon ➔
Step 1. Download Lenovo BIOS
Step 2. Install geteltorito cli on Linux
Type the following apt command/apt-get command to install it on a Debian/Ubuntu Linux:
$ sudo apt install genisoimage
Fedora Linux user should type the following dnf command:
$ sudo dnf install geteltorito genisoimage
CentOS/RHEL user need to type the following yum command:
$ sudo yum install genisoimage
SUSE/OpenSUSE Linux user type the following zypper command:
$ sudo zypper install genisoimage
Arch Linux user install the geteltorito AUR package using the following method:
Another option is to just grab the Perl script:
$ wget https://userpages.uni-koblenz.de/
krienke/ftp/noarch/geteltorito/geteltorito/geteltorito
$ chmod +x geteltorito
Step 3. Extract the image from iso file
geteltorito is an El Torito boot image extractor. The syntax is:
## Use geteltorito.pl on an Arch Linux ##
geteltorito -o
geteltorito -o x230.img g2uj28us.iso
Sample outputs:
Write x230.img to the USB pen
You can identify USB stick with the following command:
$ dmesg | more
$ sudo blkid
Run the following command to write the image named x230.img to the USB stick:
$ sudo dd if=x230.img of=/dev/sdb bs=64K
Please note that you can display progress with dd command:
$ sudo dd if=x230.img of=/dev/sdc bs=64K status=progress
Finally, reboot your Linux based laptop with the reboot command or shutdown command:
$ sudo reboot
OR
$ sudo shutdown -h 0
Step 4. Updating the BIOS on Lenovo x230 laptop from Linux using a USB flash pen
First, interrupt boot process by pressing the ENTER key. Next hit the F12 key and select USB mass storage device as boot source. Make sure your laptop power supply plugged in. In some case, the battery must charge to 80-100%. Make sure you follow on screen info to update the BIOS.
Video demo: Updating the BIOS on Lenovo Thinkpad laptops from Linux using a usb pen
This video will give all guidance without using an old-fashioned MS-Windows or CD. You can update the BIOS on your Lenovo laptops from Linux using a USB flash stick:
Conclusion
You learned about updating Lenovo BIOS or firmware from Linux for older models. Newer models of Thinkpad support updating Linux using the CLI or GUI tools. See “Thinkpad update firmware on Linux (X1 extreme/P1 gen2)” for more information.
🐧 Get the latest tutorials on Linux, Open Source & DevOps via
Источник
Обновление UEFI/BIOS в Linux
Не секрет, что производители материнских плат и ноутбуков не всегда дают возможность пользователям Linux обновить UEFI/BIOS прошивку так же ненавязчиво, как это делают пользователи Windows. Тем не менее для HP EliteBook 840G1, которым я пользуюсь, сделать это немногим сложнее.
Для этого дела понадобятся следующие артефакты:
- FAT32 EFI System Partition (ESP)
- WINE
- Переменный электрический ток
FAT32 ESP
Ноутбуки линейки HP EliteBook содержат 3 режима загрузки. Узнать какой из режимов выбран можно в настройках UEFI/BIOS → System Configuration → Boot Mode . Данный раздел следует читать, если только выбран последний, бескомпромиссный режим UEFI , в остальных случаях можно проскочить.
- Legacy
- UEFI Hybrid with compatibility support module (CSM)
- UEFI Native without CSM
Если вы внимательно читали топик про Linux kernel EFI Boot Stub, то вы наверняка знаете, что и как нужно сделать, для того, чтобы создать дисковый раздел. Можно использовать gdisk , parted или KDE Disk Partition для создания ESP раздела. Вот так выглядит уже готовый раздел.
Рекомендуется ESP раздел монтировать в /boot/efi , а не просто в /boot , для того чтобы можно было хранить образы ядра Linux и файлы загрузчика ОС на штатных линуксовых ФС, вместо того, чтобы все держать в FAT32 EFI System Partition.
Мы уже знаем, что UEFI/BIOS будет искать \EFI\BOOT\bootx64.efi , для чего абсолютный путь к файлу должен быть /boot/efi/EFI/Boot/Bootx64.efi , иначе все пропало и UEFI/BIOS не найдет загрузчик ОС! Обновлению системной прошивки это не помешает, но для чего же тогда нужна прошивка, если нельзя загрузить операционную систему? Очень немаловажно, что по-умолчанию GRUB-2 не копирует необходимый файл и поэтому bootx64.efi надо скопировать вручную.
Подготовка
Берем свежую прошивку с сайта HP, выбираем Linux в выпадающем списке ОС, затем BIOS, скачиваем… и обнаруживаем исполняемый файл для Windows — sp64081.exe . Нет, глаза нас не подвели.
Опытные пользователи бывают готовы к подобным сюрпризам, для чего держат Windows VM либо пользуются не-эмулятором WINE или и то и другое вместе, бо случаи бывают разные. Для распаковки файла возможностей WINE вполне достаточно. Запускаем:
Программа завершает работу с бестактной ошибкой, напоминая лишний раз о том, что нам подсунули не то, что мы ожидали.
Однако, это не должно никого волновать, так как файлы распакованы верно а сверх этого ничего и не требовалось.
Из этого списка нам понадобятся только 3 файла: L71_0137.bin , HpBiosUpdate.efi и HpBiosUpdate.s12 и теперь внимание: скопировать файлы нужно точно в указанные места.
Чтобы попасть в меню настройки UEFI/BIOS надо после включения нажать клавишу Esc или F10 а далее File → Update System BIOS .
После выбора Accept , процесс обновления стартует без прочих реверансов. Видимо зная цену своим аккумуляторам, производители обновляют прошивку только при включенном электрическом питании компьютера. 2-3 минуты, и процесс благополучно завершен.
UPDATE: По итогам здравых идей в комментариях необходимы некоторые дополнения.
- Можно скопировать те же самые 3 файла на USB флешку, в прописанных путях и используя её обновить прошивку. Разметка файловой системы должна быть FAT32 ESP.
- Можно обновиться из File → Update System BIOS напрямую по интернету, если подключен сетевой кабель. Обновление не будет работать через WiFi соединение.
- Вместо WINE для распаковки архива достаточно использовать 7z e sp64081.exe .
Источник
Flash your Lenovo Ideapad laptop BIOS from Linux using UEFI capsule updates
Jul 14, 2018 · 7 min read
I’m the happy owner of a Lenovo Ideapad laptop (model 710S-13IKB). It’s comparable to the Dell XPS 13 and runs beautifully under Linux, but one detail has always been bugging me: Lenovo only provides BIOS updates for its Ideapad laptops in the form of Windows 10 executable files. System firmware updates are important, especially to mitigate newly found vulnerabilities like Meltdown and Spectre. Since I wiped Windows off my machine a long time ago, I was wondering if there was an alternative (and secure) way to flash firmware updates on it.
And it tu r ns out there is! After months of investigation, I found an elegant and stable update procedure which doesn’t require Windows at all. It doesn’t even need the creation of a bootable USB key: everything is done from the existing Linux installation. How is that possible? Let me introduce you to an interesting new feature of the UEFI specification.
Different machines, different firmware updates
Many latop brands like Dell or Asus provide firmware files that you can put on a USB key and flash from an update application located in the BIOS menu itself. Lenovo does not. Instead, they give you two options:
- For the higher-end ThinkPad series inherited from IBM, they provide bootable CD images that can be turned into bootable USB keys. That’s another good OS-agnostic solution.
- For the Ideapad and Yoga series, you’re stuck with a Windows executable file. The contents of this file and the actual flashing procedure varies depending on the BIOS/Firmware brand.
If you have a modern machine with a Phoenix firmware, chances are that the Windows executable contains the update in the form of an UEFI Capsule Update.
Capsule what?
When a firmware is distributed in that form, the update program won’t flash it directly under Windows. Instead, it will delegate the task to the standard UEFI update mechanism called Capsule Update. In practice, it will ask the operating system to copy an update file to the system partition then program the UEFI to verify this update and install it after the next reboot of the machine, before the operating system starts.
This standard update system is part of the UEFI 2.5 specification released in 2015 and is also available for Linux thanks to efforts from Intel and Red Hat. To be able to use it, your Linux distribution must already boot in UEFI mode from a disk including an EFI system partition.
Compatible models
I compiled the following list of Lenovo laptops which come with a firmware update in the form of a Capsule Update installer. If you find more (including from other brands), please mention them in the comments.
700–15ISK, 700–17ISK
710S-13ISK, 710S-13IKB
720S-15IKB, 720S Touch-15IKB
E42–80, E52–80, E53–80
300S-14ISK, 500S-14ISK, Edge 2–1580, Flex 3–1480, Flex 3–1580, Yoga 500–14ISK, Yoga 500–15ISK
720–15IKB (Type 81AG)
K21–80, K22–80, K32–80
K41–80/M41–80
XiaoXin Rui7000
Rescuer E520–15IKB
V110–14IAP, V110–15IAP
V110–15IKB, V110–15ISK
V310–14IKB, V310–15IKB, V510–14IKB, V510–15IKB
V310–14ISK, V310–15ISK
V330–15IKB, V330–15ISK
V730–13IKB, V730–13ISK
V730–15IKB
Step 1: locate and extract the firmware update file
Go to the Lenovo support website and download the latest BIOS executable file for your machine. This is actually a Windows self-extracting archive built using Inno Setup. You can extract the files in these archives using the command line tool innoextract which is available for many Linux distributions. I’m using Arch Linux so I install it using pacman :
Now let’s extract the files:
Warning: Make sure you use the latest version of innoextract which is compatible with BIOS update executable files generated by Inno Setup version 6.0.0, the version that Lenovo is currently using.
If you have a compatible model you will find a .cap file, which is the file format for UEFI Capsule Updates. Keep that file and delete the rest.
Step 2: install the UEFI Linux firmware update tools
There is a high-level tool called fwupd which allows to automatically detect, download and install updates from the Linux Vendor Firmware Service. This tool also integrates with the Gnome Software graphical user interface in order to display firmware updates next to regular software updates.
Unfortunately, there are only a handful of machines supported on that site at the time of this writing, mostly from Dell. Other vendors don’t (yet) make the effort of publishing their software updates for Linux users.
Instead of the fwupd daemon and its companion tool fwupdmgr , we’re going to use a lower-level tool called fwupdate. It’s normally installed along with fwupd, but on some Linux distributions you may have to install it separately.
On Arch Linux, fwupdate is located in: /usr/lib/fwupd/fwupdate .
We can use this tool to check if our machine provides a firmware compatible with Capsule Updates:
If nothing shows up for you, your firmware or your Linux kernel is not compatible and you can’t go any further. Otherwise, copy the GUID number of your system firmware for the next step.
Step 3: flash the firmware!
Now it’s time to prepare and schedule the update for the next system reboot, using our extracted .cap file and the GUID noted above:
Note that I manually specify the ESP path which defaults to /boot/efi . Use the appropriate path for your Linux installation.
If you see no error message, all went well. You can check that the update is pending using the following command:
Plug your laptop to a power source before rebooting or the update will be cancelled and you’ll have to repeat the last step.
Reboot. Now go to the BIOS setup menu of your machine (for Lenovo laptops, press F2 or Fn + F2 at boot time) and make sure the “Linux-Firmware-Updater” entry is moved first in the “Boot Priority Order”.
Save and exit. Now the updater will kick in, load the Capsule Update file into RAM, verify it and restart the machine again.
Hold your breath during the actual flashing procedure.
Success! Your machine has just been updated to its latest firmware.
Step 4: reconfigure the BIOS to boot Linux again
Now the system won’t boot. Don’t panic, it’s just because the BIOS settings have been reset to the factory defaults. You need to configure a few things to put Linux back in charge. At boot, enter the BIOS menu by pressing Fn + F2.
In the “Configuration” tab, put the “SATA Controller Mode” back to AHCI because Linux can’t boot in RAID mode. You can also enable “Intel Virtual Technology” if you’re using KVM (it’s used by virtualization and emulation software).
Next, in the “Security” tab disable “Secure Boot”. Only Windows and a few Linux distributions provide a suitably signed boot loader.
In the “Boot” tab, you’ll notice that the Linux boot loader entry is gone as well, but that shouldn’t be a problem because most systems will attempt to detect previously installed UEFI boot loaders automatically from the disks. Save and exit and your machine should boot back into your Linux installation. If it doesn’t, you can always use a bootable Linux USB stick for the next step.
Step 5: restore the UEFI boot entry
If you want to add back the Linux option in your UEFI boot menu, the simplest way is to reinstall your boot loader. Check the documentation of your Linux distribution to find the correct procedure, which usually consists of a single command line. Many distributions install GRUB2 by default; I prefer using systemd-boot for simplicity.
Everything is back to normal.
I’m excited to see that there are now better options to safely and quickly update our machine firmwares from Linux. I’m waiting for more manufacturers to publish their updates on the Linux Vendor Firmware Service or for a community effort to appear. In the meantime, you can always use this procedure to download, extract and install the update files yourself, if you own a compatible system. Happy flashing!
Источник