Create a permanent write area on Kali Linux with USB memory boot

Create a persistent write area on USB-booted Kali Linux.

Get Kali Linux

Obtained from Kali Linux Downloads

reference) Key correspondence table that seems to be the minimum necessary until the Japanese input environment is prepared

Key you want to enter Keys to operate
_ shift + =
= ^
" shift + :

Write a Kali Linux ISO image to a USB stick

kichise@imac ~ % diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI EFI                     314.6 MB   disk0s1
   2:                 Apple_APFS Container disk2         121.0 GB   disk0s2

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *2.0 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                 Apple_APFS Container disk2         2.0 TB     disk1s2

/dev/disk2 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +2.1 TB     disk2
                                 Physical Stores disk0s2, disk1s2
   1:                APFS Volume Macintosh HD - Data     147.0 GB   disk2s1
   2:                APFS Volume Preboot                 83.3 MB    disk2s2
   3:                APFS Volume Recovery                528.1 MB   disk2s3
   4:                APFS Volume VM                      2.1 GB     disk2s4
   5:                APFS Volume Macintosh HD            11.1 GB    disk2s5

/dev/disk3 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *480.1 GB   disk3
   1:                        EFI EFI                     209.7 MB   disk3s1
   2:Microsoft Basic Data Volume 479.9 GB   disk3s2

/dev/disk4 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *63.9 GB    disk4
   1:             Windows_FAT_32 UBUNTU 17_1             63.9 GB    disk4s1

kichise@imac ~ % 
kichise@imac ~ % diskutil unmountDisk /dev/disk4
Unmount of all volumes on disk4 was successful
kichise@imac ~ % 
kichise@imac ~ % sudo dd bs=4m if=/Users/kichise/ISO/kali-linux-2020.1b-live-amd64.iso of=/dev/rdisk4
Password:
686+1 records in
686+1 records out
2881105920 bytes transferred in 80.742329 secs (35682720 bytes/sec)
kichise@imac ~ % 

Create a storage area on the Kali Linux LIVE USB memory

Check partition configuration

kali@kali:~$ sudo bash
root@kali:/home/kali# fdisk -l
Disk /dev/sda: 476.96 GiB, 512110190592 bytes, 1000215216 sectors
Disk model: Micron_1100_MTFD
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 21FEB3FE-999E-4B40-954F-7A3B728755CF

Device         Start        End   Sectors   Size Type
/dev/sda1       2048    2099199   2097152     1G EFI System
/dev/sda2    2099200    2361343    262144   128M Microsoft reserved
/dev/sda3    2361344  993923071 991561728 472.8G Microsoft basic data
/dev/sda4  993923072 1000214527   6291456     3G Windows recovery environme


Disk /dev/sdb: 59.49 GiB, 63864307712 bytes, 124734976 sectors
Disk model: Flash Drive     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2259da88

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdb1  *         64 5625087 5625024  2.7G 17 Hidden HPFS/NTFS
/dev/sdb2       5625088 5626559    1472  736K  1 FAT12


Disk /dev/loop0: 2.4 GiB, 2565337088 bytes, 5010424 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Create partition

Officially, there was a way to use parted, but I found it difficult, so I used fdisk.

root@kali:/home/kali# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.34).                                        
Changes will remain in memory only, until you decide to write them.        
Be careful before using the write command.


Command (m for help): p
Disk /dev/sdb: 59.49 GiB, 63864307712 bytes, 124734976 sectors
Disk model: Flash Drive     
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2259da88

Device     Boot   Start     End Sectors  Size Id Type
/dev/sdb1  *         64 5625087 5625024  2.7G 17 Hidden HPFS/NTFS
/dev/sdb2       5625088 5626559    1472  736K  1 FAT12

Command (m for help): n
Partition type
   p   primary (2 primary, 0 extended, 2 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3): 
First sector (5626560-124734975, default 5627904): 
Last sector, +/-sectors or +/-size{K,M,G,T,P} (5627904-124734975, default 124734975): 

Created a new partition 3 of type 'Linux' and of size 56.8 GiB.

Command (m for help): w
The partition table has been altered.
Syncing disks.

root@kali:/home/kali# 

Format & with label

Create a file system labeled persistence. The official procedure was to create the file system and label it separately, Since Label was specified when creating the file system, the procedure was as follows.

root@kali:/home/kali# mkfs.ext3 -L persistence /dev/sdb3
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 14888384 4k blocks and 3727360 inodes
Filesystem UUID: 56fabebf-14fa-476c-be98-39a718351bd2
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000, 7962624, 11239424

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done   

