Thinkpad – matoken's blog https://matoken.org/blog Is there no plan B? Tue, 05 Nov 2024 21:01:11 +0000 ja hourly 1 https://wordpress.org/?v=7.0.1 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg Thinkpad – matoken's blog https://matoken.org/blog 32 32 Linux上でfwupdを使いThinkPadのファームウェアを更新 https://matoken.org/blog/2024/11/06/update-thinkpad-firmware-using-fwupd-on-linux/ https://matoken.org/blog/2024/11/06/update-thinkpad-firmware-using-fwupd-on-linux/#respond Tue, 05 Nov 2024 21:01:08 +0000 https://matoken.org/blog/?p=4217

最近メイン端末にThinkPad L13(Gen1)を使っています.しかしサスペンドからのレジューム時にXが固まってしまうことがよくあり困っています.
今はWayladだとどうだろうとGnome+Waylandにしてみています.が,今度はサスペンド時に固まり電源LEDが点滅.ログも残っていません.

そういえばファームウェアを更新していなかったなと思いつきfwupdを使ってLinux上からファームウェアアップデートをしてみました.

fwupdを使うと対応機器のファームウェアの確認や更新がLinux上から行えます.

fwupd対応デバイスは以下のページで検索できます.でもUEFIだけでなくSSDなどのファームウェアもあるのでfwupdを入れて調べたほうがお手軽そうです.

fwupdの導入

今回Debianパッケージから導入しました.

$ sudo apt install fwupd

主な操作

fwupdは主にfwupdmgrコマンドで操作します.

fwupd対応デバイスの表示
$ fwupdmgr get-devices
LVFSから最新のメタデータを入手
$ fwupdmgr refresh
アップデート情報の表示
$ fwupdmgr get-updates
ファームウェアを全て更新する
$ fwupdmgr update
Note
即時適用できるものはすぐに反映される.UEFIなどは次回起動時に反映される.
ファームウェアファイルから更新(未検証)
$ fwupdmgr install ./firmware.cab
Note
ファームウェアファイルはLVFS: Device Listから入手できる.

ThinkPad L13(Gen1)での更新例

$ sudo fwupdmgr update
Devices with no available firmware updates:
 • TPM
 • UEFI Device Firmware
 • UEFI Device Firmware
╔══════════════════════════════════════════════════════════════════════════════╗
║ Upgrade Intel Management Engine from 224.33.1125 to 225.74.2355?             ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Lenovo ThinkPad L13 Consumer ME Firmware                                     ║
║                                                                              ║
║ Update version to 14.1.74.2355                                               ║
║                                                                              ║
║ Several Intel known issues were fixed in this release. Refer to Intel        ║
║                                                                              ║
║ Closed Issues at the bottom portion of this build lette                      ║
║                                                                              ║
║ 20R4S2F900 must remain plugged into a power source for the duration of the   ║
║ update to avoid damage.                                                      ║
╚══════════════════════════════════════════════════════════════════════════════╝
Perform operation? [Y|n]: Y
Waiting…                 [***************************************] Less than one minute remaining…
Successfully installed firmware
Do not turn off your computer or remove the AC adapter while the update is in progress.
Devices with the latest available firmware version:
 • KXG6AZNV512G TOSHIBA
╔══════════════════════════════════════════════════════════════════════════════╗
║ Upgrade System Firmware from 0.1.25 to 0.1.30?                               ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Lenovo ThinkPad L13 System Firmware                                          ║
║                                                                              ║
║ 20R4S2F900 must remain plugged into a power source for the duration of the   ║
║ update to avoid damage.                                                      ║
╚══════════════════════════════════════════════════════════════════════════════╝
Perform operation? [Y|n]: Y
Updating System Firmware…[   -                                   ] Less than one minute remaining…
Waiting…                 [***************************************]
Successfully installed firmware
Do not turn off your computer or remove the AC adapter while the update is in progress.
Do not turn off your computer or remove the AC adapter while the update is in progress.
╔══════════════════════════════════════════════════════════════════════════════╗
║ Upgrade UEFI dbx from 220 to 371?                                            ║
╠══════════════════════════════════════════════════════════════════════════════╣
║ Insecure versions of the Microsoft Windows boot manager affected by Black    ║
║ Lotus were added to the list of forbidden signatures due to a discovered     ║
║ security problem.This updates the dbx to the latest release from Microsoft.  ║
║                                                                              ║
║ Before installing the update, fwupd will check for any affected executables  ║
║ in the ESP and will refuse to update if it finds any boot binaries signed    ║
║ with any of the forbidden signatures.Applying this update may also cause     ║
║ some Windows install media to not start correctly.                           ║
║                                                                              ║
╚══════════════════════════════════════════════════════════════════════════════╝
Perform operation? [Y|n]: Y
Waiting…                 [***************************************]
Successfully installed firmware
Do not turn off your computer or remove the AC adapter while the update is in progress.
Do not turn off your computer or remove the AC adapter while the update is in progress.
An update requires a reboot to complete. Restart now? [y|N]:N

