Page 1 of 3

How To: Persistent Live LMDE USB Install

Posted: Thu Jun 14, 2012 6:19 pm
by kwatson512
EDIT: Updated 2013 Mar 30. The original tutorial worked when Debian Testing was Squeeze. Wheezy labels things differently. This should now work for Mint 201303, based on Debian Testing, which is currently Wheezy. Thanks to widget and kyeshi98 for pointing out the changes in Debian Live, and to kyeshi98 for posting the solution.

I love Linux Mint. I like that it is a fully featured, easy-to-use desktop, and it is very user-configurable. I particularly like Linux Mint Debian Edition, because it's semi-rolling and it's fast. I wanted a full, personalized version of Mint Debian on a USB thumb drive that I could boot from any machine.

There are several tools available to install Mint and other distros on USB drives: Startup Disk Creator (within an installation of Ubuntu), write the ISO image to USB and boot from that, Universal USB Installer, UNetbootin, LinuxLive USB Creator, and probably others. None of these met my needs completely.

You can also do a full install onto a USB thumb drive, hard drive, or flash card, like this. However, I have found this to be extremely slow in operation. Also, you might be stuck with using it on only one computer because of UUID specifications in GRUB.

I found two primary hurdles that needed to be overcome.
- The first of these was persistence. Universal USB Installer and UNetbootin both advertise the ability to create bootable USB installations. The image I created using Universal USB Installer hung during boot. UNetbootin creates a partition for persistence formatted to ext2 and labeled "casper-rw." Unfortunately, that only works for Ubuntu and Ubuntu-based distros (works for Linux Mint main edition). Debian and Debian-based distros look for a partition with the label "live-rw" when there's a persistent flag in the boot line.
- Second, once I created my live installation, I kept running afowl of the unknown/unknowable root password (for example, in order to execute any "sudo" commands, including reading data on my host system's hard drive).

This is a pretty simple procedure, but it requires another working Linux installation (either on a hard drive or live media) for at least one step. The rest can be done from Windows and from your new USB install.

1. Download a copy of the latest Linux Mint Debian iso. Check the MD5 sum. If you have no other bootable linux distribution, burn it to disc. Otherwise, there is no need to burn the iso to disc.
2. Download a copy of UNetbootin.
3. Plug in your target USB drive and use UNetbootin to install a live instance of LMDE. Do not create any persistence at this time.
4. Boot into your new LMDE install to ensure it works. Reboot into any working Linux distribution.
5. From within a Linux operating system, connect your new USB install and use GParted (or your favorite partition editor) to shrink the LMDE partition and create a new one with the remaining space, formatted to ext2 and labelled "persistence". I used an 8 GB SanDisk Cruzer drive. Here's how I did it using GParted (I've added screenshots):
- Click on GParted --> Devices to select your USB drive (probably sdb).
Gparted02.png
- Click on the /dev/sdb1 partition. Click on Partition --> Unmount (if it is mounted).
- Click on Partition --> Resize/Move and then drag the end of the partition to your desired size.
Gparted04.png
- Click on the unallocated space.
- Click on Partition --> New (or use the far-left icon in the toolbar). Select ext2 for the File system and type in "persistence" for the Label (without quotation marks).
Gparted07.png
Click "Add."
- Click on Edit --> Apply All Operations (or use the far-right icon in the toolbar).
- When that's done, exit GParted.
6. Mount your new "persistence" partition and add a file in it titled "live-persistence.conf" with the contents "/ union" (one line only).
- Remove and reinsert the USB drive (if still unmounted from the GParted operation).
- Right-click inside the "persistence" partition and select "Open in Terminal"
- In the terminal, type

Code: Select all

sudo gedit live-persistence.conf
(Note: You're probably still running as a user within a live CD or USB instance, so you'll need escalated privileges to save a file in an external drive. Also, you can use any text editor, but I prefer Gedit).
- Inside the new document, type "/ union" (without the quotes).
- Save the document. It should appear inside the "persistence" partition.
7. From within a Linux or Windows operating system, change your new syslinux.cfg file to allow for persistence.
- Connect and mount your USB drive (it should still be mounted if you just finished adding the file to the "persistence" partition).
- Using any text editor, add "persistence" after "boot=live" in the "append" lines of both the unetbootindefault and ubnentry0 sections, so that those two sections look like this:

Code: Select all

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit boot=live persistence config live-media-path=/casper quiet splash --

