BIOS主板(非UEFI)安装fedora42的方法

发布于:2025-05-01 ⋅ 阅读:(66) ⋅ 点赞:(0)

BIOS主板(非UEFI)安装fedora42的方法
现实困难:将Fedora-Workstation-Live-42-1.1.x86_64.iso写入U盘制作成可启动U盘启动fedora42,按照向导将fedora42安装到真机的sda7分区中得到报错如下内容:
/boot/efi 必需的
/boot/efi必须位于格式化为efi的设备上
在这里插入图片描述

原因是fedora42不支持BIOS主板,只支持UEFI主板,机械硬盘MBR分区表也没有efi分区
BIOS主板(非UEFI)是指旧电脑主板是BIOS系统+机械硬盘MBR分区表,目前主流主板是UEFI系统+固态硬盘GPT分区表

参考文章:
《CentOS 7 安装问题解决方案》
https://blog.csdn.net/GQ5882/article/details/101283057

《Fedora 37 将UEFI替代传统 BIOS》
https://blog.csdn.net/u014389734/article/details/124283364?spm=1001.2014.3001.5502

《BIOS主板(非UEFI)安装fedora40的方法》
https://blog.csdn.net/weixin_42145772/article/details/139338597?spm=1001.2014.3001.5502

第一和第二的操作是在windows7中完成的,第三的操作是在linux中完成,就是在你的电脑已经装有旧版fedora41或者其它版本的linux系统

一、下载Fedora-Workstation-Live-42-1.1.x86_64.iso
https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/
下载大小为2.3GB的LiveCD安装iso文件Fedora-Workstation-Live-42-1.1.x86_64.iso
https://mirrors.tuna.tsinghua.edu.cn/fedora/releases/42/Workstation/x86_64/iso/Fedora-Workstation-Live-42-1.1.x86_64.iso

二、下载rufus-3.20.exe将Fedora-Workstation-Live-42-1.1.x86_64.iso写入U盘
https://github.com/pbatard/rufus/releases/
下载大小为1.33MB的rufus-3.20.exe,因为是windows 7系统只能运行3.0版本的rufus,不能运行新版4.0
https://github.com/pbatard/rufus/releases/download/v3.20/rufus-3.20.exe

准备一个2GB以上的U盘,运行window系统,拔掉其它移动硬盘,只插上U盘,运行rufus-3.20.exe将Fedora-Workstation-Live-42-1.1.x86_64.iso写入U盘制作成可启动U盘,分区类型选择MBR,文件系统选择FAT32,保持卷标为Fedora-WS-Live-42,选择以ISO镜像模式写入(推荐),完成后删除U盘中的EFI文件夹,这时即使台式机电脑设置从U盘启动是不能启动fedora42的,极有可能是fedora企业的加密和保护技术在起作用
在这里插入图片描述

三、为U盘补安装grub2启动程序
不用拔掉U盘,保持U盘插入台式机电脑的USB接口,重启电脑进入linux系统中,就是在你的电脑已经装有旧版fedora41或者其它版本的linux系统,这时是自动挂载U盘到/run/media/ruhong/FEDORA-WS-L的,卸载U盘/dev/sdb1,在文件夹/mnt/创建文件夹sdb1并将U盘/dev/sdb1挂载到/mnt/sdb1
ruhong@PC-20160104YPJX:~> su -
密码:
PC-20160104YPJX:~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 25626852 22984512 1315236 95% /
devtmpfs 4096 0 4096 0% /dev
tmpfs 2004520 0 2004520 0% /dev/shm
tmpfs 801808 18360 783448 3% /run
/dev/sda1 31457276 16008220 15449056 51% /mnt/sda1
/dev/sda9 209715196 94188 209621008 1% /mnt/sda9
/dev/sda8 104857596 47139988 57717608 45% /mnt/sda8
/dev/sda10 314572796 97388 314475408 1% /mnt/sda10
/dev/sda7 25626852 7096356 17203392 30% /mnt/sda7
/dev/sda11 253311408 167567188 72803848 70% /home
tmpfs 400904 148 400756 1% /run/user/1000
/dev/sdb1 3937280 2286252 1651028 59% /run/media/ruhong/FEDORA-WS-L
PC-20160104YPJX:~ # umount /dev/sdb1
PC-20160104YPJX:~ # mkdir /mnt/sdb1
mkdir: cannot create directory ‘/mnt/sdb1’: File exists
PC-20160104YPJX:~ # mount /dev/sdb1 /mnt/sdb1
PC-20160104YPJX:~ # grub2-install --boot-directory=/mnt/sdb1/boot /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.
使用命令grub2-install --boot-directory=/mnt/sdb1/boot /dev/sdb为U盘补安装grub2启动程序,–boot-directory=/mnt/sdb1/boot是指定使用U盘的grub2模块文件,最后是sdb,不是sdb1,意思是将grub2启动程序安装到U盘的主引导记录,而不是第一个分区的第一个块存储块