この後シャットダウン後電源を入れるとアップデートが始まりました.しかし今回のアップデートではプログレスが出ずアップデートが進んでいるのか不安でした.
例えば以下の画面で数分そのままとか,その後ブランク画面でまたしばらく待つなどして4,5回再起動が行われました.

TP L13 fwupdate LenovoLogo

Note
別の端末ではプログレスが表示されたのでファームウェアによるようです.

アップデートが終わるとOSの起動に遷移します.get-updatesで確認すると更新がなくなりました.

$ fwupdmgr get-updates
Devices with no available firmware updates:
 • TPM
 • UEFI Device Firmware
 • UEFI Device Firmware
Devices with the latest available firmware version:
 • Intel Management Engine
 • KXG6AZNV512G TOSHIBA
 • System Firmware
 • UEFI dbx
No updates available
Note
別のマシンではUEFIのアップデートに複数のバージョンを経由する必要がありました.(例 1.0 → 1.1 → 1.2)

以前はマシンの現在のファームウェアのバージョンを確認し,siteで新しいファームウェアが出ているか確認,もし新しいファームウェアがあったら.isoファイルなどで入手してUSBメモリに書き込み,起動してアップデートという感じでとても面倒でした.fwupdを使うととてもお手軽になります.
GnomeやKDEだとGUIでのパッケージ更新にも組み込まれているようなので意識せず使っている人も居るかもしれません.

環境
$ dpkg-query -W fwupd
fwupd   1.9.26-2
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
$ sudo lshw -sanitize | head
computer
    description: Notebook
    product: 20R4S2F900 (LENOVO_MT_20R4_BU_Think_FM_ThinkPad L13)
    vendor: LENOVO
    version: ThinkPad L13
    serial: [REMOVED]
    width: 64 bits
    capabilities: smbios-3.2.0 dmi-3.2.0 smp vsyscall32
    configuration: administrator_password=disabled chassis=notebook family=ThinkPad L13 power-on_password=disabled sku=LENOVO_MT_20R4_BU_Think_FM_ThinkPad L13 uuid=[REMOVED]
  *-core
]]>
https://matoken.org/blog/2024/11/06/update-thinkpad-firmware-using-fwupd-on-linux/feed/ 0
ThinkPad L13でhibernation状態で液晶画面を開くとresumeしてくる https://matoken.org/blog/2024/10/07/thinkpad-l13-resumes-when-opening-the-lcd-screen-in-hibernation-state/ https://matoken.org/blog/2024/10/07/thinkpad-l13-resumes-when-opening-the-lcd-screen-in-hibernation-state/#respond Mon, 07 Oct 2024 10:30:51 +0000 https://matoken.org/blog/?p=4119

最近 ThinkPad L13 という laptop を利用しています。この端末は suspend 状態でバッテリーがもりもり減っていくので最近は hibernation を利用するようにしました。(NVMe SSD をこの端末で初めて使っていますが hibernation からの resume の速度が速く NVMe の効果を体感できました。)

しかし、この端末は hibernation 状態で電源が切れていても蓋を開くと resume してきます。suspend のときもそうでしたがこの端末は液晶画面のラッチがないのでかばんの中などで勝手に resume してバッテリーを無駄にしてしまいます……。

UEFI の設定にないかなと探しましたがそれらしい設定は見当たらず、以下のページを見つけました。

If you run Linux with systemd, setting HibernateMode=shutdown in /etc/systemd/sleep.conf will do it.

/etc/systemd/sleep.conf で設定変更することで対応できるとのことで試してみました。

設定書き換え
$ sudo git -C /etc diff /etc/systemd/sleep.conf
diff --git a/systemd/sleep.conf b/systemd/sleep.conf
index 9843034..4513b49 100644
--- a/systemd/sleep.conf
+++ b/systemd/sleep.conf
@@ -22,7 +22,7 @@
 #AllowSuspendThenHibernate=yes
 #AllowHybridSleep=yes
 #SuspendState=mem standby freeze
-#HibernateMode=platform shutdown
+HibernateMode=shutdown
 #MemorySleepMode=
 #HibernateDelaySec=
 #SuspendEstimationSec=60min

HibernateMode=shutdown に書き換えた後再起動して、 hibernation を試すと蓋を開閉しても resume して来なくなりました。これで持ち運び時にバッテリーが減らなくなりそうです。

Note

これがうまく行かなかった場合、 cryptsetup のパスワード入力にタイムアウトを設定できないかと思い、以下の patch を試そうかと思っていました。

環境
$ dpkg-query -W systemd
systemd 256.6-1
lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
$ sudo dmidecode -s system-sku-number
LENOVO_MT_20R4_BU_Think_FM_ThinkPad L13
]]>
https://matoken.org/blog/2024/10/07/thinkpad-l13-resumes-when-opening-the-lcd-screen-in-hibernation-state/feed/ 0
ThinkPad T430s の BIOS を USB メモリ経由でアップデートする https://matoken.org/blog/2019/07/05/updating-the-thinkpad-t430s-bios-via-usb-memory/ https://matoken.org/blog/2019/07/05/updating-the-thinkpad-t430s-bios-via-usb-memory/#respond Fri, 05 Jul 2019 14:29:38 +0000 http://matoken.org/blog/?p=2411

以前ジャンクで入手したThinkPad T430s ですが,外部キーボードを使ったり,壊れたX220 の部品を使ったりで現在メインマシンとして利用しています.
今NVIDIA Optimus が利用できないかと試していますが,うまく行っていません.BIOS Update で治ったという事例を見つけたのでUpdate しました.Update イメージはCD に書き込んでそこから起動しないといけませんが,USBメモリでもうまく行ったのでメモを残しておきます.

※失敗するとマシンが動かなくなる可能性があります.

まずはBIOS のversion を確認します.date が2012年とかなので古そう.

現在のBIOS version 確認
$ sudo dmidecode -t bios|grep -E "Version:|Release Date:"
		Version: G7ET60WW (2.02 )
		Release Date: 09/11/2012
$ sudo lshw | grep "\-firmware" -A10|grep -E "version|date"
		  version: G7ET60WW (2.02 )
		  date: 09/11/2012

Lenovo のページでBIOSを確認すると, 26 Jun 2019 の Version 2.75 というものが最新のようです.
Windows用の実行ファイルと,起動CD用のisoファイル,それとそれぞれのリリースレターが用意されています.Linux マシンなのでisoファイルの方を入手します.

ダウンロードしたら,チェックサムを確認します.

webpage より

Checksum Tips

MD5:aa9846fb15114ef18770cc0812188418

SHA1:ace55c1a1fa87f3ca5140ef67d565ff9f863020a

SHA-256:623dc5d0442b3b0e105186901dc403c911717d4f7998223593b93e66afdbcd93

sha256sum で確認
$ sha256sum ~/Downloads/g7uj28us.iso
623dc5d0442b3b0e105186901dc403c911717d4f7998223593b93e66afdbcd93  /home/matoken/Downloads/g7uj28us.iso
isoinfo で少し中を覗く
$ isoinfo -d  -i ./g7uj28us.iso
CD-ROM is in ISO 9660 format
System id:
Volume id: G7ETB5US
Volume set id:
Publisher id:
Data preparer id:
Application id: NERO BURNING ROM
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 16566
El Torito VD version 1 found, boot catalog is in sector 20
Joliet with UCS level 3 found
NO Rock Ridge present
Eltorito validation header:
    Hid 1
    Arch 0 (x86)
    ID 'NERO BURNING ROM'
    Key 55 AA
    Eltorito defaultboot header:
        Bootid 88 (bootable)
        Boot media 4 (Hard Disk Emulation)
        Load segment 7C0
        Sys type 6
        Nsect 1
        Bootoff 1B 27
$ isoinfo -l  -i ./g7uj28us.iso

Directory listing of /
d---------   0    0    0            2048 Jun 13 2019 [     21 02]  .
d---------   0    0    0            2048 Jun 13 2019 [     21 02]  ..

この iso ファイルを CD に書き込んで起動すればいいはずですが,メディアが手元にありません.

iso ファイルによってはUSBメモリに書き込むだけで起動USBメディアになるものもあるので試してみましたが起動できませんでした.

