Hi.
I fiddled around with kali on my Surface pro 4 the last 2 days and I have it aaaalmost where i need it:
- Kali 2017 from USB with EFI boot working
- Persistence working
- Type Cover working
Since i plan to use it for teaching wifi security, I also need a monitor-mode capable wifi card/driver. I think the integrated just does not do it.
I'll just update this post step by step, since it might grow large.
My goals:
- Boot Kali from USB with persistence, and leave the rest (Windows installation, microSD) clean.
- Use my type cover for input (I need the USB port for my USB thumb drive)
- Use monitor mode with the integrated Marvell Avastar 88W8897 802.11ac -- not working yet (and never might be)
- Be able to update the kali kernel.
Step 1: Disable SP4 Secure boot
Before I could even try to EFI boot, I had to disable secure boot in the SP4 Bios. If you don't do that and try to boot the kernel, you'll either end up with a yellow cursor or a message like "kernel signature verification failed" in your grub.
!!!Take care. If you do that, your Windows installation will notice the changed boot properties and start Bitlocker Key recovery!!! I had to look up my unlock code on my oneDrive account.
- If you are sure you want it, shut down your SP4, hold Vol+ and press the Power butten. This will enter the SP4 management interface ("Bios"). Here turn of secure boot. I also changed the boot order so that USB boot is on top. This way, when i plug in the USB stick, it boots from USB and Windows otherwise. Convenient.
- You may notice the Red Lock on top when booting now. Don't be alarmed, thats just the Microsoft way of assuring that you did something geeky (disable secure boot).
Step 2: Install kali with EFI
I essentially followed the steps depicted in this article.
However, some parts did not work, here is what I had to do:
- Download the latest Kali iso (I used kali-linux-2017.1-amd64.iso)
- Create bootable USB medium with this iso. I used Lili USB creator on Windows to do that.
- I prepared my 32 GB USB Stick with 3GB for the Image itself (FAT32), 12 GB ext4 (formated later with kali and gparted in live mode) for persistence and the rest with ntfs to exchange Data with Windows.
- After Lili is done, go to your ISOfied drive in Windows and look up \EFI\BOOT\. Put grub.cfg from the link above there.
- Download grubx64.efi and BOOTX64.efi there as well. I got it from here: Fedora 26 - gd.tuwien.ac.at, but you can essentially use ressources from different distributions.
- Now your Thumb drive should contain at least three files in /EFI/BOOT of your live USB stick.
- Thats it, shut down your SP4 again, and while starting up, this time hold the VOL- Button (if you did not change the boot order).
- Kali should come right up.
Step 3: Kali persistence
- Kali persistence is straight forward and can be done like described by the Kali tutorials. I used the beforementioned spare space of 12 GB on my drive, created an ext4 Filesystem there, and put the persistence.conf there.
- Reboot. At the grub menu, choose persistence mode now (second option).
- After boot, go to a terminal and type df. if you see two partitions mounted from your USB drive likethis you're fine:
Code:
root@kali:~# df
/dev/sda1 3063808 2807472 256336 92% /lib/live/mount/persistence/sda1
/dev/sda2 12030584 4925656 6517732 44% /lib/live/mount/persistence/sda2
overlay 12030584 4925656 6517732 44% /
/dev/sda3 14669820 84208 14585612 1% /media/root/Kali Data
- If you want, edit your grub.conf and switch from option 0 to option 1, so persistence mode is always selected when you boot kali. You'll need this once the type cover is working anyway, otherwise you boot to kali without a keyboard.
Step 4: type Cover support
The type cover is recognized automatically but not as a HID device. You can test this by doing a dmesg before and after you connect the type cover.
Unfortunately you need a kernel patch to get it recognized anyway.
Fortunately, Kernel 4.10 and above already have that patch included.
Unfortunately, Kali 2017.1 is running kernel 4.9 .
Fortunately, you can upgrade it with apt-get dist-upgrade.
Unfortunately, you can't do that on a live medium because the kernel is on the non-writeable FAT32 partition and not in the persistence section.
Fortunately, you can do it anyway:
- run
Code:
root@kali:~# uname -a
Linux kali 4.9.0-kali3-amd64 #1 SMP Debian 4.9.18-2kali1
. it tells you which kernel you are running (mine was 4.9.18)
- If you have persistence up and running, do:
Code:
apt-get update
apt-get upgrade
apt-get dist-upgrade
- it says that it cannot run initramfs on a live medium. Thats ok.
- After the upgrade do a
Code:
dpkg -l | grep linux-image
. That shows you which kernels were installed. Mine was 4.9.30. Copy the name (Like linux-image-4.9.0-kali4-amd64)
- Waaaat? you say? Type Cover was included in 4.10!! no, apparently its also included in 4.9.30
- Now you need to run
Code:
/usr/sbin/update-initramfs.orig.initramfs-tools -c -k 4.9.0-kali4-amd64
This will create the new kernel
- Go to /boot/
- Copy the newly generated initrd.img and vmlinuz to somewhere where you can easily access it. For me it was the NTFS formatted part of the USB stick.
- In my case the files were: initrd.img-4.9.0-kali4-amd64 and vmlinuz-4.9.0-kali4-amd64
- Shut down Kali, fire up windows.
- On your live USB drive (The 3G with FAT32), copy both files to \live\ and rename them to initrd.img and vmlinuz (cut the version numbers). You may want to move the old ones to a backup location.
- Thats it, now grub uses the freshly generated kernel and boots up using that.
- Verify by enjoying type cover support and doing a
Code:
root@kali:~# uname -a
Linux kali 4.9.0-kali4-amd64 #1 SMP Debian 4.9.30-2kali1 (2017-06-22) x86_64 GNU/Linux
Enjoy,
Cheerio.