Distro-agnostic installation guide:
I thought I might use the occasion of this shiny new thread to try and shed some light on the installation-quirks of the X205TA and how to address them in this general distro-agnostic installation guide.
(If you want a more straight-forward approach to installing ubuntu; check the last link posted above by Yochanan.)
Quick summary of the issues:
The main issue with installing linux on the X205TA stems from the fact that the laptop has a 32bit uefi-system in combination with a 64bit CPU.
This results in 2 problems:
- 64bit isos won't boot from a usbstick because they mostly carry a 64bit bootloader (while 32bit isos generally only do legacy boot, not uefi).
- If you do manage to boot a usbstick and install linux to the ssd, the distro’s installer will most likely try - and fail - to install a 64bit uefi bootloader, which will end in a pristine but unbootable linux installation (or for some distros it will crash the installer, which is harder to recover from. If the installer crashes you are probably better off reinstalling the OS and if possible disabling installing grub completely)
Next to these boot problems are a couple of hardware quirks (enabling audio, wifi & bluetooth, stop random freezes) that need to be addressed to get the best linux experience. Some hardware functionalities as of yet do not (and might never) work:
- microphone
- headphone jack detection
(Asking for these functionalities means you didn’t read this guide)
The boot issues are addressed by step 1 & 5
The hardware quirks by step 2,3 & 4
How to address these issues:
1. How to boot a usbstick:
So the iso needs to boot in 32bit efi mode. This can be done by placing a file called bootia32.efi in a specific location on the usbstick. Because files can’t be added if you use tools like dd & imagewriters (they create read-only usbsticks), you’ll have to extract the iso to a fat32 formatted usbstick instead:
Code:
# The next 3 commands will destroy all data on a device. Be extremely careful when you change y to your usbstick’s device letter.
# If you are not comfortable with the command line, I suggest you format the usb stick to FAT32 using a GUI tool like gparted or the format option in windows.
sudo parted -s /dev/sdy mklabel msdos #create new mbr partition table
sudo parted -s /dev/sdy mkpart primary 1M 100% #create 1 partition that takes up 100% of the usbstick
sudo mkfs.vfat -n X205TA /dev/sdy1 #format that partition FAT32 and label it X205TA
# mount the usbstick somewhere and extract the iso to it
sudo mount /dev/sdy1 /path/to/usbmountpoint
sudo 7z x linux.iso -o/path/to/usbmountpoint/ #notice: no space after the -o flag, x in this command means extract.
sudo mkdir -p /path/to/usbmountpoint/EFI/BOOT #if missing, this command creates a directory and its parent directories
sudo wget https://raw.githubusercontent.com/harryharryharry/x205ta-iso2usb-files/master/efi_bootia32.efi -O /path/to/usbmountpoint/EFI/BOOT/bootia32.efi
sync; sudo umount /path/to/usbmountpoint #writes any data buffered in memory out to disk and unmounts usbstick
Now the usbstick will show up when pressing ESC during the X205TA boot process, and the bootia32.efi file will try to load /path/to/usbmountpoint/boot/grub/grub.cfg
If this file/directory does not exist, a grub rescue prompt will appear. If this happens you will need to create it (/path/to/usbmountpoint/boot/grub/grub.cfg) yourself and add to the file something like this:
menuentry 'Pretty LinuxOSname' {
linux /isolinux/vmlinuz intel_idle.max_cstate=1 button.lid_init_state=open
initrd /isolinux/initrd.img
}
The linux line should point to the kernel (usually called vmlinuz or something similar in nature)
The initrd line should point to the initramfs (usually called initrd.img or something similar in nature)
The extracted iso will contain config files that reveal which boot parameters are required, it’s a bit of a trial-and-error detective game . Pressing ‘e’ in the grub menu lets you edit boot commands on-the-fly and try them out.
In the example above I’ve added 2 parameters already because it makes sense to add them when using the X205TA (so if a grub.cfg already exists you benefit from adding these parameters):
intel_idle.max_cstate=1 prevents freezing
button.lid_init_state=open prevents suspend/resume loop when closing the lid
Once booted into the live environment, my advice would be to install linux straight away.
Skip to step 5 for an explanation on how to install the grub bootloader to the ssd after finishing the installation (because as said, the linux installer will fail to do so properly).
Otherwise, you can perform the following steps to get more functionality for the duration of the live boot; however they will need to be repeated after (re)booting (into either live usb or the installed linux).
2. How to gain internet connectivity
The internal wireless card’s module (brcmfmac) needs a file called /lib/firmware/brcm/brcmfmac43340-sdio.txt to get the card up and running, but it’s missing (well it’s not in the right location). You can copy it by running the following commands:
Code:
# probably not necessary, but to be sure the EFI variables are properly exposed to userspace
sudo modprobe efivarfs
sudo mount -t efivarfs efivarfs /sys/firmware/efi/efivars
# then copy the file that starts with nvram to /lib/firmware/brcm
sudo cp -a /sys/firmware/efi/efivars/nvram* /lib/firmware/brcm/brcmfmac43340-sdio.txt
# and reload the brcmfmac module
sudo rmmod brcmfmac
sudo modprobe brcmfmac
You can also opt to use a slightly different version I host on github:
https://raw.githubusercontent.com/ha...43340-sdio.txt
which has the added benefit of supporting 5GHz networks (pretty weird the version in the EFI variables doesn’t...)
3. How to gain bluetooth connectivity
The internal bluetooth chip needs a file called /lib/firmware/brcm/BCM43341B0.hcd and a running bluetooth service and a running btattach command (for which you can also create a service).
Code:
# Download the firmware file to the right location
sudo wget https://raw.githubusercontent.com/harryharryharry/x205ta-iso2usb-files/master/BCM43341B0.hcd -O /lib/firmware/brcm/BCM43341B0.hcd
Create a file called /etc/systemd/system/btattach.service with the following contents:
[Unit]
Description=Btattach
[Service]
Type=simple
ExecStart=/usr/bin/btattach --bredr /dev/ttyS1 -P bcm
ExecStop=/usr/bin/killall btattach
[Install]
WantedBy=multi-user.target
And then:
Code:
# (re)start the services with
sudo systemctl restart btattach
sudo systemctl restart bluetooth
# check the services
sudo systemctl status btattach
sudo systemctl restart bluetooth
# (if the btattach service failed, check if the binary 'btattach' is installed)
# (if the service btattach failed but btattach is installed, try changing /dev/ttyS1 to /dev/ttyS4 and reload and restart the service)
# when you’re booted into linux on the ssd you can repeat step 3. and enable the services at boot with:
sudo systemctl enable btattach
sudo systemctl enable bluetooth
The tweaks in step 4. will only take effect during boot so they cannot be applied during a running live session.
4. Further tweaks
To add headphone support (>=4.13 kernels only) and blacklist 2 modules that will cause problems, add the following contents to a file called /etc/modprobe.d/50-x205ta.conf
# this quirk is needed to get headphones support in kernels >=4.13
options snd_soc_rt5645 quirk=0x31
# module snd_hdmi_lpe_audio breaks sound
blacklist snd_hdmi_lpe_audio
# module btsdio breaks wifi on suspend/resume
blacklist btsdio
Download a UCM-file from Pierre Bossart’s github, required for audio to work
Code:
sudo wget https://raw.githubusercontent.com/harryharryharry/x205ta-iso2usb-files/master/HiFi.conf -O /usr/share/alsa/ucm/chtrt5645/HiFi.conf
# (this file is prone to be overwritten during distro updates of alsa-libs, check your package manager on how to prevent this from happening or backup the file so you can easily restore it.)
# original file source: (which doesn't support headphones, and has headphones output as default instead of speakers)
# https://raw.githubusercontent.com/plbossart/UCM/master/chtrt5645/HiFi.conf
And last but not least...
5. Properly install grub bootloader (make linux on the ssd bootable)
I began by telling linux will try to install a 64bit uefi bootloader. This last step will explain how to chroot in to the linux installation from a liveusb stick and do what the installer failed to do.
I’ve found this step to be a very handy tool for all future linux rescue situations. If you’re ever in a situation where linux won’t boot at all, this is a very rudimentary tool to help fix that. From within chroot you can remove/install/reconfigure/backup packages to your heart’s content just as if you were regularly booted into the distro. (This step also exemplifies why encrypting your rootfs is important, since all the passwords in the world won’t protect you if someone can simply be a root user by chrooting into your OS from a live usb.)
In this case we will be reconfiguring grub (and in some cases installing extra grub packages).
The most important part for this step to work is to find the right block device where the rootfs of your linux installation is located. Tools like blkid and lsblk will help you find the right block device. (hint; it’s probably ext4, taking up 95% of your ssd, and called root)
Code:
# mount the rootfs partition (change X and Y) on /mnt
sudo mount /dev/mmcblkXpY /mnt
cd /mnt #(or, sweet bonus trick: cd $_ )
sudo mount --bind /proc proc
sudo mount --bind /sys sys
sudo mount --bind /dev dev
sudo mount --bind /dev/pts dev/pts
sudo mount --bind /run run
sudo chroot .
# you are now chrooted into the linux installation that is on the ssd, ready to perform miracles
mount -a #firstly, attempt to mount all filesystems listed in /etc/fstab, because the efi partition should be mounted
# probably not necessary, but to be sure the EFI variables are properly exposed to userspace run:
modprobe efivarfs
mount -t efivarfs efivarfs /sys/firmware/efi/efivars
# this is the main command: it installs 32bit efi grub to the efi partition
grub-install --target=i386-efi --bootloader-id=Linux --efi-directory=/boot/efi --recheck
# (this command will fail if the necessary grub libraries are not installed, they should be in /usr/lib/grub/i386-efi/)
# (some distros use grub2-install instead of grub-install)
# now it's a good idea to add the intel_idle.max_cstate=1 button.lid_init_state=open parameters (explained in step 1) to /etc/default/grub (between the quotes after GRUB_CMDLINE_LINUX_DEFAULT) before generating grub.cfg
# and then generate grub.cfg
grub-mkconfig -o /boot/grub/grub.cfg
# (some distros use grub2-mkconfig)
# (likewise, on some distros you should install grub.cfg to /boot/grub2/ instead of /boot/grub/ – check which directory already exists)
# exit the chroot environment
exit
# reboot the laptop
sudo reboot
# and cross your fingers
sudo cross-fingers
Please note that mainline kernels need intel_idle.max_cstate=1 as a boot parameter to stop random freezes. However this parameter prevents the laptop from going to deeper sleep states, which will make the device less power-efficient. If you want to prevent freezes, but still have the laptop be as power-efficient as possible, please refer to my patched kernel compilation guide or install one of my prebuilt patched kernels (if you are successful in booting a patched kernel, remember to remove the intel_idle.max_cstate=1 parameter from /etc/default/grub and update grub.cfg).
Valuable sources:
bugtracker sound issue X205TA: https://bugzilla.kernel.org/show_bug.cgi?id=95681
bugtracker freezing issue baytrail: https://bugzilla.kernel.org/show_bug.cgi?id=109051
Bookmarks