label ubnentry0
menu label Start Linux Mint
kernel /casper/vmlinuz
append initrd=/casper/initrd.lz boot=live persistence config  live-media-path=/casper quiet splash --
8. From within the mint user in the LMDE USB installation, add your user, add your user to the sudo group, and change the root password.
- Reboot into your USB LMDE. It will boot into the live instance, with user "mint". Your DE will depend on which iso you dowloaded and installed, Mate or Cinnamon.

For Cinnamon:
- Click Menu --> Administration --> User Accounts
- Click + to add a new user.
- Click on "Account disabled" to open a window to add a strong password. Give your user a strong password.
- Close User Accounts
- Open a terminal. Type

Code: Select all

sudo adduser [youruser] sudo
. This adds your new user to the sudo group.
- Click Administration --> Login Window.
- Select the Security tab. Uncheck "Enable Automatic Login" and uncheck "Enable Timed Login" (if checked). Click Close.

For Mate:
- Click Menu --> Control Center --> Users and Groups
- Click + Add. Add your desired name and username. When prompted, give your user a strong password.
- Click Manage Groups. Click on "sudo" and then click Properties. Check the block next to your new user to add to the sudo group. Click OK. Click Close to exit Users and Groups.
- (Still in Control Center), click on Login Window.
- Select the Security tab. Uncheck "Enable Automatic Login" and uncheck "Enable Timed Login" (if checked). Click Close.

For Both:
- Open a terminal. (This must be done as user "mint" since that user is configured to automatically escalate privileges as root. Your new user won't be able to do this.)
Type:

Code: Select all

sudo su
passwd
- Give root a strong password that you will remember. You'll have to type it twice. (Hint: I gave root the same password as my new user - makes it easy for me to remember.) Type

Code: Select all

exit
exit
to close the terminal.
8. Voila! Click Menu --> Logout --> Switch User and log in as your new user. Your changes will be saved, you will be able to use your password when required, and you will also be able to input root's password when needed.

A couple of last notes. Mint Update doesn't work automatically in Live mode, even though it's enabled in Startup Applications, so you'll have to run that manually (I check at least weekly). Also, when you shut down, you will be cycled through MDM. Just click on the gear and select shutdown (or restart, or whatever you want) again. This is an artifact of the live version with an added user. For me, Mint 201303 live USB shutdown hangs, requiring a hard power-off.

Re: How To: Persistent Live LMDE USB Install

Posted: Thu Jun 14, 2012 8:56 pm
by sagirfahmid3
Excellent tutorial! I once made an UNofficial tutorial similar to yours (and using GParted), but that was about installing the main edition, not LMDE.
Just a suggestion: you should take screenshots of what you did (especially the partitioning bit; most users don't like messing with GParted for fear of messing up their systems) and post them here.

Good job :mrgreen:

Re: How To: Persistent Live LMDE USB Install

Posted: Fri Jun 15, 2012 11:00 am
by kwatson512
Thanks! I added some screenshots to the partitioning section.

Re: How To: Persistent Live LMDE USB Install

Posted: Fri Jun 15, 2012 7:13 pm
by sagirfahmid3
There we go, much more user friendly 8)

Re: How To: Persistent Live LMDE USB Install

Posted: Sat Jun 16, 2012 10:47 pm
by widget
I have been trying to do this and not succeeding.

First I have to say that I do not have any MS OS's installed. We don't even allow folks to bring things they own into this house if it has any MS stuff on it (laptops, phones, etc - I know we are weird but we hold a grudge real well).

I used the unetbootin package available here in my Debian testing install repo.

One difference is that the partition that the image is installed on is ext2 not fat16.

I am getting a great boot up of the live session of LMDE Xfce 201204 32bit. I do not get any persistence nothing shows up in the live-rw partition at all.

Am becoming alarmed at the idea that I may have to install Xubuntu 12.04 instead. This would be a real drag.

If there are any suggestions that you may have I will happily try them out.

Re: How To: Persistent Live LMDE USB Install

Posted: Sat Jun 16, 2012 11:17 pm
by kwatson512
@widget,

Sounds like you are at least halfway there. Is your core system Mint or Debian? Did you successfully create the live-rw ext2 partition? Were you able to use gedit or pluma to modify the syslinux.cfg file?

Re: How To: Persistent Live LMDE USB Install

Posted: Sun Jun 17, 2012 1:28 am
by widget
kwatson512 wrote:@widget,

Sounds like you are at least halfway there. Is your core system Mint or Debian? Did you successfully create the live-rw ext2 partition? Were you able to use gedit or pluma to modify the syslinux.cfg file?
I have several installs of Debian (Sqeeze for secure business, testing for everyday use and sid for fun), a couple respins including one of LMDE Xfce 64.

What I am trying to do this from is my testing install.

I don't have pluma on here, vim, gedit and mousepad are on here. Used gedit.

Actually put a 10+gig live-rw partition on here (32gig stick) as I will install several packages like testdisk and other recovery type things plus I need some music files. This will leave me with 16+gigs for crucial files that may want backed up before trying to recover something really broken.

Code: Select all

label unetbootindefault
menu label Default
kernel /ubnkern
append initrd=/ubninit boot=live persistent config live-media-path=/casper quiet splash --

label ubnentry0
menu label Start Linux Mint
kernel /casper/vmlinuz
append initrd=/casper/initrd.lz boot=live persistent config  live-media-path=/casper quiet splash --
is what is currently in the menu for the stick along, of coarse, with the other unmodified ones.

I am wondering if there is some difference between this version and the one you were using that is a problem (201204 xfce 32bit). Using 32bit as I would like it to boot and work on most computers. Mine is 64 but 64 bit stuff just doesn't run on 32bit boxes.

Would try a straight up install of the thing but would really need a small /boot partition to be more sure of booting with some bios. The LMDE installer is just not up to it (this is a shame on such a nice OS).

One reason I would like to use LMDE xfce is that I like it for noobs. If I were to do a rescue on someones box and they were interested in trying Linux I could let them play, on their box, with what I would recommend for them to use.

The package management scheme that they have come up with is very clever. I think it does a better job than Ubuntu does with their LTS releases (based on Debian testing) of taming the thing into stability.

Ran and tested ubuntu dev releases as my production OS for several cycles and just don't trust the Ubuntu folks much anymore. Feel bad about it but I just don't.

This is a fine OS for some one starting out and if they get feeling brave they can always go to the Debian testing repos. I think that is just great.

My Hdd install runs pretty much the default install, uses the default repos and is update/upgraaded the recommended way with UM. All my other installs are upgraded from here in chroot. I just want to watch how this thing acts in the long run in the intended way.

While I can't see me using it as my production OS it is perfect for what I want on this stick for what I want it for. Stable but using testing packages, a little behind testing but not much. Certainly up with Ubuntu at least righ before the release of their next version. Also using a much newer version of Xfce than Squeeze.

Re: How To: Persistent Live LMDE USB Install

Posted: Sun Jun 17, 2012 11:02 am
by kwatson512
@widget,

No, that looks identical to mine. The only difference I can ascertain is that my sdb1 partition is formatted to fat32. I don't know the inner workings of UNetbootin, but you might try installing it on a fat32 partition. I once had trouble with it on an NTFS-formatted partition. But since your live USB installation works, I'm not sure putting it on fat32 will make any difference. Maybe someone else can help here.

Sorry I couldn't be more help.

Re: How To: Persistent Live LMDE USB Install

Posted: Sun Jun 17, 2012 11:28 am
by sagirfahmid3
Widget, get to the point: did it work or did it not work, comments, and report any suggestions/useful feedback to watson. All I see in your posts is a lot of rambling Image
It doesn't have to be specifically LMDE; any Debian distro should work.

@watson, I tried this out with Crunchbang 10 (aka Debian Squeeze) and it worked :mrgreen: 8)

