Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ฮาร์ดแวร์ >> ฮาร์ดแวร์

แก้ปัญหา Read-only BIOS Lenovo G50: GRUB2 ISO Boot & Kernel Update Fix

หลายเดือนก่อน ผมแก้ Read-only saga บน Lenovo G50 สำเร็จ อ่าน Original problem แล้ว Workaround attempt แรก และสุดท้าย ปัญหายิ่งใหญ่จาก Ubuntu 17.10 Drivers fiasco Real solution มาในรูป Kernel update UEFI ทำงานปกติอีกครั้ง ตัวตลกคือ นี่ Big issue ไม่จำกัด Ubuntu แตถูก Ignore นาน

ขณะรอ Fix ไม่รู้ว่าจะมีจริง ผมหาวิธี Boot OS ใหม่บน Lenovo วิธี Raw disk access via VirtualBox หนึ่ง อีกวิธี Less risky แต่ Less effective: GRUB2 ISOBoot เราจะ Discuss ตอนนี้ เพราะอาจเจอ BIOS/UEFI NVRAM Read-only issue และต้อง Workaround ไม่มี Kernel updates Available มาเริ่มกัน

Boot up

ความสามารถ Boot จาก ISO files โดยตรง เป็น Feature ใหม่ของ GRUB2 bootloader เราจะ Exploit เพื่อ繞過 Cannot use Removable media บน Laptop Documentation ใช้งาน Scarce Biased toward Ubuntu (Most prevalent Linux distro) Makes sense Still

อ่าน GRUB2 tutorial ของผมก่อน Familiar with bootloader และ How it works โดยไม่มี Knowledge นั้น จะ Implement suggestions ในบทความนี้ไม่ได้

Manual menu entry

เชื่อ Test things first Before Automating หรือ Helper tools เพราะเข้าใจ What's happening Behind the scenes Basic idea: สร้าง Custom GRUB2 script หรือ Use Pre-existing template Point to ISO file บน Partition บน Disk Mount ISO as Loopback device Boot Kernel และ initrd/initramfs file ที่มี

ใช้ 40_custom script ใน /etc/grub.d Default Empty เฉพาะ:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

สร้าง Entry ดูผล:

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.
# Simply type the menu entries you want to add after this
# comment. Be careful not to change the 'exec tail' line above.

menuentry "<title>" {
set root=(<disk>,<partition>)
set isoname="<iso file name>"
set isofile="<path>${isoname}.iso"
loopback loop $isofile
linux (loop)<vmlinuz> <boot options>
initrd (loop)<initrd>
}

What do we have here?

ดู Script ของเรา:

  • บรรทัดแรก - title - ระบุ Title ของ Boot entry นั้นๆ
  • Set root - บอก GRUB Partition ไหนมองหา Paths ต่อไป โน้ต: GRUB2 ใช้ Notation ต่าง GRUB legacy เลข Partition เริ่ม 1 ไม่ใช่ 0
  • Directive ที่ 3 - isoname - ชื่อ ISO file ที่ Download
  • บรรทัดที่ 4 - Full path ของ ISO file Combine line 用 ISO name และ .iso suffix
  • Instruction ถัดไป - Mount ISO as Loopback device
  • Load Kernel - linux entry ควรเป็น linuxefi บน UEFI systems มี Boot options mandatory อื่นๆ (Sadly) ต่าง Distro ต่อไป Initrd (initrdefi สำหรับ UEFI)

The problem...

Issue กับ Approach นี้: ทุก Distro ใช้ Method ต่างกัน Boot Live session รวม Overlay filesystem, Boot options, More ไม่มี Single simple way Boot Generic entry ดู Examples จะเห็น Differences และ Fragmentation มาก - เหมือน Linux desktop ทุกด้าน

Fedora test

ทดสอบ Fedora เพราะ Ubuntu example Trivial อ่าน Online มี References โหลด F18-F27 แต่ละตัว Listed สlightly different Common convention Narrows down to:

menuentry "Fedora Live" --class fedora {
set root='hd0,msdos8'
set isofile="/home/roger/Downloads/
Fedora-Workstation-Live-x86_64-27-1.6.iso"
loopback loop $isofile
linux (loop)/isolinux/vmlinuz0 iso-scan/filename=${isofile}
root=live:CDLABEL=Fedora-Live rootfstype=auto ro rd.live.image
quiet rhgb rd.luks=0 rd.md=0 rd.dm=0
initrd (loop)/isolinux/initrd0.img
}

