Fedora Core 18 chroot install on existing LVM/dmraid

Needless to say Fedora 18’s Anaconda installer is quite… buggy and unable to reuse existing partitions. Add some more bugs in the kickstart support for existing raid arrays, and you end up with an totally uninstallable distro on non standard configuration.

Boot the livecd version, and (create if needed) mount, ready the target partitions.
Mount the root partition

Note: Grub2 with lvm & dmraid will need some more space than the usual first 63 blocks. Check the beginning of your first partition and move the beginning if needed (fdisk, expert, b, 2048 for example). Note that operation will destroy the first partition. (supposely /boot for careful people)

yum --installroot=/mnt/target --releasever 18 group install "Minimal Install"
From this point, you have all the packages for a working system, except it can’t boot (but valid for chroot or containers environment).

To make your system boot, add a kernel image and grub, lvm and mdadm tools.
It is base rpm support, so you’ll also need yum. Add the yum_langpacks plugin if you’re going to support another locale.
yum --installroot=/mnt/target --releasever 18 install yum kernel grub mdadm lvm2 yum_langpacks

Copy the current live fstab for base, and edit it according to your configuration
cp /etc/fstab /mnt/target/etc/fstab
vi /mnt/target/etc/fstab

Ready your chroot environment, and chroot in your new distro root
for i in dev sys proc; do mount -o bind /$i /mnt/target/$i; done
chroot /mnt/target

Then make the minimal changes and LVM cache generation/RAID configuration to bring a bootable configuration.
passwd root
vi /etc/mdadm.conf
vgscan
grub-mkconfig -o /boot/grub2/grub.conf
kernelver=`rpm -qa kernel | sed 's/kernel-//'`
dracut /boot/initramfs-${kernelver}.img ${kernelver}

For selinux, you may also want to disable selinux, at least for 1st boot (files are not labeled).
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/sysconfig/selinux
touch /.autorelabel

Don’t forget to update the bootloader of your drives if the current one isn’t grub 2.0 or misses core img with lvm/dm support
grub2-install /dev/sda

Now your system is ready to boot.
exit; umount /mnt/target/*; umount /mnt/target; reboot

At grub prompt, if you didn’t disable selinux yet, append selinux=0 to the kernel command line.

Your system should be now in console mode.
Note: Keyboard is using “us” keymap.

You may now want to configure locale, hostname, network, keyboard, time.
Due to dbus requirements, locale changes through *ctl tools can’t be done earlier.

Install support for any other locale (ex: fr)
yum langinstall fr

In no particular order, you may want to use these tools and update configuration files (see the according man pages).
system-config-date
system-config-keyboard
/etc/vconsole.conf
/etc/locale.conf
localectl
hostnamectl

You might be stuck with localectl not setting up correctly the Xorg keymap (used by display manager lightdm or xfce).
You’ll need to use the full keymap model syntax.
Example for the FR locale:
set-x11-keymap fr pc105 oss

Example localectl output on a fully configured system:
System Locale: LANG=fr_FR.UTF-8
VC Keymap: fr
X11 Layout: fr
X11 Model: pc105
X11 Variant: oss

You can also force yum to install some other locales support by editing the langpack plugin config:
/etc/yum/pluginconf.d/langpacks.conf

From here, everything should be set up. If you want a desktop, install the whole group.
groups can be listed:
yum group list
Ex: for a full MATE desktop (display manager will be lightdm)
yum group install "MATE Desktop"
systemctl restart lightdm

Done :)

Leave a Reply