Edit: YOU MUST USE THE FAT FORMAT FOR A BOOTABLE USB!

Re: How To: Persistent Live LMDE USB Install

Posted: Sun Jun 17, 2012 12:03 pm
by widget
First I want to thank you for your concern and replies.

Second I have some new data. There is now persistence, at least some.

This came about due to my attitude that the system, if broken (no persistence = broken in this case), can't be hurt by anything I do. So I went huntig through the other files.

There were several of interest. One was ubnpath1.txt;

Code: Select all

isolinux
casper
.disk
and another was extlinux.conf which included the same stuff as syslinux.cfg. I edited it to match syslinux.cfg.

Moving to /isolinux I found /isolinux/isolinux.cfg which included everything from /syslinux.cfg except it had no mention of the "Default" menu entry.

I edited the "Start Linux Mint" entry to include persistence.

So, I reboot to the stick. Found that my vastly superior skills at breaking systems has not diminished in the least.

Thing tried to boot from the Start Linux Mint option. Took for ever but got to the login eventually. Type mint and hit enter. Got a black screen with the Xfce4-panel that did not function.

Reboot and try the Default entry. Same deal.

Reboot and get to login screen and go to tty2 (Ctrl+Alt+F2). Log in and type startx.

X does not exist. OS thinks it is not installed or is broken.

