You are not logged in.

#1 2018-05-26 02:52:06

That's it!
Registered: 2015-09-17
Posts: 6,275

[Unofficial] Live BL (or Debian Live) USB with persistence.

Updated for helium/stretch
I did this from a BL helium/stretch 64 bit desktop. This is a bit long but it's not complicated. Just be sure to always use the USB drive letter for your drive. You'll most likely be in a world of pain if you do a command to /dev/sda (No!!! sd"a" is probably your hard drive!!! Pick another letter!)

Create a Debian Live 9.* (stretch) USB with Persistence

You'll need a USB key of 4G minimum, 8G or more recommended, and a BunsenLabs helium/stretch ISO... … ey-install

You'll also need the following packages...


If you're using these instructions from a BunsenLabs system, the following command will install the packages you need...

sudo apt-get install --no-install-recommends mbr syslinux p7zip

I'm assuming you know the identity of your USB drive (/dev/sdb, for example). I'll use /dev/sdX from here on so nobody copy/pastes the wrong drive. Example: your USB is /dev/sdb, substitute b for X in all of the following code.

Partition the USB Drive

@johnraff wisely recommends that you temporarily uncheck "Enable Volume Management" in Thunar>Edit>Preferences>Advanced while creating your persistent USB, if you have volume management enabled. You'll need to log out before continuing to make the Thunar changes take effect, log in again by entering the password 'live' (without quotes).

Open gparted, go to the drive drop-down menu in the upper-right corner (/dev/sda (x.x GiB) and choose your USB drive. Make sure any existing partitions on it are unmounted. If the drive size is 300 GiB, that's probably not the drive you want. monkey

HERE WE DELETE ALL CONTENTS ON THE DRIVE!!! MAKE SURE YOU'RE NOT ERASING YOUR COMPUTER'S DRIVE!!! From the menu bar, choose Device>Create Partition Table...>msdos>Apply. Bye-bye drive contents!

Create a bootable fat32 partition large enough to hold your ISO, plus additional space in case a kernel upgrade becomes available (I have no idea how to make the USB "see" a new kernel if it gets installed.); Ben Armstrong recommends an additional 5%. The ISO I'm using is about 850MB so 1G (1024MB) should be plenty... Right-click the "unallocated" bar>New>New Size (MiB):>1024, Create as:>Primary Partition, File System:>fat32, Add. Click the giant green checkmark in the toolbar at the top of the window and Apply. Now right-click that partition, choose Manage Flags and check "boot".

Right-click "unallocated" again and create an ext4 file system in the remaining space and in the "Label:" field type in "persistence" w/out quotes. Spell it right, please. tongue Add and Apply.

You should now have 2 partitions, /dev/sdX1, a fat32 partition with the Flag "boot" and /dev/sdX2, an ext4 partition with the Label "persistence". Close gparted.

Set Up the Master Boot Record

Open a terminal and enter the following...

sudo /sbin/install-mbr /dev/sdX

That installs the MBR to the first sector of the drive, hence no number after the drive letter. Then...

sudo syslinux -i /dev/sdX1

Extract the ISO to the First Partition

Mount the partition to a directory, I use /mnt because it's empty (check that it is first, or create an empty directory and use that!)...

sudo mount /dev/sdX1 /mnt

Extract the ISO with p7zip. Mine is in ~/Documents and is named bl-live-rc1-i386.hybrid.iso, so...

cd /mnt
sudo 7z x /home/hhh/Documents/bl-live-rc1-i386.hybrid.iso

Adjust your path and ISO name, of course. The extraction will take a few to several minutes.

Set Up Persistence

We're almost done. We need to rename some things and append the live boot parameters to make sure the ISO boots and is persistent. Run these commands, one at a time...

sudo mv isolinux syslinux
sudo mv syslinux/isolinux.cfg syslinux/syslinux.cfg
sudo mv syslinux/isolinux.bin syslinux/syslinux.bin
sudo sed -i 's/\(append boot=.*\)$/\1 persistence/' syslinux/live.cfg
cd ..
sudo umount /mnt

Now we create the persistence.conf file in the second partition...

sudo mount /dev/sdX2 /mnt
cd /mnt
echo / union | sudo tee persistence.conf


sudo syslinux -i /dev/sdX1 -d /syslinux

That's it. Set your Thunar preferences back to how you had them, reboot to your USB drive and choose a Live session. You'll see messages about your drives not mounting to /live/persistence, that's normal. The first time you boot, you'll see a brief cron job running, that's the persistence being configured.

You should be automatically logged into the session. If you want to log out, the username is user and the password is live. You should be able to change those settings, because we now have a persistent USB! Make some changes to your desktop (maybe set your time zone with 'sudo dpkg-reconfigure tzdata') and reboot to check if persistence is working.


Pic or it didn'thappen...


#2 2018-10-15 15:16:35

Registered: 2015-11-13
Posts: 40

Re: [Unofficial] Live BL (or Debian Live) USB with persistence.

Yo! Followed the tutorial, but no persistence so far.
Here's what was done:
1. Partitioned 64G tf card. GPT filesystem with 1.5G fat32 with boot flag + persistence for the rest.
2. Extracted the iso to fat32 partition and renamed isolinux folder and files to syslinux.
3. Added persistence to live.cfg
4. Created persistence.conf on the second partition and added / union.

Last edited by rgnr (2018-10-15 20:55:07)


#3 2019-01-06 15:32:32

Registered: 2017-06-29
Posts: 61

Re: [Unofficial] Live BL (or Debian Live) USB with persistence.

Thanks for the tutorial!

What I do to make a usb persistent is a bit easier, IMO.

I find a pc with 2 usb ports, I plug one usb stick with the installer and another one where I'll install the system, and I proceed with the normal installation choosing the usb drive as destination. It's also easy to set it up FDE (which I think is critical for something so easy to lose).

Hope is not highjacking your thread, just a note for the curious passer-by.


Board footer

Powered by FluxBB