どうにかならないかなーと探すと以下の記事を見つけました.

geteltorito というPerl Script でイメージを変換した後,USBメモリに書き込むことで ThinkPad の BIOS Update ができるようです.
この記事中ではScript 開発者のページから入手していますが,Debian では genisoimage pkg に含まれているのでこれを使いました.

geteltorito の含まれている genisoimage pkg の導入
$ apt-file search geteltorito
genisoimage: /usr/bin/geteltorito
genisoimage: /usr/share/doc/genisoimage/README.geteltorito
genisoimage: /usr/share/man/man1/geteltorito.1.gz
$ sudo apt install genisoimage
usage
$ geteltorito

/usr/bin/geteltorito [-hv] [-o outputfilename] cd-image
Script will try to extract an El Torito image from a
bootable CD (or cd-image) given by <cd-image> and write
the data extracted to STDOUT or to a file.
   -h:        This help.
   -v:        Print version of script and exit.
   -o <file>: Write extracted data to file <file> instead of STDOUT.
USBメモリを接続してデバイスをdmesg やfdisk で確認して,wipefs でパーティション情報をクリアしておく
$ sudo dmesg -He|tail
$ sudo fdisk -l /dev/sdb
$ sudo wipefs -a /dev/sdb
geteltorito でイメージ変換しながら USBメモリへの書き込み
$ geteltorito ./g7uj28us.iso | sudo dd of=/dev/sdb bs=1M oflag=dsync status=progress
Booting catalog starts at sector: 20
Manufacturer of CD: NERO BURNING ROM
Image architecture: x86
Boot media type is: harddisk
El Torito image starts at sector 27 and has 65536 sector(s) of 512 Bytes
[sudo] password for matoken:
33218560 bytes (33 MB, 32 MiB) copied, 10 s, 3.2 MB/sImage has been written to stdout ....

9+178 records in
9+178 records out
33554432 bytes (34 MB, 32 MiB) copied, 10.3254 s, 3.2 MB/s

Debian pkg に含まれているScript のversion とsite で配布されているversion は0.5 と0.6 と少し違ったので念の為両方で変換を掛けて比較してみましたが結果は同じでした.

念の為siteで配布されているものでも変換してイメージを比較してみると同じものだった
$ wget http://userpages.uni-koblenz.de/~krienke/ftp/noarch/geteltorito/geteltorito/geteltorito
$ chmod u+x ./geteltorito
$ ./geteltorito -v
Version: 0.6
$ ./geteltorito -o ./g7uj28us.img ./g7uj28us.iso
$ geteltorito -o ./g7uj28us.img-pkg ./g7uj28us.iso
$ diff -s ./g7uj28us.img ./g7uj28us.img-pkg
Files ./g7uj28us.img and ./g7uj28us.img-pkg are identical

ということで,書き込んだUSBメモリで起動してBIOS update はうまく行きました.

Version が上がっているのを確認
$ sudo dmidecode -t bios|grep -E "Version:|Release Date:"
        Version: G7ETB5WW (2.75 )
        Release Date: 06/10/2019

忘れがちだけど結構脆弱性の修正やmicrocode のアップデートも入っていたのでちゃんと当てないといけないですね…….

環境
$ dpkg-query -W genisoimage coreutils util-linux dmidecode lshw
coreutils       8.30-3
dmidecode       3.2-1
genisoimage     9:1.1.11-3+b2
lshw    02.18.85-0.2
util-linux      2.33.1-0.1
$ hostnamectl | egrep 'Operating System|Architecture'
  Operating System: Debian GNU/Linux 10 (buster)
      Architecture: x86-64

]]>
https://matoken.org/blog/2019/07/05/updating-the-thinkpad-t430s-bios-via-usb-memory/feed/ 0
バッテリをフル充電しないようにして長持ちさせるためのメモ https://matoken.org/blog/2015/08/09/increase_the_life_of_the_battery/ https://matoken.org/blog/2015/08/09/increase_the_life_of_the_battery/#respond Sun, 09 Aug 2015 13:42:44 +0000 http://matoken.org/blog/?p=857 MassRide
NotePC を AC電源で利用する場合フル充電しっぱなしだとバッテリの寿命が短くなります.フル充電せずに手前で充電を止めるようにする方法のメモです.
#いつも持ち運ぶために100%にしたあと設定を覚えてなくてそのままにしてしまうのでメモ><

環境

  • Debian stretch amd64
  • Thinkpad X201s

導入

$ sudo apt install tlp

