In a minimal CentOS for example, if you set the run level to 5 the system will hand during boot. This is because no GUI is installed. In order to fix this you can insert the CentOS minimal installation media and select recovery.
Once in recovery you will need to mount the system image:
chroot /mnt/sysimage
now edit the startup config
vi /etc/inittab
select [insert] to edit the file and update the line to read as follows:
id:3:initdefault:
[esc] key then
:wq
now reboot the system
exit
now select reboot and the system should come back up in run level 3