ใช้ Fedora 27 Latest Dual-boot system ISO file บน Partition 8 (sda8) เพิ่มใน Custom script ต่อไป Update GRUB menu Check Verify GRUB config file มี Entry

Test ไม่ได้ - และ Variation โหลดอื่นๆ ใช้ UUID แทน Disk/partition Notation Insert Modules ต่างๆ ไม่ได้ Simple seamless boot Non-Ubuntu ISO file

Non-manual method: grml

Approach 易 Helper tool Auto add entry สำหรับ ISO file ใดๆ Under /boot/grml Install: sudo apt-get install grml Copy ISO files Run GRUB update command

แก้ปัญหา Read-only BIOS Lenovo G50: GRUB2 ISO Boot & Kernel Update Fix

Method นี้ Mixed results - บาง Distro Boot บางตัวไม่ Generated grub.cfg ไม่มี Common simple convention Output ควรเป็นยังไง Arguably Safer than Raw disk access VirtualBox (First article) แต ISOBoot Less likely work all cases

Workarounds อื่นๆ

ไม่เกี่ยว GRUB2 ISOBoot โดยตรง แต Tools อื่นๆ ที่อาจ Consider บางตัวจาก Readers ขอขอบคุณ Genuine help Contributions พยายามช่วย Fix Laptop

Lenovo Official Recommendation: Replace Motherboard จะทำงาน แตหลัง Deplete Software-based solutions พวกนี้ Cheaper Fall back Hardware ได้ และเห็น Kernel update ช่วย Waste of money Motherboard replacement Just yet (Always option Last)

Hardware suggestion (Highly expert): Flash clean UEFI image ลง Chip โดย USB SPI programmer Supported by flashrom tool ไม่ได้ลอง แต Consider ถ้า Ultra-bold และ Savvy

Sub-lesson: Good to wait ผมรอ 4 เดือน ไม่ Rush ซ่อม Hardware หรือซื้อ Laptop ใหม่ แตเข้าใจ Situations บางอย่าง Without choice

Options อื่นๆ Descending priority: 1) BIOS/UEFI firmware flash ถ้ามี 2) rEFInd boot manager แทน GRUB ด้วย Hacking นิดหน่อย (อาจ Explore ในอนาคต) Workaround Limitations Read-only BIOS/UEFI 3) UEFI management programs อื่นๆ เช่น EasyUEFI 4) Prayer book สำหรับ Geeks = Python manual

พูด Point 2 มากขึ้น นี่ Windows-based program Manage EFI bootloader Enable/Disable entries Change order Clean up disabled items

แก้ปัญหา Read-only BIOS Lenovo G50: GRUB2 ISO Boot & Kernel Update Fix
แก้ปัญหา Read-only BIOS Lenovo G50: GRUB2 ISO Boot & Kernel Update Fix

Cleanup command อาจช่วย NVRAM Cooperate (Maybe) Main menu Disable Entry หนึ่ง หรือ Already Disabled state ลอง Cleanup Option ในกรณีผม Not work Tool Throw System API error Probably Not different Interrupted system call issue Initial report Don't get hopes high แต Might work for you better

แก้ปัญหา Read-only BIOS Lenovo G50: GRUB2 ISO Boot & Kernel Update Fix

ขอขอบคุณ aigle, Ivan, L., Neal, Marcin, Richard, Nik, Floris, zloster, Georg, Matthew สำหรับ Suggestions, Ideas, Encouragement ปัญหา Resolved ไม่ Continue Additional tools Ways Resolve ด้วย Above + Kernel update + VirtualBox raw disk access Should be okay

สรุป

Face Odd hardware situation เหมือนนี้ No guarantees Workaround article แรก VirtualBox Raw disk access Bound to work แต Risks High Less intrusive: Boot ISO files GRUB2 (Today topic) Testing: Less successful effective แต Less risk Damage data Lastly Other tools Explore more future

Time being Suggestion: Kernel update ไม่ Work และ ไม่ Really need Change current setup และ Works well - Let it be ผม Use 8 OSes More than plenty Test box In-vivo upgrades ได้ Wait Kernel fix OK ถ้าอยาก Additional OSes โดยไม่ Hardware repairs มี Workaround solutions และ Semi-solutions ไม่ได้ 100% Foolproof 100% Applicable recipe Never case War between Software and Hardware Take care

Cheers.