Virtualbox and Centos/Redhat no GUI fix

coffee

Well-Known Member
Reaction score
1,832
Location
United States
Posting this for others that may be having this issue causing grief.

CentOS7 when installed in VB installs just fine. However, You will find that Guest Additions will not compile/install. What is worse, After you perform an update and reboot you are left with a black screen and no GUI.

Here are the steps needed ( in order) to fix this issue:

1. Install CentOS as a guest in VB.

2. Get all your updates but do not reboot when complete:

yum update -y

3. Change the boot option to boot to multi-user mode - no gui

systemctl set-default multi-user.target

4. Reboot and login as root.

5. Install kernel-devel

yum install kernel-devel -y

6. Mount the Guest Additions iso and run the installer.

7. After the installer finishes change back to graphical mode booting.

systemctl set-default graphical.target

8. Reboot system

shutdown -r now

You should now have a GUI after rebooting and you can login. The reason GA does not compile is because the variable $KERN_DIR does not get set for the current kernel source. The reason it does not get set is because installing kernel-devel and headers causes a mismatch in the kernel name and thus GA cannot find your kernel source. Even if you did find the correct kernel-devel and headers they will not install as it appears for some reason they are black listed. No idea why there.

coffee
 
  • Like
Reactions: GTP
I want to also add, If your in a fix because you already did an update and rebooted to a black screen then ssh into the box from the host system and perform the steps that way.
 
  • Like
Reactions: GTP
Posting this for others that may be having this issue causing grief.

CentOS7 when installed in VB installs just fine. However, You will find that Guest Additions will not compile/install. What is worse, After you perform an update and reboot you are left with a black screen and no GUI.

Here are the steps needed ( in order) to fix this issue:

1. Install CentOS as a guest in VB.

2. Get all your updates but do not reboot when complete:

yum update -y

3. Change the boot option to boot to multi-user mode - no gui

systemctl set-default multi-user.target

4. Reboot and login as root.

5. Install kernel-devel

yum install kernel-devel -y

6. Mount the Guest Additions iso and run the installer.

7. After the installer finishes change back to graphical mode booting.

systemctl set-default graphical.target

8. Reboot system

shutdown -r now

You should now have a GUI after rebooting and you can login. The reason GA does not compile is because the variable $KERN_DIR does not get set for the current kernel source. The reason it does not get set is because installing kernel-devel and headers causes a mismatch in the kernel name and thus GA cannot find your kernel source. Even if you did find the correct kernel-devel and headers they will not install as it appears for some reason they are black listed. No idea why there.

coffee



Thank you for the heads up just in case I need to deal with CentOS 7 in the future.
 
Back
Top