Linux 8 - Making a Bootable Bootable/Live USB Drive

By Sheldon L Published at 2019-11-07 Updated at 2020-04-17


Kali Lunix

wget -q -O - https://www.kali.org/archive-key.asc | gpg --import
gpg --fingerprint 7D8D0BF6

# download the SHA256SUMS and SHA256SUMS.gpg files
# that are next to the downloaded image (http://cdimage.kali.org/kali-2020.1b/)
wget http://ftp.jaist.ac.jp/pub/Linux/kali-images/kali-2020.1b/SHA256SUMS
wget http://ftp.jaist.ac.jp/pub/Linux/kali-images/kali-2020.1b/SHA256SUMS.gpg
# then:
gpg --verify SHA256SUMS.gpg SHA256SUMS
sudo bash

# check which sd<?> pluged in
dmesg
# OR
# before plugin USB
ls -l /dev/sd?
# after plugin USB
ls -l /dev/sd?
fdisk -l /dev/sd<?>    # disk list, to check sd<?> which, such as sdb

dd bs=4M if=path/to/input.iso of=/dev/sd<?> status=progress
fdisk -l /dev/sd<?> # 30 gb USB

end=30gb
read start _ < <(du -bcm kali-linux-2020.1b-live-amd64.iso | tail -1); echo $start
parted /dev/sd<?> mkpart primary $start $end    # ignore all tips

fdisk -l /dev/sd<?>

# reload the USB

mkfs.ext3 -L persistence /dev/sd<?>3 # make filesystem
e2label /dev/sd<?>3 persistence

fdisk -l /dev/sd<?>  # sd<?>3

# create mount point
mkdir -p /mnt/my_usb
mount /dev/sd<?>3 /mnt/my_usb
echo "/ union" > /mnt/my_usb/persistence.conf
umount /dev/sd<?>3

# Users admin
sudo passwd root
sudo passwd kali  # or default kali passwd is 'kali'
# you have to use a mirror to do a full graphical install
cat /etc/apt/sources.list
# 'deb http://http.kali.org/kali kali-rolling main contrib non-free'
# 'deb-src http://http.kali.org/kali kali-rolling main contrib non-free'

sudo apt update
sudo apt full-upgrade

Truble Shooting in Installation

#  `Ctrl + Alt + F1~F6`

# open proxy
v2ray
# `Ctrl + Z` NOT `Ctrl + C`
export all_proxy=socks5://127.0.0.1:1080

dpkg --configure -a
apt --fix-broken install
apt --fix-missing update
apt autoremove
apt update

# TRY
apt upgrade -y && apt autoremove
# OR
apt full-upgrade      # cafully use

# See: https://www.kali.org/docs/general-use/xfce-faq/
# Install xfce and remove gnome
# TRY:
cat /etc/X11/default-display-manager            # current display-manager
apt install kali-desktop-xfce  # choose light dm
update-alternatives --config x-session-manager # choose Xfce's option

# after setup xfce, if you wanna remove gnome or not
apt purge --autoremove kali-desktop-gnome
# if still have issues back up .cache .config .local, then:
rm -r .cache .config .local

# `Ctrl + Alt + F7`
# reinstall
apt install --reinstall lightdm kali-desktop-xfce

# reconfigure
cat /etc/X11/default-display-manager            # current display-manager
sudo dpkg-reconfigure <current display-manager> # reconfigure

Tails

sudo bash

# before plugin USB
ls -1 /dev/sd?

# after plugin USB
ls -1 /dev/sd?

dd if=$hub/images/tails-amd64-4.5.img of=/dev/sdc bs=16M oflag=direct status=progress