Arch linux PXE安装

Arch linux PXE安装

官方文档:


这里只说明下pxe里的配置文件,DHCP+TFTP+HTTP(NFS)等环境请自行搭建
以Arch linux iso里的配置文件arch/boot/syslinux/archiso_pxe64.cfg为模板

错误:

starting version 221

running hook [udev]

triggering uevents...

  5.929275] sd 8:0:0:0: [sdb] No Caching mode page found

  5.929363] sd 8:0:0:0: [sdb] Assuming drive cache: write through

running hook [memdisk]

running hook [archiso]

running hook [archiso_loop_mnt]

running hook [archiso_pxe_common]

running hook [archiso_pxe_nbd]

running hook [archiso_pxe_http]

running hook [archiso_pxe_nfs]

Mounting '/dev/disk/by-label/ARCH_201601' to '/run/archiso/bootmnt'

Waiting 30 seconds for device /dev/disk/by-label/ARCH_201601 ...

ERROR: '/dev/disk/by-label/ARCH_201601' device did not show up after 30 seconds...

Falling back to interactive promt

You can try to fix the problem manually, log out when are finished

sh: can't access tty: job control turned off

[rootfs/]#


发现pxe启动到这里会报错,说没有对应的盘,相信玩过Arch硬盘安装的都知道,到这里需要挂盘到某个目录映射loop设备才能继续,如:

mkdir /arch

mount -t vfat /dev/sda5 /arch

modprob loop

losetup /dev/loop20 /arch/archlinux-2016.01.01-dual.iso

ln -s /dev/loop20 /dev/disk/by-label/ARCH_201601

补充:硬盘安装grub2范例


menuentry "Arch Linux (x86_64)" {
    set isofile="/mnt/ISO/archlinux-2016.01.01-dual.iso"
    loopback loop (hd0,4)$isofile
    linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=ARCH_201601 img_loop=$isofile
    initrd (loop)/arch/boot/x86_64/archiso.img
}



但这里的pxe安装,继续找问题,这个问题和官方文档比对后仍然没有等到解决,终于

https://github.com/kyv/archiso

** hooks/archiso_pxe_http

* archiso_http_srv= Set an HTTP URL (must end with /) where ${archisobasedir}
                    is found with all *.sfs files.
                    In the IP/domain part if ${pxeserver} is used, use PXE IP.
                    Default: (unset)
* archiso_http_spc= Set the size of tmpfs where *.sfs files are downloaded.
                    Default: "75%"


** hooks/archiso_pxe_nfs

* archiso_nfs_srv=  Set the NFS-IP:/path of the server
                    In the IP part if ${pxeserver} is used, PXE IP will be used.
                    Default: (unset)
* archiso_nfs_opt=  Set NFS mount options separated by comma.
                    Default: (unset, see below)



http://releng.archlinux.org/pxeboot/

试了下官方公网pxe安装环境,用的是ipxe.pxe来启动

Arch <wbr>linux <wbr>PXE安装
可以后到,首先通过本地的ipxe.pxe启动后重定向到了archlinux的官方pxe环境,加载pxelinux.0,arch.cfg


Arch <wbr>linux <wbr>PXE安装 成功后到了安装菜单,这里选的是国内网易163源,速度最快

Arch <wbr>linux <wbr>PXE安装
也是加载vmlinuz,archiso.img


Arch <wbr>linux <wbr>PXE安装 这里就通过http把airootfs.sfs这个live系统传了过来,之后就
和从cd启动一样进入了live os



出鬼了,我本地pxe也是加载iso里对应的vmlinuz,archiso.img,HTTP,NFS确定可以正常访问,为啥就到不了那一步,于是我开始怀疑,是不是加载的vmlinuz,archiso.img不对,因为像ubuntu,debian这些发行版的pxe引导镜像不能用iso里的,于是就到http://mirrors.163.com/archlinux/iso/2016.01.01/上去比对差异

但并没有差异,163上也是从光盘里提取出来的,但我本地启动就报如下错误

Arch <wbr>linux <wbr>PXE安装


但到这里我可以确定引导文件没问题,唯一有可能出问题的地方就是引导参数,于是比对官方引导选项

Arch <wbr>linux <wbr>PXE安装
下面是我的参数配置,

label arch64_http
menu label Boot Arch Linux (x86_64) (HTTP)
linux /arch/vmlinuz
initrd /arch/intel_ucode.img,/arch/archiso.img
append archisobasedir=arch archiso_http_srv=http://${pxeserver}/ftp/arch/ 
sysappend 3



label arch64_http
menu label Boot Arch Linux (x86_64) (HTTP)
linux /arch/vmlinuz
append archisobasedir=arch archiso_http_srv=http://${pxeserver}/ftp/arch/ initrd=/arch/archiso.img 
这两种写法都试过,仍然报同样的错,根本没去找HTTP(NFS),最后看到少了个参数ip=dhcp,试一试的心态加了上去,没想到成功了,原来archiso.img加载完后,没有ip地址,所以不对找到正确的HTTP(NFS),到这里问题就解决了。下面提供下我个人的参数配置,大家可以参考下,实测可行

label arch64_http

menu label Boot Arch Linux (x86_64) (HTTP)

linux /arch/vmlinuz

initrd /arch/intel_ucode.img,/arch/archiso.img

append archisobasedir=arch ip=dhcp archiso_http_srv=http://${pxeserver}/ftp/arch/ 

sysappend 3

label arch64_nfs

menu label Boot Arch Linux (x86_64) (NFS)

linux /arch/vmlinuz

initrd /arch/intel_ucode.img,/arch/archiso.img

append archisobasedir=arch ip=dhcp archiso_nfs_srv=${pxeserver}:/var/www/pub/ftp/arch

sysappend 3

label arch64_nbd

menu label Boot Arch Linux (x86_64) (NBD)

linux /arch/vmlinuz

initrd /arch/intel_ucode.img,/arch/archiso.img

append archisobasedir=arch archisolabel=ARCH_201601 ip=dhcp archiso_nbd_srv=${pxeserver}

sysappend 3


原文地址:https://www.cnblogs.com/lixuebin/p/10814247.html