十三、openGauss适配BCLinux欧拉版

时间:2020-12-28 00:54:46

一、简介

BCLinux for Euler是中国移动云基于openEuler社区版本的再发型版本
继承了欧拉社区自主可控、丰富的产业生态、全堆栈技术优化、鲲鹏CPU能力等优势

二、欧拉版本openGauss安装问题

1、bclinux版本
BigCloud Enterprise Linux For Euler 21.10 (GNU/Linux 4.19.90-2107.6.0.0100.oe1.bclinux.x86_64 x86_64)

2、使用欧拉版本openGauss初始化报错
./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml
"Traceback (most recent call last):
File "./gs_preinstall", line 40, in <module>
from gspylib.common.Common import DefaultValue
File "/opt/software/openGauss/script/gspylib/common/Common.py", line 101, in <module>
from os_platform.UserPlatform import g_Platform
File "/opt/software/openGauss/script/os_platform/UserPlatform.py", line 67, in <module>
g_Platform = UserPlatform().userPlatform
File "/opt/software/openGauss/script/os_platform/UserPlatform.py", line 50, in __init__
SUPPORT_WHOLE_PLATFORM_LIST))
Exception: [GAUSS-51900] : The current OS is not supported.Supported platforms are: ['suse', 'redhat', 'centos',
'euleros', 'openeuler', 'kylin', 'fusionos', 'asianux', 'debian', 'ubuntu']."

3、操作系统检测
vi /opt/software/openGauss/script/os_platform/linux_distro.py
try:
etc_dir = os.listdir('/etc')
except os.error:
# Probably not a Unix system
return distname, version, idNum
etc_dir.sort()
gFile = None
_release_filename = re.compile(r'(\w+)[-_](release|version)')
for file in etc_dir:
if os.path.islink('/etc/' + file):
continue
m = _release_filename.match(file)
if m is not None:
_distname, dummy = m.groups()
if _distname in supported_dists:
gFile = file
distname = _distname
break
大概流程是查找/etc下带release或者version关键字结尾的文件,
for循环去除掉软链接文件
获取文件名(比如openEuler-release)中前半部分然后和supported_dists中的适配

4、查找supported_dists
vi /opt/software/openGauss/script/os_platform/common.py
_supported_dists = (
'SuSE', 'debian', 'fedora', 'redhat', 'centos', 'euleros', "openEuler",
'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo',
"FusionOS", 'UnitedLinux', 'turbolinux', 'ubuntu', 'kylin', 'asianux')

5、查看服务器
[root@gsdb1 opt]# ll /etc/|grep -E 'release$|version$'
-rw-r--r--. 1 root root 60 Dec 2 2021 bclinux-release
lrwxrwxrwx. 1 root root 15 Dec 2 2021 openEuler-release -> bclinux-release
-rw-r--r--. 1 root root 170 Dec 2 2021 os-release
lrwxrwxrwx. 1 root root 15 Dec 2 2021 redhat-release -> bclinux-release
lrwxrwxrwx. 1 root root 15 Dec 2 2021 system-release -> bclinux-release
排除掉软链接文件
bclinux-release、os-release
可以看到bclinux、os无法在_supported_dists中找到

6、解决办法
rm -f /etc/openEuler-release #将软链接删掉
cp /etc/bclinux-release /etc/openEuler-release #直接拷贝一份

7、重新初始化不再报错
./gs_preinstall -U omm -G dbgrp -X /opt/software/openGauss/clusterconfig.xml