[CentOS] Upgrading CentOS from 7 to 8

Wed Sep 29 16:21:11 UTC 2021
Young, Gregory <gregory.young at n-able.com>

The way we did in place upgrades from CentOS 6 to 7 for our network appliance VMs:

1. Take a backup of our appliance (database, settings, uploads, etc.). Store the backup on a separate partition/volume.
2. Copy the CentOS 7 Minimal .iso, with our added packages, to the backup partition/volume (disk.iso in the below code).
3. Copy the initrd and vmlinuz images to the boot partition (cp loop/isolinux/vmlinuz loop/isolinux/initrd.img /boot/).
4. Backup the current GRUB config (cp /boot/grub/grub.conf /boot/grub/grub.conf.bakupgrade).
5. Copy our custom kickstart file to the boot partition/volume.
6. Drop the upgrade GRUB menu config on the boot partition/volume.

```
default=0
timeout=0
serial --unit=0 --speed=9600
terminal --dumb --timeout=5 serial console

title upgrade
    root (hd0,0)
    kernel  vmlinuz rd.lvm=1 rd.md=1 inst.ks=hd:/dev/${disk_device}1://ks.cfg inst.repo=hd:/dev/mapper/VolGroup-lv_backup://disk.iso inst.sshd inst.cmdline inst.noninteractive inst.noshell inst.headless net.ifnames=0 selinux=0 ip=dhcp ksdevice=eth0 vga=792 modprobe.blacklist=floppy consoleblank=0 biosdevname=0 console=tty0 console=ttyS0,115200n8
    initrd initrd.img
```

${disk_device} can be found using:

```
disk_device=$(lsblk | grep disk | grep -e '^[h,s,v]da' -e 'xvda' -e 'nvme0n1' | awk '{print $1}' | head -1)
```

I can't guarantee the LVM route will work with CentOS 8, we had to use CentOS 7.3's LiveOS image to do this, as after that version the ability to access the .iso on a LVM disappeared (I think it was an unintended feature of 7.3 and older).



Gregory Young | Senior Developer/Systems Engineer | N-able
 

On 2021-09-29, 09:25, "CentOS on behalf of Gestió Servidors" <centos-bounces at centos.org on behalf of sysadmin.caos at uab.cat> wrote:

    [EXTERNAL] This email originated from outside of the organization.


    Hi,

    I'm doing some tests of upgrading CentOS from 7 to 8 reading this step-by-step guide: https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fnetshopisp.medium.com%2Fhow-to-upgrade-linux-servecentos-7-to-centos-8-ec2db96a189b&data=04%7C01%7Cgregory.young%40n-able.com%7C72def1d48a9046040eaa08d9834c7835%7C6324f4fb86ee4493ba16c819a916b487%7C1%7C0%7C637685187277163526%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=OkhDdiT29HzHE62C6AdI26qJ2f2YtCC9p0rH4vUbwuo%3D&reserved=0

    I'm trying this upgrade in a VM, so I can save "snapshots" and restart in a past saved point. However, all my test ends wrong, exacly in Step 4 when I run "rpm -e `rpm -q kernel`". Then, systems says that some packages are kernel dependencies. After I remove that dependencies, I can't remove kernel...

    Anybody has tested process upgrade from 7 to 8?

    Thanks.

    _______________________________________________
    CentOS mailing list
    CentOS at centos.org
    https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.centos.org%2Fmailman%2Flistinfo%2Fcentos&data=04%7C01%7Cgregory.young%40n-able.com%7C72def1d48a9046040eaa08d9834c7835%7C6324f4fb86ee4493ba16c819a916b487%7C1%7C0%7C637685187277163526%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=mXQC8YkeryzsXiyn1ZC1s5V8RSrO28dByWkaigFWCxU%3D&reserved=0