四、真机安装测试
不用拔掉U盘,保持U盘插入台式机电脑的USB接口,重启电脑,设置电脑BIOS从U盘启动,选择第一条Start Fedora-Workstation-Live,出现黑屏只有左上角的光标闪烁,看起来像死机,实际要等待3分钟后才进入图形界面,按照向导将fedora42安装到真机的sda7分区中,没有提示“/boot/efi 必需的 必须位于格式化为efi的设备上”,提示“/boot Recommended 所选一个设备”,这条是可以删除的。
在这里插入图片描述

2025-05-01补充:
以下全程操作都是在Linux下完成的,台式机运行linux系统,就是在你的电脑已经装有旧版fedora41或者其它版本的linux系统,拔掉其它移动硬盘,只插上U盘,这时是自动挂载U盘到/run/media/ruhong/FEDORA-WS-L的,卸载U盘/dev/sdb1
应用程序——工具——终端
ruhong@localhost:~> su -
密码:
localhost:~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda5 25626852 23058632 1241116 95% /
devtmpfs 4096 0 4096 0% /dev
tmpfs 2004520 0 2004520 0% /dev/shm
tmpfs 801808 18356 783452 3% /run
/dev/sda7 25626852 11800988 12498760 49% /mnt/sda7
/dev/sda1 31457276 16008652 15448624 51% /mnt/sda1
/dev/sda8 104857596 47178888 57678708 45% /mnt/sda8
/dev/sda9 209715196 94188 209621008 1% /mnt/sda9
/dev/sda10 314572796 97388 314475408 1% /mnt/sda10
/dev/sda11 253311408 167029384 73341652 70% /home
tmpfs 400904 140 400764 1% /run/user/1000
/dev/sdb1 3802480 2290884 1297940 64% /run/media/ruhong/FEDORA-WS-L
localhost:~ # umount /dev/sdb1

一、保持U盘只有一个分区,而且将该分区设置为活动分区
localhost:~ # fdisk /dev/sdb

Welcome to fdisk (util-linux 2.39.3).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Command (m for help): p 输入小写字母p再按回车键,打印分区情况
Disk /dev/sdb: 3.76 GiB, 4041211904 bytes, 7892992 sectors
Disk model: CoolFlash
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00035c23

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 7892991 7890944 3.8G c W95 FAT32 (LBA)

Command (m for help): t 输入小写字母t再按回车键,设置分区类型
Selected partition 1
Hex code or alias (type L to list all): 83 输入数字83再按回车键,设置分区类型为linux,0c是W95 FAT32 (LBA)
Changed type of partition ‘W95 FAT32 (LBA)’ to ‘Linux’.

Command (m for help): a 输入小写字母a再按回车键,设置活动分区
Selected partition 1
The bootable flag on partition 1 is disabled now.

Command (m for help): p
Disk /dev/sdb: 3.76 GiB, 4041211904 bytes, 7892992 sectors
Disk model: CoolFlash
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00035c23

Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 7892991 7890944 3.8G 83 Linux
因为之前boot下面就有星号*,表示该分区已经被设置为活动分区了,

Command (m for help): a 输入小写字母a再按回车键,再设置一次让该分区变回带有星号*
Selected partition 1
The bootable flag on partition 1 is enabled now.

Command (m for help): p
Disk /dev/sdb: 3.76 GiB, 4041211904 bytes, 7892992 sectors
Disk model: CoolFlash
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00035c23

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 7892991 7890944 3.8G 83 Linux

Command (m for help): wq 输入小写字母wq再按回车键,将所有修改写入U盘并退出fdisk程序
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

localhost:~ # fdisk -l /dev/sdb 显示U盘的分区表
Disk /dev/sdb: 3.76 GiB, 4041211904 bytes, 7892992 sectors
Disk model: CoolFlash
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00035c23

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 2048 7892991 7890944 3.8G 83 Linux

二、为U盘的一个分区创建ext4文件系统,而且要设置卷标为大写字母FEDORA-42
localhost:~ # mkfs.ext4 -L FEDORA-42 /dev/sdb1
mke2fs 1.47.0 (5-Feb-2023)
Found a dos partition table in /dev/sdb1
Proceed anyway? (y,N) y 输入小写字母y再按回车键
Creating filesystem with 986624 4k blocks and 247008 inodes
Filesystem UUID: 4f6dc0a0-82f5-4db5-8958-eefd78f100b5
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736

Allocating group tables: done
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

localhost:~ # e2label /dev/sdb1
FEDORA-42

