#2359 Issue closed
: ReaR PXE setup for RHEL/OEL 7 to boot with UEFI¶
Labels: enhancement
, support / question
, no-issue-activity
ravikumar-c opened issue at 2020-04-13 10:58:¶
Hi
I have recovered the RHEL/OEL 7 ( UEFI ) server, just skipping the rear-node4 file.. Is there anyway to get correct rear-node4 with linuxefi ?
More details in below
- ReaR version:
[root@node4 ~]# rear -V
Relax-and-Recover 2.5 / 2019-05-10
- OS version
[root@node4 ~]# cat /etc/rear/os.conf
OS_VENDOR=RedHatEnterpriseServer
OS_VERSION=7.5
- ReaR configuration files ("cat /etc/rear/site.conf" and/or "cat /etc/rear/local.conf"):
KERNEL_FILE="/boot/vmlinuz-4.1.12-112.16.4.el7uek.x86_64"
PROGS=( ${PROGS[@]} /usr/bin/dsmc /sbin/ifconfig /sbin/route /bin/netstat )
BACKUP_PROG_EXCLUDE=( "${BACKUP_PROG_EXCLUSE[@]}" '/media' '/var/tmp/' '/var/crash' '/var/spool/postfix' )
COPY_AS_IS=( ${COPY_AS_IS[@]} /etc/adsm /etc/ofed /etc/magic /usr/share/misc/magic /sbin/modprobe.ksplice.orig /usr/bin/kmod /bin/kmod )
TIMESYSC=NTP
KEPP_BUILD_DIR=false
OUTPUT=PXE
BACKUP=NETFS
NETFS_URL="nfs://192.168.10.200/var/lib/tftpboot/rear"
NETFS_SKEP_WARNING=1
NETFS_OPTIONS="nolock,vers=3"
NETFS_PREFIX="$(uname -n}"
OUTPUT_URL="${NETFS_URL}"
OUTPUT_OPTIONS="nolock,vers=3"
OUTPUT_PREFIX="$(uname -n}"
BACKUP_URL="${NETFS_URL}"
BACKUP_OPTIONS="nolock,vers=3"
BACKUP_PREFIX="$(uname -n}"
if [[ "${OUTPUT}" = "PXE" ]]; then
BACKUP=NETFS
BACKUP_URL="${NETFS_URL}"
OUTPUT_URL="${NETFS_URL}"
OUTPUT_PREFIX_PXE=""
PXE_CREATE_LINKS=MAC
PXE_REMOVE_OLD_LINKS="true"
BACKUP_PROG=tar
BACKUP_TYPE=full
fi
- virtual machine.
[root@node4 ~]# dmidecode -t system | grep Manufacturer
Manufacturer: VMware, Inc.
- System architecture X86_64
[root@node4 ~]# uname -a
Linux node4.test.com 4.1.12-112.16.4.el7uek.x86_64 #2 SMP Mon Mar 12 23:57:12 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux
- Firmware UEFI.
[root@node4 ~]# efibootmgr -v
BootCurrent: 0004
BootOrder: 0004,0000,0001,0002,0003
Boot0000* EFI VMware Virtual SCSI Hard Drive (0.0) PciRoot(0x0)/Pci(0x10,0x0)/SCSI(0,0)
Boot0001* EFI VMware Virtual IDE CDROM Drive (IDE 1:0) PciRoot(0x0)/Pci(0x7,0x1)/Ata(1,0,0)
Boot0002* EFI Network PciRoot(0x0)/Pci(0x11,0x0)/Pci(0x1,0x0)/MAC(000c29004b94,0)
Boot0003* EFI Internal Shell (Unsupported option) MemoryMapped(11,0xef8b018,0xf3f6017)/FvFile(c57ad6b7-0515-40a8-9d21-551652854e37)
Boot0004* Oracle Linux HD(1,GPT,2a4b777a-ec8d-4bb0-be61-aab5077d025d,0x800,0x64000)/File(\EFI\redhat\shimx64.efi)
- Storage layout
[root@node4 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 30G 0 disk
├─sda1 8:1 0 200M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 28.8G 0 part
├─ol_node4-root 249:0 0 26.8G 0 lvm /
└─ol_node4-swap 249:1 0 2G 0 lvm [SWAP]
sr0 11:0 1 1024M 0 rom
- Recover mkbackup created the file rear-node4 suitable for BIOS not UEFI
[root@PXE-BOOT node4]# cat rear-node4
default hd
prompt 1
timeout 300
label hd
localboot -1
say ENTER - boot local hard disk
say --------------------------------------------------------------------------------
display /node4.message
say ----------------------------------------------------------
say rear = disaster recover this system with Relax-and-Recover
label rear
kernel /node4.kernel
append initrd=/node4.initrd.cgz root=/dev/ram0 vga=normal rw selinux=0 console=ttyS0,9600 console=tty0
- Workaround:
i have create the file grub.cfg and calling the kernel and initrd.cgz files
[root@PXE-BOOT /]# cat /var/lib/tftpboot/efi.x64/grub.cfg
set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
set timeout=30
insmod png
#### Menu Start
menuentry 'Boot from Local Drive' {
exit
}
menuentry 'Rear Recover for node4' {
linuxefi /node4.kernel
initrdefi /node4.initrd.cgz
}
menuentry 'Rear Recover for node5' {
linuxefi /node5.kernel
initrdefi /node5.initrd.cgz
}
-
while Booting the server ( Selected the node 4)
-
Booted the server
-
Rear Recover command the server
gdha commented at 2020-04-14 12:55:¶
@ravikumar-c Nice job! I believe we only support PXE plain BIOS booting for the moment. You enhanced it yourself - any chance you could enhance the ReaR code for EFI PXE booting with a PR?
gdha commented at 2020-04-15 08:49:¶
@gozora As SEM is this feasible to add in the furture?
ravikumar-c commented at 2020-04-15 10:15:¶
i will include the code and test the EFI PXE recover
ravikumar-c commented at 2020-04-17 11:38:¶
I have updated the code and tested the EFI PXE recover. Please review.
Rear version:
Relax-and-Recover 2.5 / Git
OS version:
OS: RHEL/OEL 7 and SLES 15
[root@node4 /]# sdiff ./usr/share/rear/output/PXE/default/810_create_pxelinux_cfg.sh ./usr/share/rear/output/PXE/default/810_create_pxelinux_cfg.sh_ORG | nl
1 # 81_create_pxelinux_cfg.sh # 81_create_pxelinux_cfg.sh
2 # #
3 # create pxelinux config on PXE server for Relax-and-Recover # create pxelinux config on PXE server for Relax-and-Recover
4 # #
5 # This file is part of Relax-and-Recover, licensed under the # This file is part of Relax-and-Recover, licensed under the
6 # Public License. Refer to the included COPYING for full text # Public License. Refer to the included COPYING for full text
7 # we got PXE_KERNEL and PXE_INITRD set in the previous script # we got PXE_KERNEL and PXE_INITRD set in the previous script
8 if [[ ! -z "$PXE_CONFIG_URL" ]] ; then if [[ ! -z "$PXE_CONFIG_URL" ]] ; then
9 # E.g. PXE_CONFIG_URL=nfs://server/export/nfs/tftpboot/px # E.g. PXE_CONFIG_URL=nfs://server/export/nfs/tftpboot/px
10 # Better be sure that on 'server' the directory /export/n # Better be sure that on 'server' the directory /export/n
11 local scheme=$( url_scheme $PXE_CONFIG_URL ) local scheme=$( url_scheme $PXE_CONFIG_URL )
12 local path=$( url_path $PXE_CONFIG_URL ) local path=$( url_path $PXE_CONFIG_URL )
13 mkdir -p $v "$BUILD_DIR/tftpbootfs" >&2 mkdir -p $v "$BUILD_DIR/tftpbootfs" >&2
14 StopIfError "Could not mkdir '$BUILD_DIR/tftpbootfs'" StopIfError "Could not mkdir '$BUILD_DIR/tftpbootfs'"
15 AddExitTask "rm -Rf $v $BUILD_DIR/tftpbootfs >&2" AddExitTask "rm -Rf $v $BUILD_DIR/tftpbootfs >&2"
16 mount_url $PXE_CONFIG_URL $BUILD_DIR/tftpbootfs mount_url $PXE_CONFIG_URL $BUILD_DIR/tftpbootfs
17 PXE_LOCAL_PATH=$BUILD_DIR/tftpbootfs PXE_LOCAL_PATH=$BUILD_DIR/tftpbootfs
18 else else
19 # legacy way using PXE_LOCAL_PATH default # legacy way using PXE_LOCAL_PATH default
20 PXE_LOCAL_PATH=$PXE_CONFIG_PATH PXE_LOCAL_PATH=$PXE_CONFIG_PATH
21 fi fi
22 # PXE_CONFIG_PREFIX is a "string" (by default rear-) - is the # PXE_CONFIG_PREFIX is a "string" (by default rear-) - is the
23 PXE_CONFIG_FILE="${PXE_CONFIG_PREFIX}$HOSTNAME" PXE_CONFIG_FILE="${PXE_CONFIG_PREFIX}$HOSTNAME"
24 if [[ ! -z "$PXE_CONFIG_URL" ]] ; then if [[ ! -z "$PXE_CONFIG_URL" ]] ; then
25 if is_true "$PXE_CONFIG_GRUB_STYLE" ; then if is_true "$PXE_CONFIG_GRUB_STYLE" ; then
26 make_pxelinux_config_grub >"$PXE_LOCAL_PATH/$PXE_CONF make_pxelinux_config_grub >"$PXE_LOCAL_PATH/$PXE_CONF
27 else else
28 make_pxelinux_config >"$PXE_LOCAL_PATH/$PXE_CONFIG_FI make_pxelinux_config >"$PXE_LOCAL_PATH/$PXE_CONFIG_FI
29 fi fi
30 chmod 444 "$PXE_LOCAL_PATH/$PXE_CONFIG_FILE" chmod 444 "$PXE_LOCAL_PATH/$PXE_CONFIG_FILE"
31 else else
32 <
33 EFIMT=`mount -v | grep /sys/firmware/efi/efivars | wc -l` <
34 EFIMGR=`efibootmgr -v | grep "BootOrder" | wc -l` <
35 if [[ x$EFIMT = x1 && x$EFIMGR = x1 ]] ; then <
36 cat >"$PXE_LOCAL_PATH/$PXE_CONFIG_FILE" <<EOF <
37 set menu_color_normal=white/black <
38 set menu_color_highlight=black/light-gray <
39 set timeout=30 <
40 insmod png <
41 insmod efi_gop <
42 insmod efi_uga <
43 insmod video_bochs <
44 insmod video_cirrus <
45 insmod all_video <
46 <
47 set gfxpayload=keep <
48 insmod gzio <
49 insmod part_gpt <
50 insmod ext2 <
51 <
52 menuentry 'Relax-and-Recover' { <
53 echo 'Loading kernel ...' <
54 linuxefi $OUTPUT_PREFIX_PXE/$PXE_KERNEL <
55 initrdefi $OUTPUT_PREFIX_PXE/$PXE_INITRD <
56 <
57 } <
58 menuentry "Reboot" { <
59 reboot <
60 } <
61 <
62 menuentry "Exit to EFI Shell" { <
63 exit <
64 } <
65 <
66 EOF <
67 else <
68 # legacy way using PXE_LOCAL_PATH default # legacy way using PXE_LOCAL_PATH default
69 cat >"$PXE_LOCAL_PATH/$PXE_CONFIG_FILE" <<EOF cat >"$PXE_LOCAL_PATH/$PXE_CONFIG_FILE" <<EOF
70 $(test -s $(get_template "PXE_pxelinux.cfg") && cat $(get $(test -s $(get_template "PXE_pxelinux.cfg") && cat $(get
71 display $OUTPUT_PREFIX_PXE/$PXE_MESSAGE display $OUTPUT_PREFIX_PXE/$PXE_MESSAGE
72 say ----------------------------------------------------- say -----------------------------------------------------
73 say rear = disaster recover this system with Relax-and-Re say rear = disaster recover this system with Relax-and-Re
74 label rear label rear
75 kernel $OUTPUT_PREFIX_PXE/$PXE_KERNEL kernel $OUTPUT_PREFIX_PXE/$PXE_KERNEL
76 append initrd=$OUTPUT_PREFIX_PXE/$PXE_INITRD root=/de append initrd=$OUTPUT_PREFIX_PXE/$PXE_INITRD root=/de
77 EOF EOF
78 fi <
79 fi fi
80 pushd "$PXE_LOCAL_PATH" >/dev/null pushd "$PXE_LOCAL_PATH" >/dev/null
81 StopIfError "PXE_CONFIG_PATH [$PXE_CONFIG_PATH] does not exis StopIfError "PXE_CONFIG_PATH [$PXE_CONFIG_PATH] does not exis
82 if test "$PXE_CREATE_LINKS" -a "$PXE_REMOVE_OLD_LINKS" ; then if test "$PXE_CREATE_LINKS" -a "$PXE_REMOVE_OLD_LINKS" ; then
83 # remove old links # remove old links
84 find . -maxdepth 1 -type l | \ find . -maxdepth 1 -type l | \
85 while read file ; do while read file ; do
86 if test "$(readlink -s $file)" = "$PX if test "$(readlink -s $file)" = "$PX
87 rm -f $file rm -f $file
88 fi fi
89 done done
90 fi fi
91 # When using Grub network boot via tftp/bootp, # When using Grub network boot via tftp/bootp,
92 # the client is looking at a file named "grub.cfg-01-<MAC>" # the client is looking at a file named "grub.cfg-01-<MAC>"
93 # or grub.cfg-<IP in hex>. It is like PXE, but prefixed with # or grub.cfg-<IP in hex>. It is like PXE, but prefixed with
94 if is_true $PXE_CONFIG_GRUB_STYLE ; then if is_true $PXE_CONFIG_GRUB_STYLE ; then
95 pxe_link_prefix="grub.cfg-" pxe_link_prefix="grub.cfg-"
96 else else
97 pxe_link_prefix="" pxe_link_prefix=""
98 fi fi
99 case "$PXE_CREATE_LINKS" in case "$PXE_CREATE_LINKS" in
100 IP) IP)
101 # look only at IPv4 and skip localhost (127.. # look only at IPv4 and skip localhost (127..
102 ip a | grep inet\ | grep -v inet\ 127 | \ ip a | grep inet\ | grep -v inet\ 127 | \
103 while read inet IP junk ; do while read inet IP junk ; do
104 IP=${IP%/*} IP=${IP%/*}
105 # check if gethostip is available. # check if gethostip is available.
106 if has_binary gethostip &>/dev/null ; then if has_binary gethostip &>/dev/null ; then
107 ln -sf $v "$PXE_CONFIG_FILE" ln -sf $v "$PXE_CONFIG_FILE"
108 # to capture the whole subnet # to capture the whole subnet
109 ln -sf $v "$PXE_CONFIG_FILE" ln -sf $v "$PXE_CONFIG_FILE"
110 else else
111 # if gethostip is not available on your platf # if gethostip is not available on your platf
112 # use awk to generate IP in hex mode. # use awk to generate IP in hex mode.
113 ln -sf $v "$PXE_CONFIG_FILE" $pxe_link_pr ln -sf $v "$PXE_CONFIG_FILE" $pxe_link_pr
114 # to capture the whole subnet as well # to capture the whole subnet as well
115 ln -sf $v "$PXE_CONFIG_FILE" ln -sf $v "$PXE_CONFIG_FILE"
116 fi fi
117 done done
118 ;; ;;
119 MAC) MAC)
120 # look at all devices that have link/ether # look at all devices that have link/ether
121 ip l | grep link/ether | \ ip l | grep link/ether | \
122 while read link mac junk ; do while read link mac junk ; do
123 ln -sf $v "$PXE_CONFIG_FILE" ln -sf $v "$PXE_CONFIG_FILE"
124 done done
125 ;; ;;
126 "") "")
127 Log "Not creating symlinks to pxelinux config Log "Not creating symlinks to pxelinux config
128 ;; ;;
129 *) *)
130 Error "Invalid PXE_CREATE_LINKS specified, mu Error "Invalid PXE_CREATE_LINKS specified, mu
131 ;; ;;
132 esac esac
133 popd >/dev/null popd >/dev/null
134 if [[ ! -z "$PXE_CONFIG_URL" ]] ; then if [[ ! -z "$PXE_CONFIG_URL" ]] ; then
135 LogPrint "Created pxelinux config '${PXE_CONFIG_PREFIX}$H LogPrint "Created pxelinux config '${PXE_CONFIG_PREFIX}$H
136 umount_url $PXE_TFTP_URL $BUILD_DIR/tftpbootfs umount_url $PXE_TFTP_URL $BUILD_DIR/tftpbootfs
137 rmdir $BUILD_DIR/tftpbootfs >&2 rmdir $BUILD_DIR/tftpbootfs >&2
138 if [[ $? -eq 0 ]] ; then if [[ $? -eq 0 ]] ; then
139 RemoveExitTask "rm -Rf $v $BUILD_DIR/tftpbootfs >&2" RemoveExitTask "rm -Rf $v $BUILD_DIR/tftpbootfs >&2"
140 fi fi
141 RESULT_FILES=( "${RESULT_FILES[@]}" ) RESULT_FILES=( "${RESULT_FILES[@]}" )
142 else else
143 LogPrint "Created pxelinux config '${PXE_CONFIG_PREFIX}$H LogPrint "Created pxelinux config '${PXE_CONFIG_PREFIX}$H
144 # Add to result files # Add to result files
145 RESULT_FILES=( "${RESULT_FILES[@]}" "$PXE_LOCAL_PATH/$PXE RESULT_FILES=( "${RESULT_FILES[@]}" "$PXE_LOCAL_PATH/$PXE
146 fi fi
[root@node4 /]#
gdha commented at 2020-04-17 12:02:¶
@ravikumar-c Thanks for the hard work already, but could you prepare a Pull Request for your changes? See http://relax-and-recover.org/development/ for the details on how to contribute.
github-actions commented at 2020-06-26 01:39:¶
Stale issue message
gozora commented at 2020-07-01 17:32:¶
Hello @gdha
@gozora As SEM is this feasible to add in the furture?
Sorry I must have overlooked your question somehow ...
I usually don't use PXE, so I don't have overview about PXE booting
features in ReaR.
Is this issue about problem with booting UEFI system over PXE ?
V.
jsmeix commented at 2020-07-02 15:35:¶
Via
https://github.com/rear/rear/pull/2449
I manually added the additional lines
for PXE UEFI support to 810_create_pxelinux_cfg.sh
from the diff output in the above
https://github.com/rear/rear/issues/2359#issuecomment-615197886
I did not test anything at all because I do not use PXE.
I did only plain code editing so that we have a pull request
as an initial starting point towards getting PXE UEFI support.
jsmeix commented at 2020-07-02 15:47:¶
@rmetrich @pcahyna
could you perhaps have a look here as time permits?
It is about adding UEFI support for PXE booting the ReaR recovery
system.
rmetrich commented at 2020-07-03 06:26:¶
@ravikumar-c It looks like to me that you removed the
console=ttyS0,9600 console=tty0
arguments, is that intentional?
These console arguments should be taken from /proc/cmdline
while
creating the rescue (if there is nothing, then do add anything,
otherwise just copy the args content).
github-actions commented at 2020-09-02 01:34:¶
Stale issue message
[Export of Github issue for rear/rear.]