升级Azure RHEL7.9到8.2子版本

当前RHEL最新版本是8.4,如何将azure机器从RHEL7.9只升级到8.2呢?

和Azure support讨论后发现目前没有啥特别的办法一步到位,只能先将OS升级到最新版本再降级

升级步骤:

-----------------------------------------------------

Upgrade the Azure redhat OS from 7.9 to 8.4

 

1.1)tranfer leapp-data14.tar.gz to Cloud VM.

scp yourid@xx.xx.xx.xx:~/leapp-data14.tar.gz . #here is just an example to tranfer files.

 

yum install leapp leapprepository

yum install leapp-rhui-azure

tar -xzf leapp-data14.tar.gz -C /etc/leapp/files

yum update  #patch the OS to the latest

  

1.2) reboot the VM

1.3) after reboot

检查/etc/fstab,注释所有nfs/cifs的filesystem,等os升级完成之后再改回

leapp answer --section remove_pam_pkcs11_module_check.confirm=True --add
rmmod pata_acpi floppy #redhat 8不支持这两个driver,需要手动卸载

 

leapp preupgrade --no-rhsm

leapp upgrade --no-rhsm

  

 

1.4) reboot the VM

 

--------------------------------------------------------

 

Downgrade the OS from 8.4 to 8.2

2.1) install 8.2 redhat release

rpm -qa |grep redhat-release

cat /etc/os-release

yum install redhat-release-8.2  redhat-release-eula-8.2 -y

rpm -qa |grep redhat-release

cat /etc/os-release

  

 

2.2) lock the minor version to 8.2 and switch VM to using EUS repository

 

yum -y --disablerepo='*' remove 'rhui-azure-rhel8'

wget https://rhelimage.blob.core.windows.net/repositories/rhui-microsoft-azure-rhel8-eus.config

yum -y --config=rhui-microsoft-azure-rhel8-eus.config install rhui-azure-rhel8-eus

echo 8.2 > /etc/yum/vars/releasever

cat /etc/yum/vars/releasever #ensure the value is 8.2

  

 

2.3)  Update the OS patch to latest

yum update

  

 

2.4) reboot the VM

这一步是为了让Azure portal上的OS版本同步到8.2,否则它会显示8.4.

 

 

 

遇到问题:

 

1) can not create folder

 

====> * target_userspace_creator

        Initializes a directory to be populated as a minimal environment to run binaries from the target system.

Process Process-383:

Traceback (most recent call last):

  File "/usr/lib64/python2.7/multiprocessing/process.py", line 258, in _bootstrap

    self.run()

  File "/usr/lib64/python2.7/multiprocessing/process.py", line 114, in run

    self._target(*self._args, **self._kwargs)

  File "/usr/lib/python2.7/site-packages/leapp/repository/actor_definition.py", line 72, in _do_run

    actor_instance.run(*args, **kwargs)

  File "/usr/lib/python2.7/site-packages/leapp/actors/__init__.py", line 335, in run

    self.process(*args)

  File "/usr/lib/python2.7/site-packages/leapp/utils/deprecation.py", line 42, in process_wrapper

    return target_item(*args, **kwargs)

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/targetuserspacecreator/actor.py", line 43, in process

    userspacegen.perform()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/actors/targetuserspacecreator/libraries/userspacegen.py", line 475, in perform

    xfs_info=indata.xfs_info) as overlay:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 217, in create_source_overlay

    with _build_overlay_mount(root_overlay, mounts) as overlay:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 87, in _build_overlay_mount

    with _build_overlay_mount(root_mount, mounts) as mount:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 87, in _build_overlay_mount

    with _build_overlay_mount(root_mount, mounts) as mount:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 87, in _build_overlay_mount

    with _build_overlay_mount(root_mount, mounts) as mount:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 87, in _build_overlay_mount

    with _build_overlay_mount(root_mount, mounts) as mount:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 87, in _build_overlay_mount

    with _build_overlay_mount(root_mount, mounts) as mount:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 87, in _build_overlay_mount

    with _build_overlay_mount(root_mount, mounts) as mount:

  File "/usr/lib64/python2.7/contextlib.py", line 17, in __enter__

    return self.gen.next()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/overlaygen.py", line 86, in _build_overlay_mount

    target=os.path.join(root_mount.target, current.lstrip('/'))):

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/mounting.py", line 340, in __enter__

    self.mount()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/mounting.py", line 315, in mount

    self._create()

  File "/usr/share/leapp-repository/repositories/system_upgrade/el7toel8/libraries/mounting.py", line 323, in _create

    raise MountError('Failed to create mount target directory {}'.format(directory), str(e))

MountError: Failed to create mount target directory /var/lib/leapp/scratch/mounts/root_/system_overlay/opt/shared

 

 

=========================================================================================================

Actor target_userspace_creator unexpectedly terminated with exit code: 1 - Please check the above details

=========================================================================================================

  

 

 

解决办法:注释/etc/fstab 中 /opt/shared 一行,重启Vm

 

 

2) read-only filesystem

 

STDERR:

Failed to create directory /var/lib/leapp/el8userspace//sys/fs/selinux: Read-only file system

Failed to create directory /var/lib/leapp/el8userspace//sys/fs/selinux: Read-only file system

No matches found for the following disable plugin patterns: subscription-manager

Warning: Packages marked by Leapp for install not found in repositories metadata: python3-javapackages ivy-local

Warning: Packages marked by Leapp for upgrade not found in repositories metadata: gpg-pubkey

RPM: warning: Generating 6 missing index(es), please wait...

Error: Transaction test error:

  file /usr/lib64/.libcrypto.so.1.1.1g.hmac from install of openssl-libs-1:1.1.1g-15.el8_3.x86_64 conflicts with file from package openssl11-libs-1:1.1.1g-3.el7.x86_64

  file /usr/lib64/.libssl.so.1.1.1g.hmac from install of openssl-libs-1:1.1.1g-15.el8_3.x86_64 conflicts with file from package openssl11-libs-1:1.1.1g-3.el7.x86_64

  file /usr/lib64/engines-1.1/afalg.so from install of openssl-libs-1:1.1.1g-15.el8_3.x86_64 conflicts with file from package openssl11-libs-1:1.1.1g-3.el7.x86_64

  file /usr/lib64/engines-1.1/capi.so from install of openssl-libs-1:1.1.1g-15.el8_3.x86_64 conflicts with file from package openssl11-libs-1:1.1.1g-3.el7.x86_64

  file /usr/lib64/engines-1.1/padlock.so from install of openssl-libs-1:1.1.1g-15.el8_3.x86_64 conflicts with file from package openssl11-libs-1:1.1.1g-3.el7.x86_64

  file /usr/lib64/libcrypto.so.1.1.1g from install of openssl-libs-1:1.1.1g-15.el8_3.x86_64 conflicts with file from package openssl11-libs-1:1.1.1g-3.el7.x86_64

  file /usr/lib64/libssl.so.1.1.1g from install of openssl-libs-1:1.1.1g-15.el8_3.x86_64 conflicts with file from package openssl11-libs-1:1.1.1g-3.el7.x86_64

 

 

 

============================================================

                       END OF ERRORS

============================================================

  

 

解决办法 : yum remove openssl11-libs #卸载openssl-libs  ,OS升级完成之后,openssl-lib它会自动装回去

 

 

3)  升级成功之后,OS无法启动,enable "boot diagnostics"之后os进入“emergency mode”

 

解决办法: portal restart VM,之后进入os,注释掉所有/etc/fstab 中nfs/cifs的挂载点

参考redhat KB https://access.redhat.com/solutions/5535971

 

参考链接:

https://docs.microsoft.com/en-us/azure/virtual-machines/workloads/redhat/redhat-in-place-upgrade

https://access.redhat.com/articles/3664871

posted @ 2021-10-23 10:54  夏覓  Views(367)  Comments(0Edit  收藏  举报