6

Greeting's, to clarify; my question is not creating a Live USB drive or a persistence partition but creating a USB with GRUB bootloader (or other) and Kali which can be used on any machine. This is similar to running other linux OS directly from USB. I am currently running Ubuntu from a pen drive. I installed the OS (Ubuntu) and the bootloader on the pen drive and I can boot off it anywhere. Here is a video explaining the same (video is not by me: https://www.youtube.com/watch?v=fLYBXOVn6ow)

Since, Kali's installer doesn't give option to select which drive to write the booloader to and directly writes on the HDD (sda1). This means even if I partition and install Kali on a pen drive since the bootloader will be installed on the machines fixed primary drive, the USB drive will fail to boot on a different device.

I have two questions:

  1. Anyone has any idea how to write bootloader to a USB drive and what parameters should be given so that it boots with Kali installed on it.

  2. I am using graphic install mode for installing Kali on the USB drive, however there is no option for the install to be encrypted (Full disk encryption or at least /home folder to be encrypted). Does anyone know how can I install Kali with full disk / home folder encryption? Or enable is post install?

Thank You!

  • This is a Linux question, not a security question. – schroeder Apr 5 '16 at 14:28
  • You can easily install the kali linux on your pendrive check out this link youtube.com/watch?v=bAS5sVAV5hg – deepak jain Aug 18 '18 at 13:16
5

Install Kali into a VirtualBox VM with the USB attached as the first hard drive.

You can attach the USB to VirtualBox following this guide: Using a Physical Hard Drive with a VirtualBox VM

I have done this with Ubuntu 14.04 and it works quite well. The installation is bootable on most systems.

Addendum:

I'm going to elaborate, because I think this is a much overlooked solution...

I was asking myself this question over a year ago. I began with the persistence partition. To me, it felt like a convoluted, unnecessary hoop-jumping exercise to have the appearance of a system on a stick.

By installing directly to the USB stick through virtualbox, you won't have to partition a specific amount of space for the persistence volume; you are creating a fully bootable stick with full read and write access everywhere, as if the stick were a normal ssd drive.

  • This isn't the commonly practiced method because it will not boot on a lot of systems out there. That said, most newer BIOSes have much better support for USB booting so this is becoming far less of a problem. – Nilpo Jan 29 '18 at 7:24
3

@TiberiusKirk Many thanks for the idea it worked as it should.

For the record here is what worked for me on a Windows 10 machine:

  1. Connect the Pendrive delete the partition using windows disk manager (or whatever tool) .

  2. Create the Disk metafile:

    VBoxManage internalcommands createrawvmdk -filename "C:\Users\sysadmin\Documents\sysadmin\kaliboot\kaliboot.vmdk" -rawdisk \\.\PhysicalDrive1
    
  3. Attach Disk as SATA:

    VBoxManage storageattach kaliboot --storagectl "SATA" --port 0 --device 0 --type hdd --medium C:\Users\sysadmin\Documents\sysadmin\kaliboot\kaliboot.vmdk
    

Note: In this example the name of the VM created in VirtualBox is "kaliboot".

1

That is exactly what kali's persistence is for. Follow the guide. - or edit your question to include why you not want to use persistence.

It also covers full disk encryption of the persistence filesystem.

Note: the persistence-enabled USB drive is already bootable, as is your regular one right now.

  • Reading elsewhere, I figured persistence to be a different partition for /home or other user directory. While I have not tried it, I thought updated software may revert to ISO version on reboot. I will give this a try and report back. Thank you! – Parth Maniar Apr 5 '16 at 14:09
  • 1
    You can't easily upgrade the kernel with persistence. – flumpb Feb 6 '18 at 19:55
0

Well even I have installed Kali Linux on a pendrive and not a like a live one. What i did was that first I made the drive A which I want to use as the main pendrive as a live bootable. Secondly I made another bootable the same way on pendrive no.2 Now the first and 2nd pendrive both show in the BIOS AS BOOTABLE So then I changed the priority of the pendrive 1 and then I did the install using pendrive 2. And it successfully installed Kali Linux with the grub bootloader on pendrive 1

Advice : use an old Kali Linux image. The 2018.1 is more complex than to do. You can then upgrade the old one so it's the same thing.

-1

Saw an interesting approach from the book, Building a Pentesting Lab for Wireless Networks.

Download this tool -- http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3/ -- the Universal USB Installer (UUI). Using the dropdown, select Kali Linux from the Linux Distribution List.

In order to make an encrypted persistent partition, use Linux (e.g., Kali Linux) and make sure your USB disk appears with fdisk -l.

Get the space occupied by Kali image in bytes (3167)

du -bcm kali-linux-2.0-amd64.iso

Create the third partition on the USB drive starting right after Kali image

parted /dev/sdb mkpart primary 3167 7gb

Verify with fdisk -l that the new partition shows up. Then encrypt the new partition:

cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb3

Open the new partition with the mapping name kali_stor

cryptsetup luksOpen /dev/sdb3 kali_stor

Build a filesystem labeled persistence on the new partition. Mount the partition

mkfs.ext3 -L persistence /dev/mapper/kali_stor && e2label /dev/mapper/kali_stor persistence

mount /dev/mapper/kali_stor /mnt

Create a persistence.conf file with union

echo "/ union" > /mnt/persistence.conf

Unmount and encrypt

umount /dev/mapper/kali_stor && cryptsetup luksClose /dev/mapper/kali_stor

Boot via USB now and check the menu for Live USB Encrypted Persistence boot option and enter your encryption passphrase

  • They don't want persistence. – Nilpo Jan 29 '18 at 8:12

Not the answer you're looking for? Browse other questions tagged or ask your own question.