Category Archives: Linux

Adding graphical logins to a text only system.

I often find myself in a situation where I have an already installed Linux box, and want to add for graphical logins. This may be because I have installed from the Fedora server DVDs (which no longer include graphical logins), or because I am using a discless Fedora machine installed by following these instructions.

During a normal graphical installation process, the installer will probe your hardware and install the correct drivers for your video card, however if you are adding Xorg to an existing installation then you no longer have that option and need to perform some steps manually

  1. Firstly, use dnf to install Gnome.

dnf groupinstall gnome
On a Fedora 23 basic install, this would install an additional 706 packages.

  1.  We now need to identify the video card.

dnf install pciutils
lspci | grep VGA

  1. Find the correct driver for your video card, the following will list all drivers in your repo.

dnf list xorg-x11-drv*
Then install the one that looks as if it will match your video card (sometimes you can ignore this step and use the generic VGA drivers, although performance may suffer).
dnf install xorg-x11-drv-vesa

  1. I found that I had to install a couple of additional packages

dnf install mesa-libGL mesa-dri-drivers xorg-x11-drv-evdev xorg-x11-drv-fbdev

  1. You should now be able to test your setup by running

When finished, simply log out of the graphical console.
If this does not work, then you will need to look at the logfiles in /var/log/Xorg* for clues as to what has gone wrong.

  1. You can now start gdm to check whether the login prompt is working

systemctl start gdm

  1. If the above doesn’t work, sometimes I have found that I need to disable “Wayland”.

This is done by editing vi /etc/gdm/custom.conf and deleting the ‘#’ at the start of the line WaylandEnable=false Then try starting gdm again.

  1. Once this is all working, you can set it to run by default on system boot.

ln -fs /lib/systemd/system/ /etc/systemd/system/

  1. You should now be able to reboot and login graphically. Once logged in, setup the monitor arrangement (i.e. if you have multiple monitors, then ensure that they are in the correct order)
  1. If the monitor order is incorrect at the initial login prompt, then copy your user’s monitor config to the system default.

cp ~/.config/monitors.xml /var/lib/gdm/.config

Fedora Discless Netboot Install

Have you ever wanted to run a discless Linux box? Maybe, like me, you have a Windows PC for someone else in the family that you want to run Linux on, you might want to take advantage of an existing backed-up RAID array and avoid additional hard discs, or you might simply want a cheaper or quieter PC.

Most PCs these days have a BIOS that supports PXE booting, this will allow you to boot a simple file from a server. Linux has an amazing feature where you can create a kernel and initrd (initial ramdisc) which can be booted via PXE, which will then start your system up using an NFS share as the root filesystem with no need for local storage at all.

There are various HOWTOs on the ‘net explaining this, however these all seemed to make two assumptions that caused me problems…

  1. They basically involved installing to a local hard disc, then copying the image onto a server
  2. They assumed that everything (client and server) was running exactly the same distribution version

Now I intended to create a few of these and didn’t want to be stuffing around with hard discs all the time, plus I’m a bit of a purist in some ways and wasn’t keen on installing temporary hard discs just for installation if there was a better way. I also had the issue that all my servers were running 64 bit versions, whereas my clients were only capable of 32 bit. In addition, since I was planning to do a few of these I wanted to use a local (on my home LAN) Yum repository to reduce bandwidth usage and to speed up the installs.

So, here is my step-by-step procedure for installing and running a discless Fedora system (I used Fedora 19) with a custom repository, with different architecture between server and client, and without any temporary client hard discs. You will need to be logged in as root for at least some of these steps.

  1. Create a new directory on the server for the root filesystem of the remote client. I called mine “remoteFamily”
  2. mkdir /mnt/remoteFamily
    cd /mnt/remoteFamily

  3. Create a repository location in the server’s /etc/yum.repos.d/ directory. I called mine “fedora32-local” as it was a 32bit repository (as opposed to the server’s usual 64bit one). This new repository configuration should have “enabled=0” to stop the server from using it.
  4. less /etc/yum.repos.d/fedora32.repo

  5. Now use yum to install @core (which is basically a minimal installation) from only the 32bit repository and using /mnt/remoteFamily as the root directory.
  6. yum --installroot=/mnt/remoteFamily --disablerepo=* --enablerepo=fedora32-local install @core

  7. Now that we have a minimal install (including yum repo config) yum will use the client’s repository configuration, so we need to copy the config for the local repo to the client’s yum config directory.
  8. cp /etc/yum.repos.d/fedora32.repo /mnt/remoteFamily/etc/yum.repos.d/

  9. Now to install a few items which are critical for NFS root systems…
    NFS itself.
    yum --installroot=/mnt/remoteFamily --disablerepo=* --enablerepo=fedora32-local install nfs-utils
    Dracut for creating the initial ramdisc images for booting.
    yum --installroot=/mnt/remoteFamily --disablerepo=* --enablerepo=fedora32-local install dracut-network
    And the kernel.
  10. yum --installroot=/mnt/remoteFamily --disablerepo=* --enablerepo=fedora32-local install kernel

  11. Create an /etc/fstab file with a reference to the nfs root directory on the server. This is used by dracut later on to link what is mounted on bootup, so it is very important that this is correct. If this changes, you will need to re-run dracut and copy the new initrd onto the tftp server
  12. vi etc/fstab
    This should contain something like… / nfs defaults 1 1

  13. Enable the root user (with no password) by deleting the “x” between the colons
  14. vi etc/shadow

  15. Disable SELinux by changing to “disabled” in the config file.
  16. vi etc/sysconfig/selinux

  17. OK, now chroot to the client’s root so that kernel and modules are able to be found in their final locations, and you can set passwords
  18. chroot /mnt/remoteFamily

  19. Create the ramdisc image. Note that we explicitly define the kernel image, otherwise the server’s currently running kernel would be used. If you used a different version of Fedora then you will need to look in /boot to find which kernel version to use (they start with “vmlinuz”).
  20. dracut --filesystems nfs -H --fstab -f /boot/initramfs-3.9.5-301.fc19.i686.img 3.9.5-301.fc19.i686

  21. Set root’s password.
  22. passwd

  23. Disable a couple of services that cause difficulty when you are using NFS as root.
  24. systemctl disable firewalld.service
    systemctl disable NetworkManager.service

  25. Exit from the chroot
  26. exit

  27. copy the kernel and initrd to server, don’t forget chmod444
  28. Now the client should be able to boot up.

Once the client has booted you will get a plain old command line login prompt, you should be able to log in and then install more packages as you would with a “normal” installation.
A couple of (in my opinion) packages that are essential, but aren’t in the minimal install.

  • Net-Tools (such as ifconfig)
    yum install net-tools
  • Mlocate (with the “locate” and “updatedb” programs)
    yum install mlocate

Now, if you want to install X with graphical logins, follow the instructions Here.