服务器需要迁移上阿里云,有几台服务器用的是Redhat 5.x,在使用SMC进行迁移时出现以下报错.
[2023-12-13 09:50:55] [Error] Check System Info Failed, code=S16_111, msg=Get OS Info Failed: [error] grub is too old for CentOS/Red Hat 5, please upgrade to grub 1.99 or higher. FAILED
[2023-12-13 09:50:55] [Warn] Goto Aliyun Not Finished! See Details Info In Log File [/root/smc/go2aliyun_client2.7.3_linux_x86_64/Logs/go2aliyun_client_20231213.log].
Get More Help From Online Docs:
(Chinese) https://help.aliyun.com/product/121538.html
(International) https://www.alibabacloud.com/help/product/121538.htm
You Can Try Again After The Problem Is Solved.
Exit...
根据报错内容显然是由于我们的grub版本低于1.99,看来是要升级grub
查看了下阿里的手册,同样需要将Kernel升级到2.6.18-398
看下我们现在的版本
[root@localhost ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
[root@localhost ~]# grub --version
grub (GNU GRUB 0.97)
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
名称 | 现在版本 | 升级后版本 |
---|---|---|
grub | 0.97 | 1.99 |
Kernel | 2.6.18-308 | 2.6.18-398 |
flex | 无 | 2.6.4 |
mkdir /root/smc
cd /root/smc
依次下载以下4个软件,并上传到服务器/root/smc目录.rhel5的openssl版本过低直接wget会报错.
Kernel补丁包
https://vault.centos.org/5.11/os/x86_64/CentOS/kernel-2.6.18-398.el5.x86_64.rpm
flex安装包
https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
grub安装包
https://alpha.gnu.org/gnu/grub/grub-2.02~rc1.tar.gz
阿里SMC
https://p2v-tools.oss-cn-hangzhou.aliyuncs.com/smc/go2aliyun_client_linux_x86_64.tar.gz?spm=5176.smc-next_import-source-server.0.0.2fcd18e6KUtfYE&file=go2aliyun_client_linux_x86_64.tar.gz
rpm -ivh ./kernel-2.6.18-398.el5.x86_64.rpm
mv /sbin/grub /sbin/grub-old
mv /sbin/grub-install /sbin/grub-install-old
mv /sbin/grub-mkconfig /sbin/grub-mkconfig-old
yum install -y bison gcc make
tar xzf flex-2.6.4.tar.gz
cd flex-2.6.4
./configure
make -j4 && make install
ln -s /usr/local/bin/flex /usr/bin/flex
cd ..
tar xzf grub-2.02_rc1.tar.gz
cd grub-2.02~rc1/
./configure
sed -i -e "s/-Werror//" ./grub-core/Makefile
sed -i -e "s/-Werror//" ./Makefile
make && make install
ln -s /usr/local/sbin/grub-install /sbin/grub-install
ln -s /usr/local/sbin/grub-mkconfig /sbin/grub-mkconfig
grub-install --version
grub-mkconfig -o /boot/grub/grub.cfg
grub-install --no-floppy --modules=part_msdos --boot-directory=/boot /dev/sda
grep menuentry /boot/grub/grub.cfg
确认3处红框内容和截图一致
写入grub重启选择,如果不在这个位置将0改为1,2,3…其他次序的数字
mkdir -p /usr/local/etc/default/
echo "GRUB_DEFAULT=0" > /usr/local/etc/default/grub
reboot
cd smc/
tar xf go2aliyun_client_linux_x86_64.tar.gz
cd go2aliyun_client2.7.3_linux_x86_64/
chmod +x go2aliyun_client
./go2aliyun_client