三、将Fedora-Workstation-Live-42-1.1.x86_64.iso的内容复制到U盘,排除EFI文件夹
localhost:~ # mkdir /mnt/iso
localhost:~ # mount -o loop,ro /mnt/sda8/Fedora-Workstation-Live-42-1.1.x86_64.iso /mnt/iso
将Fedora-Workstation-Live-42-1.1.x86_64.iso挂载到/mnt/iso
localhost:~ # mkdir /mnt/sdb1
localhost:~ # mount /dev/sdb1 /mnt/sdb1
将U盘挂载到/mnt/sdb1
localhost:~ # cd /mnt/iso
localhost:/mnt/iso # ls
EFI LiveOS System boot mach_kernel
localhost:/mnt/iso # cp -arv LiveOS/ System/ boot/ mach_kernel /mnt/sdb1
‘LiveOS/’ -> ‘/mnt/sdb1/LiveOS’
‘LiveOS/squashfs.img’ -> ‘/mnt/sdb1/LiveOS/squashfs.img’
squashfs.img是2GB大文件,复制耗时比较长

‘boot/x86_64/loader/grub2’ -> ‘/mnt/sdb1/boot/x86_64/loader/grub2’
‘boot/x86_64/loader/grub2/fonts’ -> ‘/mnt/sdb1/boot/x86_64/loader/grub2/fonts’
‘boot/x86_64/loader/grub2/fonts/unicode.pf2’ -> ‘/mnt/sdb1/boot/x86_64/loader/grub2/fonts/unicode.pf2’
‘mach_kernel’ -> ‘/mnt/sdb1/mach_kernel’

四、进入U盘中boot/grub2/文件夹,修改grub.cfg文本文件,将Fedora-WS-Live-42改为FEDORA-42,要与sdb1的卷标相一致
localhost:/mnt/iso # cd /mnt/sdb1/boot/grub2
localhost:/mnt/sdb1/boot/grub2 #
localhost:/mnt/sdb1/boot/grub2 # sed -n ‘s/Fedora-WS-Live-42/FEDORA-42/p’ grub.cfg
linux (美元符号root)/boot/x86_64/loader/linux quiet rhgb root=live:CDLABEL=FEDORA-42 rd.live.image
linux (美元符号root)/boot/x86_64/loader/linux quiet rhgb root=live:CDLABEL=FEDORA-42 rd.live.image rd.live.check
linux (美元符号root)/boot/x86_64/loader/linux quiet rhgb root=live:CDLABEL=FEDORA-42 rd.live.image {basicgfx}
localhost:/mnt/sdb1/boot/grub2 # sed -i ‘s/Fedora-WS-Live-42/FEDORA-42/’ grub.cfg
localhost:/mnt/sdb1/boot/grub2 # grep -i fedora grub.cfg
menuentry “Start Fedora-Workstation-Live” --class fedora --class gnu-linux --class gnu --class os {
linux (美元符号root)/boot/x86_64/loader/linux quiet rhgb root=live:CDLABEL=FEDORA-42 rd.live.image
menuentry “Test this media & start Fedora-Workstation-Live” --class fedora --class gnu-linux --class gnu --class os {
linux (美元符号root)/boot/x86_64/loader/linux quiet rhgb root=live:CDLABEL=FEDORA-42 rd.live.image rd.live.check
menuentry “Start Fedora-Workstation-Live in basic graphics mode” --class fedora --class gnu-linux --class gnu --class os {
linux (美元符号root)/boot/x86_64/loader/linux quiet rhgb root=live:CDLABEL=FEDORA-42 rd.live.image ${basicgfx}
美元符号让格式显示错乱,在此用中文字样代替

五、为U盘补安装grub2启动程序
localhost:/mnt/sdb1/boot/grub2 # cd
PC-20160104YPJX:~ # grub2-install --boot-directory=/mnt/sdb1/boot /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.
使用命令grub2-install --boot-directory=/mnt/sdb1/boot /dev/sdb为U盘补安装grub2启动程序,–boot-directory=/mnt/sdb1/boot是指定使用U盘的grub2模块文件,最后是sdb,不是sdb1,意思是将grub2启动程序安装到U盘的主引导记录,而不是第一个分区的第一个块存储块

六、真机安装测试
不用拔掉U盘,保持U盘插入台式机电脑的USB接口,重启电脑,设置电脑BIOS从U盘启动,选择第一条Start Fedora-Workstation-Live,出现黑屏只有左上角的光标闪烁,看起来像死机,实际要等待3分钟后才进入图形界面,按照向导将fedora42安装到真机的sda7分区中,没有提示“/boot/efi 必需的 必须位于格式化为efi的设备上”,提示“/boot Recommended 所选一个设备”,这条是可以删除的。

参考文章:
《从U盘启动CentOS7的Live CD iso镜像》
https://blog.csdn.net/laoyiin/article/details/51878060


网站公告

今日签到

点亮在社区的每一天
去签到