sudo su to a root prompt (#). Run apt-get update and apt-get upgrade. 4 packages (FF and TB). This seems to work and the purpose was to see where it went, if anywhere, when I could check later.

Try startx from #, same deal.

Run apt-get install xorg xserver-xorg-core. Xserver-xorg-core at newest version installed some fonts and xorg.

To to user prompt (Ctrl + d takes me back to $) and startx again. Fails again but because .Xauthority is not right. And the advice to remove some /tmp file (forget exact path - senile). Tried rm /tmp/whatever-it-was and was told it did not exist.

Run adduser tom and set that all up with a password and full name.

Run su tom and try startx. Same Xauthority problem.

Back to user mint and # and reboot. Doesn't work so Alt+SysRq+b and come home to Debian testing.

Look at gparted and live-rw has more used space. Go to thunar and sure enough I have 2 directories in there mint and tom. .Xauthority is an empty file.

Transplant mine from here, will have to chown it when I go back to tom.

For some reason the tom directory is owned by sam. Who the hell is sam? Beats me.

Will report any progress or lack there of from my next visit.

Again, any hints or thoughts you may have are much more than welcome. It is obvious that something I edited needed to be and the errors are probably from editing one that shouldn't have been. Which of the 2 should or should not be edited is beyond me.

This is FUN.

Re: How To: Persistent Live LMDE USB Install

Posted: Sun Jun 17, 2012 1:49 pm
by kwatson512
@widget,

Before there was a UNetbootin, we had to make USB installs by burning files from a downloaded iso file into a directory on the USB drive, changing the name of the isolinux directory and isolinux.cfg file to syslinux, and then downloading and installing the syslinux bootloader. UNetbootin automates all that now.

Isolinux is still used by most distros, including LMDE.

From the syslinux wiki,
SYSLINUX is a boot loader for the Linux operating system which runs on an MS-DOS/Windows FAT filesystem. It is intended to simplify first-time installation of Linux, and for creation of rescue and other special purpose boot disks.
Part of what UNetbootin does is to rename the appropriate isolinux files and directories to syslinux and install the syslinux bootloader.

I haven't duplicated this, so I can't confirm this is what is happening to your install, but I believe UNetbootin is defaulting to either isolinux or extlinux because of your sdb1 ext2 filesystem, and then the pointers go to nonexisting directories, which interrupts the process.

I would recommend trying again from scratch, this time formatting sdb1 to fat32. You might not have to modify your live-rw partition, so once you make the installation persistent and create your user it should find that on reboot. Worse case, just rebuild the whole thing.

Here's more detail on syslinux, isolinux, and extlinux.

Re: How To: Persistent Live LMDE USB Install

Posted: Mon Jun 18, 2012 12:12 am
by widget
I think I have hit a dead end on this so that is exactly what I will try.

The only problem with that is that is exactly what I intended to do this time. There was a pop up window came up and informed me that ext2 was required.

Now, I do not remember if I had the thing formated to fat at the time or not.

One way to find out is to give it a whack. I think I can do that.

I can say that if I am not trying to boot to persistence the bugger loads quickly. Pretty impressive.

Was too lazy, and kind of burned out on the project, today. Played with Mageia2 instead over on my external. Kind of a clear the air type of thing. Got the sound working. Learned a lot about using the crazy RPM based urpmi/urpme CLI package management. That is kind of a hoot. Makes me really appreciate the APT system every time I use an RH branch OS. Will say this for Mageia, if you prefer gui package management theirs is the best there is in the RH branch. Their gui config tools are superb too.

Really a nice system until something goes wrong and you need a manual at hand to do anything in chroot. Compared to Debian, and Mandrake forked from Red Hat very early so it really is a fair comparison, the documentation is terrible.

Back on topic. I doubt my job will go all day tomorrow. Weather does not look promising at all. Will probably be giving it that whack tomorrow. Will give the ghastly ordeal report some time tomorrow evening. Would love to do it from there.

If not probably from my actual install of the 64bit version of that same release. Need to get over there and play some.

All my new distros go on my external test platform. My LMDE Xfce install is actually my second install. It got promoted to my sdb internal. Have 6 installs on these 2 drives. That is the only one that is not straight up Debian. (Squeeze, Wheezy, testing (difference strictly in the repo name), 2 sids and LMDE Xfce.

Re: How To: Persistent Live LMDE USB Install

Posted: Mon Jun 18, 2012 10:02 am
by kwatson512
Thinking about this logically, here's another thought:
- The isolinux directory has the files needed to boot the live iso (live CD/DVD).
- UNetbootin copies that and renames it to syslinux to boot live in an MSDOS/FAT32 environment (live USB).
- It makes sense that UNetbootin might be file-system aware enough to copy/rename the isolinux files to extlinux for an ext2/ext3 environment. (I don't have an extlinux file or directory, and my partition is formatted to FAT32.)
- So, that could explain how you get a good live boot, but no persistence from your ext2 partition.

If you want to keep your ext2 filesystem, you might try adding "persistent" to the appropriate APPEND lines in your extlinux.conf file. (You have done a lot of configuring, so I would do a clean install on this partition either way you go.)

If that doesn't work, I'm pretty confident using FAT32 will.

Good luck, and let us know!

Re: How To: Persistent Live LMDE USB Install

Posted: Mon Jun 18, 2012 3:04 pm
by widget
I have already done that edit in the exelinux file. That may be what gives me the persistence that I get but I can't get to a gui desktop.

Fat32 is what I am going to try and do a bit later today. Don't know if it will work but it will be interesting anyway.

Thanks for the info that you do not have that file. That is real nice to know.

I, personally, think that one of the main problems with a lot of "cross platform" programs is that they are written with the assumtion that MS will be used, by preference, and Linux compatibility tacked on as a sop to the nuts that use it all the time and to make the dev feel good about him/her self.

While I can, grudgingly, admit that some folks may actually need MS on their box, I find it really hard to imagine anyone using it by preference.

Re: How To: Persistent Live LMDE USB Install

Posted: Mon Jun 18, 2012 10:06 pm
by widget
I am truly bummed.

Set everything up and rebooted into the thing. Used auto login although I had changed the setting.

Opened with user mint. Had saved the changes made to the desktop. Pretty happy about that.

Went to the menu and tried to open the Login Window gui and the thing went to a black screen with text rolling like you would get on log out or shut down. Was some message about "this server has closed" right at the top of the page and scrolled out of site before I got a look at anything else in the line.

Then all it would do is try to boot and then just go to a black screen.

Tried editing the /isolinux/isolinux.cfg file to have persistence in it. That does get mention of the ext2 partition in the text at boot up but the old song and dance about a deleted i/o node and then the black screen at the end.

I am on my LMDE Xfce install and I am going to delete the contents of the live-rw partition and see if it will boot without anything there and the isolinux.cfg file edited. If so I will go through the ordeal again and see what happens.

If that doesn't work I may try reformatting the live-rw to fat32 and remove persistence from the isolinux.cfg which will probably just not work at all but is the last thing I can think of.

Re: How To: Persistent Live LMDE USB Install

Posted: Mon Jun 18, 2012 10:13 pm
by kwatson512
Your live-rw partition must be in ext2 or ext3. The boot partition is the one that syslinux expects to be in FAT32.

Re: How To: Persistent Live LMDE USB Install

Posted: Mon Jun 18, 2012 10:18 pm
by widget
kwatson512 wrote:Your live-rw partition must be in ext2 or ext3. The boot partition is the one that syslinux expects to be in FAT32.
OK, that saves me the bother of trying that. Figured that may be the case.

Just tried to boot after wiping live-rw. Still will not boot with isolinux.cfg edited. May as well remove that edit and see if it boots. If so I will try all that again and see if it works.

If not it looks like Xubuntu time and I just do not like that option at all.

Re: How To: Persistent Live LMDE USB Install

Posted: Mon Jun 18, 2012 10:35 pm
by widget
Nope. Must write something to the fat32 partition too when you set up the persistence. That makes sense.

Thought about trying the 32 bit LMDE Gnome image I also have but that makes no sense. They do not build the Xfce version from the Debian testing Xfce version. They simply build it from the Gnome version, adding Xfce and removing the Gnome desktop. At least there is enough Gnome stuff in here that when you are booting the cursor goes to the top left corner of the screen. This only happened for me when I added Xfce to a Debian Gnome install. Did it after the removal of Gnome. Doesn't do that if installed directly as Debian Xfce.

My problem is somehow with Xorg anyway. Sucks but I am at a complete dead end.

This installed LMDE Xfce works great. Have John Hiatt blasting Master of Disaster to make me feel better.

Re: How To: Persistent Live LMDE USB Install

Posted: Tue Jun 19, 2012 2:38 pm
by Dilaceratus
Thank you very much for creating your tutorial. This was exactly the information I was seeking, and your method worked perfectly.

Re: How To: Persistent Live LMDE USB Install

Posted: Thu Jul 26, 2012 4:47 pm
by sagirfahmid3
Hey dude, I just tried it with a Remastersys custom Debian Squeeze (Xfce) custom iso and it worked as well! :mrgreen: