Countless times I've reinstalled Windows 8, Ubuntu and Arch, so I'm writing myself a little notes section on how I can repeat it. This may not work for your hardware. Obviously filesystem work carries the risk (read consequence) of losing all of your files; I make no guarantee of these instructions and take no responsibility for your actions.
Days wasted tell me that the Windows installation disk I have doesn't even support UEFI. So we install Windows in BIOS mode and then perform fs voodoo to convert it to a UEFI installation.
-
Install Windows in Legacy Mode: This one is easy; you have no choice. Partitions can be created from within the installer itself. I like to give 150G to the Windows partition. The installation results in two legacy primary partitions; one 350 mb with offset 1024, and one installation partition ~150g.
-
Convert to UEFI mode: This article from social.technet.microsoft.com wiki by Crlos J S A helped immensely, but in case it ever goes down:
-
Have the installation disk handy, boot into Win 8 and check that you are, indeed, in Legacy mode by running msinfo32.
-
Open a terminal and run
diskpart list diskto find the name of the disk (corresponds to drive, not partition) with the Windows installation on it---if only using one drive, this is Disk 0.
-
Download and unzip gptgen, then run
gptgen.exe -w \\.\physicaldrive0replacing 0 with your drive, if need be. Be prepared for BSOD at this point.
-
Boot into installation disk and get to the command prompt:
Repair Your Computer > Troubleshoot > Advanced > Command Prompt
-
Delete the MBR partition using diskpart:
diskpart list diskSelect the Windows directory drive:
select disk 0 list partitionSelect and delete the MBR partition (350 mb, 1024 kb offset, usually Partition 1):
select partition 1 delete partition -
Create the new partitions:
create partition EFI size=100 offset=1 format quick fs=fat32 label="System" assign letter=S create partition msr size=128 offset=103424 -
Mount the Windows installation partition
list volumeSelect the Windows installation volume (the larger one)
select volume 3 assign letter=C -
Exit and regenerate the boot partition data:
exit bcdboot c:\windows /s s: /f UEFI
-
-
Update Windows to 8.1 to avoid overwriting grub later.
- Upgrade to Windows 8.1 by going to the store and downloading it. It will install and update automatically, rebooting in the process. [~2.5 hrs]
- Upgrade Windows and sync steam library and configs.
- Install and sync firefox, emacs, gimp, flash, java, vlc, libreoffice, dropbox, [etc.].
- Check all settings in menu.
- Install steam and nvidia, upgrade and download overnight.
-
Configure Windows for dual booting with Linux
-
Disable fast boot; go to Control Panel > Power Options > Choose what the power buttons do, click
settings that are currently unavailable, and removeTurn on fast startup (recommended). -
Disable secureboot through the BIOS
-
[Set Windows HW clock to UTC](Set Windows to ) using regedit; change
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversalto a DWORD of hexadecimal value 1.
-
-
Resize the Windows partition from within Windows itself to avoid shifting unmoveable files.
- Open up
diskmgmt.mscand use it to cut down the Windows partition. - Use defrag to move files around to make this more productive.
- If all else fails, you can try reinstalling Win8 onto a pre-partitioned drive, or just force the partition resize from linux at a risk (try the latter before the former).
- Open up
I've figured out pretty much everything on Ubuntu on Arch and haven't touched it since, and the Ubuntu USB won't boot anyway, so we'll go straight to Arch. Suffice it to say if you already have an Ubuntu installation, installing Arch from that is simpler than through USB. The rest of this section covers the Arch Beginner's Guide in less detail, so you're better off following that.
-
Prepare the Arch medium
- Download a copy of the arch distribution you want. Download to the same folder and from the same source the gpg key (*.iso.sig).
- After both files are downloaded, check that the gpg key of the iso downloaded from the mirror matches the central archlinux gpg key with
gpg --verify [*].iso.sigafter adding the author's signature with
gpg --recv-keys [key id from gpg --very output]- Prepare the USB to be sacrificed and unmount it, run
lsblkto make sure you know its name (/dev/sd*). Now, copy the iso onto the USB withddandsync. Note: Don't put /dev/sdb1, just /dev/sdb.
sudo dd if=archlinux-[*].iso of=/dev/sd* bs=4M && syncNote that there is no output, be patient.
- Boot the USB key with the appropriate BIOS settings (UEFI ON). There are two entries for the USB, and one of them is UEFI (the one that you wouldn't choose first). Make sure you're booted with EFI enabled by checking that
/sys/firmware/efi/efivarsexists.
-
Install Arch from USB.
- Run
modprobe efivarfs-
Then set up an internet connection using standard methods (eg, wifi-menu)
-
Ensure clock accuracy:
timedatectl set-ntp true-
Set up the partitions, including swap, /, and possibly home, using parted or fdisk.
-
mkfs.ext4andmkswap->swaponthe appropriate partitions, then mount root:
mount /dev/sd?? /mnt- Mount the EFI System directory on /mnt/boot:
mkdir -p /mnt/boot mount /dev/sd?? /mnt/boot- Choose a mirror:
nano /etc/pacman.d/mirrorlist- Install base and some other things (Note: if installing on an EFI with a previous Arch installation, remove /mnt/boot/vmlinuz-linux):
pacstrap -i /mnt base base-devel iw wpa_supplicant dialogThis is a good step to leave overnight.
- Save fstab with
genfstab -U /mnt > /mnt/etc/fstab- Finally, chroot into the system with
arch-chroot /mnt /bin/bash -
Making it bootable
- Now,
mount -t efivarfs efivarfs /sys/firmware/efi/efivars- Set regional settings by editing
/etc/locale.gen, then generate withlocale-gen. Finally,
echo LANG=en_US.UTF-8 > /etc/locale.conf- Set the timezone with
ln -sf /usr/share/zoneinfo/*Zone*/*Subzone* /etc/localtimefrom
/usr/share/zoneinfo, then runhwclock --systohc --utc-
Create your hostname and
>it to/etc/hostname, likewise updating/etc/hostsfor both entries (IP.IP.IP.IP [myhostname].localdomain [myhostname]). -
Set the root password with
passwd -
Configure a bootloader (grub)
pacman -S grub efibootmgr os-prober grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub --recheck grub-mkconfig -o /boot/efi/EFI/GRUB/grub.cfg(Note: this didn't work this time, had to run
grub-install --efi-directory=/boot --bootloader-id=[id] --recheck /dev/sda grub-mkconfig -o /boot/grub/grub.cfg) When W10 inevitable overwrites grub, I got a "no space left on disk" error or "ioctl invalid" or something, for which I had to run
grub-install --efi-directory=/boot --bootloader-id=[id] --target=x86_64-efi --removableas per some internet thread I'll link if I find.
Note: Turns out kernel updates are installed to /boot, so it's probably a good idea to set /boot as the mount point? This means mounting /dev/sda1 (esp partition) to /boot directly, rather than /boot/efi (which would require copying the initramfs and vmlinuz files over to /boot/efi from /boot whenever there is a kernel update). See this helpfule thread.
- Crossing fingers, reboot!
-
Configure
- Add a user
groupadd {ssh,wireshark,tty} useradd -mG sys,disk,lp,wheel,uucp,http,video,audio,optical,storage,scanner,power,users,ssh,tty,lock,printadmin,wireshark [username]-
Install yaourt
-
Install some things
yaourt --noconfirm -S xorg-server i3 i3-gaps-git libreoffice emacs vlc firefox pipelight wireshark-qt thunar rxvt-unicode transmission-qt reflector wget tree gimp xsane youtube-dl zip ttf-amiri ttf-computer-modern-fonts ttf-dejavu ttf-droid ttf-freefarsi ttf-freefont ttf-iran-nastaliq ttf-liberation ttf-mathtype ttf-ms-win8 ttf-irfonts ttf-borna ttf-x2 ttf-qurancomplex-fonts ttf-sil-scheherazade tor tor-browser-en texlive-fontsextra texlive-bibtextra texlive-humanities texlive-latexextra texlive-langextra texlive-science texlive-biblatexextra sudo spotify sshfs skype smbclient sagemath python2-yaml python2-scipy python2-pillow python2-notify python2-numpy python2-crypto python2-beautifulsoup4 python2-astropy python-yaml python-urllib3 python-scipy python-rsa python-requests python-pyqt4 python-pyqt5 python-pygame python-pillow python-openpyxl python-numpy python-moviepy python-matplotlib python-httplib2 python-google-api-python-client python-beautifulsoup4 alsa-plugins archey arduino ardour baobab cheese colordiff cups diffpdf djvulibre dropbox dropbox-cli emacs-lyqi-mode-git emacs-python-mode espeak evince feedthebeast feh file-roller gnuplot google-chrome google-talkplugin gparted xte hplip-plugin htop imagemagick irssi ix libdvdcss lsof maim mathjax me_quran mediterraneannight-theme minecraft mlocate mlterm mumble ntfs-3g openssh pulseaudio pkgfile xorg-utils alsa-utils- Set up keyboard/X shortcuts
sudo localectl set-x11-keymap us,ir,fr "grp:shifts_toggle,terminate:ctrl_alt_bksp"
- Partition the hard drive using an Ubuntu livedisk made with
dd if=ubuntu-14.10-desktop-amd64.iso of=/dev/sdb1 bs=512with the obvious replacements, leaving the first four Win8 partitions be, to Ubuntu (~150g), its swap (~10g), the files (~150g), the Arch swap (~10g), and Arch (~150g). Any recovery partitions, etc can also be added. Everything but Windows should be ext4/swap. - Install Ubuntu with grub. This is a particularly insightful article covering the obstacles and solutions when it comes to uefi.
- Upgrade Ubuntu by enabling and introducing the proper repositories, updating, and downloading a few select apps.
- Update configs (to be added)
- Delete grub files on the second partition and do not reboot without installing Arch and its grub.
- Still in the Ubuntu installation, install arch over arch-chroot from the provided tar.gz
- Make sure to mount /boot; Arch will keep Windows files.
- Reboot when ready into Arch, complete installation, then upgrade configs.
- Cross fingers and reboot into newly installed system!
-
If at any time in Windows you want to know whether you're in UEFI mode, run msinfo32.
-
A recurring problem seems to be mounting /boot wrong or using /boot/efi or something, resulting in the bootloader running an older version of linux for which there no longer exist any modules, resulting in a meltdown when trying to boot. To check if this is the case, see whether
uname -rgives the same result aspacman -Q linux; if they don't match, downgrade with pacman -U to the linux version specified byuname -rin /var/cache/pacman/pkg/, then fix /etc/fstab, reboot, upgrade, reboot.