確認

% sudo tlp-stat -b             
--- TLP 0.7 --------------------------------------------

+++ ThinkPad Extended Battery Functions
tp-smapi   = active
tpacpi-bat = inactive (kernel module 'acpi_call' not installed)

+++ ThinkPad Battery Status: BAT0 (Main / Internal)
/sys/devices/platform/smapi/BAT0/manufacturer               = SANYO
/sys/devices/platform/smapi/BAT0/model                      = 42T4XXX
/sys/devices/platform/smapi/BAT0/manufacture_date           = 2010-08-14
/sys/devices/platform/smapi/BAT0/first_use_date             = 2010-09-22
/sys/devices/platform/smapi/BAT0/cycle_count                =    277
/sys/devices/platform/smapi/BAT0/design_capacity            =  57720 [mWh]
/sys/devices/platform/smapi/BAT0/last_full_capacity         =  27340 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_capacity         =  22140 [mWh]
/sys/devices/platform/smapi/BAT0/remaining_percent          =     81 [%]
/sys/devices/platform/smapi/BAT0/remaining_running_time_now = not_discharging [min]
/sys/devices/platform/smapi/BAT0/remaining_charging_time    = not_charging [min]
/sys/devices/platform/smapi/BAT0/power_now                  =      0 [mW]
/sys/devices/platform/smapi/BAT0/power_avg                  =      0 [mW]

/sys/devices/platform/smapi/BAT0/start_charge_thresh        =     96 [%]
/sys/devices/platform/smapi/BAT0/stop_charge_thresh         =    100 [%]
/sys/devices/platform/smapi/BAT0/force_discharge            =      0

設定( 充電開始 % を75% /充電終了 % を 85% にする場合 )

% sudo tlp setcharge 75 85 BAT0                
Setting temporary charge thresholds for BAT0:
  stop  = 85
  start = 75

もしバッテリが複数ある場合は BAT0, BAT1 のようになるはず.

フル充電に戻す

外で使う前にフル充電したい場合など.

% sudo tlp fullcharge
Setting temporary charge thresholds for BAT0:
  stop  = 100
  start = 96

参考URL

関連記事

]]>
https://matoken.org/blog/2015/08/09/increase_the_life_of_the_battery/feed/ 0
Thinkpad x201s にBluetooth module 増設 https://matoken.org/blog/2015/03/29/thinkpad-x201s_bluetooth-module/ https://matoken.org/blog/2015/03/29/thinkpad-x201s_bluetooth-module/#respond Sat, 28 Mar 2015 19:54:59 +0000 http://matoken.org/blog/?p=782

最近のメインマシンはThinkpad x201s です.これは2台めで中古で買って元のものとニコイチで使っています.良い部品はだいたい移行していたのですが,Bluetooth module は液晶パネルしたとめんどくさいので後回しになっていたのでした.でもXperia Pro でBluetooth テザリングが可能になったので重い腰を上げることに.実際やってみるとあっという間でした.

Thinkpad は保守マニュアルが日本語で公開されているのでとても便利です :)

昔から公開していて,Webでpdfが公開される前はコピーサービスで入手していました.これのおかげで試行錯誤する必要がなくとても助かっています.これもThinkpadを使っている理由の一つです :)

マニュアルを見ると以下の辺りを参考にLCD全面ベゼルを取り外せば良いようですが,ネジキャップを剥がすのとかが面倒です.試しに赤く印をつけた3本だけを外して試すと旧マシンからモジュールの取り出しが出来ました.同様に新マシンも3本だけネジを外して取り付けも出来ました.
Screenshot from 2015-03-28 10:13:07
IMG_20150328_091845IMG_20150328_093620

組み付けた後起動するとさくっと認識.Bluetooth PAN 接続も問題なく行えました.
Screenshot from 2015-03-28 10:11:29

たまにUSBドングルで利用していましたが内臓はスッキリしてていいですね.

Thinkpad関連でよく利用するお店

  • ThinkFactory IBM Lenovo秋葉原 持込修理 販売 保守パーツ 旧PS/PLAZA WAKAMATSU Thinkpadコーナー
  • 中古 ThinkPad 販売専門店 Be-Stock! 鹿児島県鹿屋市に実店舗がある中古店.通販が主で店舗には余り物は並んでない.言えば出てくる.
  • eBay パーツをよく買う
  • ]]>
    https://matoken.org/blog/2015/03/29/thinkpad-x201s_bluetooth-module/feed/ 0