root@kali:/home/kali# e2label /dev/sdb3
persistence
root@kali:/home/kali# 

Create persistence configuration file

root@kali:/home/kali# mkdir -p /mnt/my_usb
root@kali:/home/kali# mount /dev/sdb3 /mnt/my_usb/
root@kali:/home/kali# echo "/ union" > /mnt/my_usb/persistence.conf
root@kali:/home/kali# umount /mnt/my_usb/
root@kali:/home/kali# 

Reboot

When using the storage area, from ** "Kali Linux Boot Menu" ** when booting from USB ** Select "Live system (persistence, check kali.org/prst)" **.

Japanese input support

After creating the storage area, restart Kali Linux before executing.

ibus-anthy installation

kali@kali:~$ sudo apt install ibus-anthy

IBus Input Method settings

This is a GUI setting. I intend to represent the menu hierarchy. .. ..

Settings -> IBus Preferences
 Input Method
  Add Japanese Anthy

Select the added Japanese Anthy and click Preferences
Setup-IBus-Anthy
 Typing Method
   Keyboard Layout
Change to jp

Right-click the Input method icon and execute restart Switching between Japanese input and direct input is done in half-width / full-width.

I also made the following settings, but they may not be necessary.

Keyboard
 Add Japanese(OADG 109A)
 move up Japanese Layout to first

TIME ZONE setting

Since TIMEZONE is UTC, I changed it to Asia / Tokyo. But setting RTC in local TZ to yes makes me angry. Moreover, it doesn't work as expected.

root@kali:/home/kali# timedatectl set-timezone Asia/Tokyo
root@kali:/home/kali# timedatectl set-local-rtc 1
root@kali:/home/kali# timedatectl 
               Local time: Thu 2020-03-26 22:57:38 JST
           Universal time: Thu 2020-03-26 13:57:38 UTC
                 RTC time: Thu 2020-03-26 22:57:38
                Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: yes

Warning: The system is configured to read the RTC time in the local time zone.
         This mode cannot be fully supported. It will create various problems
         with time zone changes and daylight saving time adjustments. The RTC
         time is never updated, it relies on external facilities to maintain it.
         If at all possible, use RTC in UTC by calling
         'timedatectl set-local-rtc 0'.
root@kali:/home/kali#

kali@kali:~$ sudo timedatectl set-local-rtc 0
kali@kali:~$ sudo hwclock --hctosys --local
kali@kali:~$ timedatectl 
               Local time: Thu 2020-03-26 14:32:31 JST
           Universal time: Thu 2020-03-26 05:32:31 UTC
                 RTC time: Thu 2020-03-26 14:32:31
                Time zone: Asia/Tokyo (JST, +0900)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no
kali@kali:~$ 

reference

Reference URL when creating a permanent write area: Create writable space (kali.org: Adding Persistence to a Kali Linux "Live" USB Drive)

Recommended Posts

Create a permanent write area on Kali Linux with USB memory boot
Install Grub on USB memory (UEFI) ~ Boot Linux from grub on USB memory ~
[Tips] Persistence of Kali Linux Live Image with USB memory
Create a Linux environment on Windows 10
Create a Docker container image with JRE8 / JDK8 on Amazon Linux
Create a USB boot Ubuntu with a Python environment for data analysis
Create a Linux virtual machine on Windows
Start a process with a scheduling policy on Linux
Try to create a new command on linux
How to create a USB that Linux and Win10 installer and winpe can boot UEFI
Create a QR code for the URL on Linux
[Linux] Create a self-signed certificate with Docker and apache
Create a new csv with pandas based on the local csv
I installed Ubuntu on a USB stick on a dual boot PC
Create a list in Python with all followers on twitter
Create a VS Code + Docker development environment on a Linux VM
Install Linux (CentOS) on your PC using a USB stick
[Linux] Write a deployment tool using rsync with a shell script
Create a homepage with django
Create a heatmap with pyqtgraph
Create a classroom on Jupyterhub
Create a directory with python
[MariaDB] Install MariaDB on Linux and create a DB and an operating user.
Dual Boot (not VM) for Kali Linux ver2020.2 on MacBook pro 2017
Create a word cloud with only positive / negative words on Twitter
Try various Linux distributions with VMware ESXi arm edition + USB boot
How to write a docstring to create a named tuple document with sphinx