Tails OS is distributed either via .iso or .img file. The only .img can have persistent storage, but only .iso can be mounted to VirtualBox and properly booted. I would like to have VirtualBox Tails machine with persistent storage and ability to install 3rd parties software.
Below is what I did. In couple of words I decided to use flash drive emulator. I'm on Ubuntu 18.04.
dummy_hcd.ko for my kernel and got flash drive via
$ sudo modprobe dummy_hcd $ fallocate -l 8GiB /path/to/flash-drive-file $ sudo modprobe g_mass_storage file=/path/to/flash-drive-file idVendor=0x1d6b idProduct=0x0104 iManufacturer=Myself iProduct=VirtualBlockDevice iSerialNumber=123
Then I expand Tails OS .img file to that drive by using
dd as to usual USB flash drive via issuing following (
/dev/sdd is my virtual flash drive)
$ dd if=tails-amd64-3.13.2.img of=/dev/sdd bs=16M
After that I got
/dev/sdd1 partition that I can mount and see the image content. It's size is exactly equal to
tails-amd64-3.13.2.img file size.
Then I created .vmdk VirtualBox file tied to
$ sudo VBoxManage internalcommands createrawvmdk -filename ~/usb.vmdk -rawdisk /dev/sdd
I created new virtual machine and selected this .vmdk file, and started it. Unfortunately, while booting it complaints to insufficient disk space and stop booting. I took
gparted and resized this partition.
gparted shows me a message where suggests to fix GPT table I accepted it. The same
Warning: Not all of the space available to /dev/sdd appears to be used, you can fix the GPT to use all of the space (an extra 14364672 blocks) or continue with the current setting? Fix/Ignore? Fix Model: Linux File-Stor Gadget (scsi) Disk /dev/sdd: 8590MB Sector size (logical/physical): 512B/512B Partition Table: gpt Disk Flags: Number Start End Size File system Name Flags 1 1049kB 1235MB 1234MB fat32 Tails boot, hidden, legacy_boot, esp
And after that (it's only enough to apply GPT fix and not actually use unallocated space) I, unfortunately, get this message from kernel. I suppose that it can't find the root file system to mount and continue booting
init process from this file system maybe.
But the shell is available and rootfs is mounted to ramdisk and can be listed.