You are not logged in.

#1 2019-12-07 11:44:40

fl4m3ph03n1x
Member
Registered: 2017-07-27
Posts: 26

How to isntall BunsenLabs in a USB disk with persistence

Background

I am trying to install BunsenLabs in a USB stick however I can't get the bootloader to recognize my USB stick has BunsenLabs inside it.

What I tried

I have 2 USB sticks. In one of them I placed the BunsenLabs image using win32diskmanager and the other one was left blank. The idea here is to have a BunsenLabs on a stick, ready to go wherever I go, with persistence, so I can have my work setup always ready to go on a USB stick.

The configuration went fine, my USB stick has 14GB of space, so I left out 3GB for swap (machines I work with have between 4GB and 8GB of RAM) and the rest for BunsenLabs.

I also installed the GRUB on the USB stick, leaving the original machine untouched.

Problem

The issue here is that no machine recognizes that my USB stick has an OS inside it and so I never get to boot it.

I know there is a Live image of BunsenLabs, but that is not what I want, I want something with persistence that saves my changes.

What am I doing wrong?

Last edited by fl4m3ph03n1x (2019-12-07 11:46:54)

Offline

#2 2019-12-07 16:02:34

Sector11
Conky 1.9er Mod Squid
From: Upstairs
Registered: 2015-08-20
Posts: 6,438

Re: How to isntall BunsenLabs in a USB disk with persistence

I'll go out on a limb here and say:

Where did you go wrong: win32diskmanager

Try this: Side-BunsenLabs_LivePersistent


The sun will never set if you keep walking towards it. - my son
Being positive doesn't understand physics.
_______________________________
Debian 10 Buster = SharpBang ♯!

Offline

#3 2019-12-07 22:58:50

fl4m3ph03n1x
Member
Registered: 2017-07-27
Posts: 26

Re: How to isntall BunsenLabs in a USB disk with persistence

I tried using that but the script fails to encounter the iso image. Aparently now the images are called .hybrid.iso and the script is looking for an image just called .iso.

Even changing the name of the image and placing it in the same folder of the script doesn't make it work. A real shame.

Additionally, I would just like to point out that using win32diskmanager to create a bootable USB stick is the recommended way of creating Bunsenlab USB stick according to this same forum.

Thanks for the help though.

Last edited by fl4m3ph03n1x (2019-12-07 22:59:22)

Offline

#4 2019-12-08 08:28:11

damo
....moderator....
Registered: 2015-08-20
Posts: 6,336

Re: How to isntall BunsenLabs in a USB disk with persistence

fl4m3ph03n1x wrote:

...
Additionally, I would just like to point out that using win32diskmanager to create a bootable USB stick is the recommended way of creating Bunsenlab USB stick according to this same forum.
...

This forum? The canonical information is on the Bunsenlabs Installation page:

After downloading the ISO file from one of the sources below, you may find help with burning the file to disk or writing to a USB key in the Debian FAQ section:

    How to write an ISO image under Linux/Unix, Windows or Mac OS X?
    How to write a CD/DVD/BD image to a USB flash drive?

Regardless, there is always the chance that the usb stick is faulty. Have you tried another one?
Did you set your BIOS to boot from an external drive?
Some machines don't recognize usb3 in a usb2 port.


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#5 2019-12-08 10:50:36

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 693

Re: How to isntall BunsenLabs in a USB disk with persistence

The linked debianpage recomend use win32diskmanager to write iso to usb-disk on an windows pc!

You dont have access to an Linux pc?

I prefer to make an ordinary install to external usb-harddisk for bringing linux with me, without carrying whole laptop. Aint that a solution?

If you will continue with persistent live-dist, you should consider not autonatcley activate swap. With 4-8 GB ram, you should make it without. Contious writing with Swap age the usb-pin.


// Regards rbh

Online

#6 2019-12-08 14:59:09

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 693

Re: How to isntall BunsenLabs in a USB disk with persistence

I have finaly found my box with mispalced usb-thumbdrives.

Started to look at https://github.com/RoiArthurB/Side-Buns … Persistent.

In the script, I have changed row 90 to:

90 archi=cd-i386

And all occurances of $blVersion-$archi.iso to $blVersion-$archi.hybrid.iso.

Now running the skript and it downloads helium-5-cd-i386.hybrid.iso to /tmp/toto1233. (Takessometime...)

Probabley the skript would skipped downloading if I had copied the iso to the above directory.

Will report back later.


// Regards rbh

Online

#7 2019-12-08 15:41:55

fl4m3ph03n1x
Member
Registered: 2017-07-27
Posts: 26

Re: How to isntall BunsenLabs in a USB disk with persistence

damo wrote:
fl4m3ph03n1x wrote:

...
Additionally, I would just like to point out that using win32diskmanager to create a bootable USB stick is the recommended way of creating Bunsenlab USB stick according to this same forum.
...

This forum? The canonical information is on the Bunsenlabs Installation page:

After downloading the ISO file from one of the sources below, you may find help with burning the file to disk or writing to a USB key in the Debian FAQ section:

    How to write an ISO image under Linux/Unix, Windows or Mac OS X?
    How to write a CD/DVD/BD image to a USB flash drive?

Regardless, there is always the chance that the usb stick is faulty. Have you tried another one?
Did you set your BIOS to boot from an external drive?
Some machines don't recognize usb3 in a usb2 port.

The official page you mention redirects to here:

https://www.debian.org/CD/faq/#write-usb

Which recommends the tool I used. The USB stick is not faulty, that I am sure of. The script failed execution.

@rbh,thanks for reporting it, I thought it was just me.

Offline

#8 2019-12-08 19:18:29

rbh
Member
From: Sweden/Vasterbotten/Rusfors
Registered: 2016-08-11
Posts: 693

Re: How to isntall BunsenLabs in a USB disk with persistence

fl4m3ph03n1x wrote:

I know there is a Live image of BunsenLabs, but that is not what I want, I want something with persistence that saves my changes.

But you want the liveimage withpersistence, or more generalley to bring your custom setup linux with you.

One way, is to boot the static live dist and merge changes from an other "persistence partition". After the session, save new changes to the "persistence partition".

It does matter which operating system is used when creating bootmedia. here is on simpletutorial for debian: https://www.linux.com/tutorials/creatin … on-techies.

One very easy method is to use a live dist specificaly created to be used on usb-thumbdrives: Slax - https://www.slax.org. Slax is easy to apply, both from linux and windows. It is debian based and very lean.

The downside of this method is that you can notdo afull system upgrade.

The other method is full installation on an usb hd/ssd. An M2 ssd, is not so much bigger tnan an bigthumbdrive..

BTW, I havent gott the script https://github.com/RoiArthurB/Side-Buns … sistent.sh to work. Havent got the time to debug it either.

Last edited by rbh (2019-12-08 19:21:48)


// Regards rbh

Online

#9 2019-12-08 21:34:04

ohnonot
...again
Registered: 2015-09-29
Posts: 4,926
Website

Re: How to isntall BunsenLabs in a USB disk with persistence

fl4m3ph03n1x, just to make sure we're on the same page:

  • you have 2 usb sticks

  • one is a working bunsenlabs live medium

  • you want to install bunsenlabs on the 2nd stick, or rather, you don't want to fully install it, but you want to use the bunsenlabs live environment to create a "Live with persistence USB" on the 2nd USB stick?

And the machine has Windows only installed?


BL quote proposals to this thread please.
my repos / my repos

Offline

#10 2019-12-08 23:35:24

fl4m3ph03n1x
Member
Registered: 2017-07-27
Posts: 26

Re: How to isntall BunsenLabs in a USB disk with persistence

ohnonot wrote:

fl4m3ph03n1x, just to make sure we're on the same page:

  • you have 2 usb sticks

  • one is a working bunsenlabs live medium

  • you want to install bunsenlabs on the 2nd stick, or rather, you don't want to fully install it, but you want to use the bunsenlabs live environment to create a "Live with persistence USB" on the 2nd USB stick?

And the machine has Windows only installed?

1. Correct
2. Correct
3. I want to install bunsenlabs on my 2nd stick as a full OS. Having a "Live image with persistence" was the the easiest way I found on how to achieve this. I would much prefer to have my custom setup and full OS on the stick rather than a simple Live image with persistence.
4. Yes, I only have Windows installed.... dont judge me! sad

Offline

#11 2019-12-09 00:38:30

hhh
Meep!
Registered: 2015-09-17
Posts: 10,582
Website

Re: How to isntall BunsenLabs in a USB disk with persistence

Here's my tutorial for helium/stretch 64 bit, I haven't tested it in a long while though. Also, I'm running buster now as we're about to release a lithium test ISO so I can't re-test it, but maybe this will help...

https://forums.bunsenlabs.org/viewtopic.php?id=4864

Offline

#12 2019-12-10 05:14:43

AndrewSmart
Member
Registered: 2019-06-10
Posts: 22

Re: How to isntall BunsenLabs in a USB disk with persistence

I've used usb+persistence for 10ish years now as my primary "system". I have incomplete notes here https://forums.bunsenlabs.org/viewtopic … 102#p88102

My guide has no wizard/script. Sorry the guide needs work. The method isn't too user friendly as if libc or linux-image are upgraded you have to handle them specially or the usb won't boot again. If you stick to Debian stable it's an infrequent chore.

You don't have to prune the squashfs like I did in my guide.

Gist is you label the second partition 'persistence' with a persistence.conf file on it, and boot with the kernel parameter 'persistence', and Debian will figure it out from there. First partition is labeled 'live' and has the initrd, squashfs, vmlinuz on it. No iso file on the first partition or isolinux stuff. I guess other methods of persistence are out there, like snapshots, isolinux.

Last edited by AndrewSmart (2019-12-10 05:23:40)

Offline

#13 2019-12-10 21:01:50

ohnonot
...again
Registered: 2015-09-29
Posts: 4,926
Website

Re: How to isntall BunsenLabs in a USB disk with persistence

fl4m3ph03n1x wrote:

I want to install bunsenlabs on my 2nd stick as a full OS. Having a "Live image with persistence" was the the easiest way I found on how to achieve this. I would much prefer to have my custom setup and full OS on the stick rather than a simple Live image with persistence.

Those are two different things.
You can install BL on the second USB stick, just like you would on a hard drive, but there's a few pitfalls - and poor performance even on USB3.
I would assume that "Live image with persistence" is what you want.
You can also look at AntiX Linux, it offers this OOTB.


BL quote proposals to this thread please.
my repos / my repos

Offline

#14 2019-12-11 23:21:35

AndrewSmart
Member
Registered: 2019-06-10
Posts: 22

Re: How to isntall BunsenLabs in a USB disk with persistence

I use live+persistence on USB2. A more modern USB drive really helps, as does USB3 ports. On USB2 on a EEEPC 900A netbook it takes about a minute to boot, and a 1-3 seconds to shutdown (longer shutdown if pending on disk activity, like you can't shut down the browser and immediately shutdown until the queued up USB I/O is done). I think live+persistence is better than full install to USB, because its compressed so is read quicker, 'toram' also occupies less memory as its compressed in RAM too AFAIK.

But with USB3 and newer USB sticks getting faster and faster I guess a full install to the USB might be reasonable now... (I won't do benchmarks or try it, no time/interest). A full install to USB was completely unreasonable back in USB2 era. My hunch is a full install can never be as quick to boot and as responsive as live+persistence (due to compression + toram), but it might be bearable/tolerable enough now.

I can't help you with getting a computer to recognize there is an OS on your USB. I'd suggest looking at the "BIOS" options, if its EFI hardware that refuses to handle "legacy" standards, or whatever.

This is what I've done, scraped together from old #! forum posts, and hours and hours of trial-and-error research/investigations on my part.

Here is a pseudo guide for my live+persistence setup:

  1. Partition USB like [img=https://drive.google.com/file/d/1Q51-3wwnHxqpKPxKT8f2X2pOVTnjjYTZ/view]this[/img]. Open image in new tab to view.

    • Must have a partition named 'live' and one named 'persistence'.

    • 'live' partition should have boot flag.

    • Swap file on USB will probably slow down the OS, and reads/writes too much. Instead I'd suggest mounting a local HDD (ext4/ntfs) sticking a ~2GB file on it and mounting that as a swap file, if you need it.

      fallocate -l 2G swap.img #https://stackoverflow.com/questions/257844/quickly-create-a-large-file-on-a-linux-system
      chmod 600 swap.img
      sudo mkswap swap.img
      sudo swapon swap.img
  2. Install grub to the usb (find a guide elsewhere on how to do this because I don't remember how).

    • 'live' partition /boot/grub/grub.cfg:

      set timeout=3
      set default=0
      
      menuentry "bunsenlabs lithium - Debian buster 64bits - by UUID - Persistence" {
        #Enter the UUID of your boot partition (this is where grub and your kernel reside)
        set uuid_grub_boot=ab3920b1-2d3f-4bf8-9da1-27bc2b5c9e2f
        #Enter the UUID of the persistence partition.
        set uuid_os_root=aedab356-05bc-4e30-ba77-6317b0210c7e
        #Here we set the grub "root" variable by locating the uuid of the root partition identified above
        search --no-floppy --fs-uuid $uuid_os_root --set=root
        #Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above
        search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot
        #Here's the magic. We test to see if the boot and root partitions have the same UUID.
        #If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.
        if [ $uuid_grub_boot == $uuid_os_root ] ; then
          set grub_boot=$grub_boot/boot
        fi
      
        linux ($grub_boot)/live/vmlinuz boot=live config quiet noeject toram persistence persistence-storage=filesystem live-media=/dev/disk/by-uuid/$uuid_grub_boot
        initrd ($grub_boot)/live/initrd.img
      }
      
      menuentry "bunsenlabs lithium - Debian buster 64bits - by UUID - Live" {
        #Enter the UUID of your boot partition (this is where grub and your kernel reside)
        set uuid_grub_boot=ab3920b1-2d3f-4bf8-9da1-27bc2b5c9e2f
        #Enter the UUID of the persistence partition.
        set uuid_os_root=aedab356-05bc-4e30-ba77-6317b0210c7e
        #Here we set the grub "root" variable by locating the uuid of the root partition identified above
        search --no-floppy --fs-uuid $uuid_os_root --set=root
        #Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above
        search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot
        #Here's the magic. We test to see if the boot and root partitions have the same UUID.
        #If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.
        if [ $uuid_grub_boot == $uuid_os_root ] ; then
          set grub_boot=$grub_boot/boot
        fi
      
        linux ($grub_boot)/live/vmlinuz boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot
        initrd ($grub_boot)/live/initrd.img
      }
    • Replace the UUIDs above with your usb partition UUIDs (my UUIDs won't work for you!). UUIDs are used instead of sda/sdb/(hd0,1) or whatever like you'd see in other guides so that you can move the USB from workstation to workstation with no problems. The 'live-media' kernel parameter I've learned is necessary for this reason (IIRC, it seems to get confused without it).

    • I have these kernel parameters in mine, I'm not sure if they're necessary, add them if so: 'usbcore.autosuspend=-1' and 'elevator=as'. I'd added them in past troubleshooting or speed enhancement investigation.

    • In my experience I'd found when moving from #! to bunsenlabs that the 'live' boot (non-persistence) no longer works, with some sort of login error message that flashes away before you can read the error message. It may have something I unintentionally did when pruning the squashfs? Both the GUI login and the virtual terminals (ctrl+alt+f#) won't work due to this login authentication failure (u:'user' p:'live' flashes the error message). So use 'init=/bin/bash' kernel parameter if this is the case for you, to log in as root to fix whatever is broken (I boot in 'live' mode to fix 'persistence' mode if it isn't working).

    • IDK WTH to do about newer GRUBs not making grub.cfg, if its deprecated or whatever, sorry. This is what I do. Grub changed on me so I think I moved grub.cfg around until it worked, so I think that is the right spot.

    • The 'toram' kernel parameter is very useful.

      • With 'toram', you can modify the 'live' partition if you need to, otherwise it's mounted ro and can't possibly be mounted rw.

      • You'll need to use this if you update libc or linux-image (kernel) package. Consider this a maintenance operation. This is so that the squashfs on the 'live' partition is not incompatible with stuff on the 'persistence' partition. E.g. if you install 'testing' libc through apt, it will install to 'persistence', and everything works fine until you reboot. Then it won't boot again because 'live' partition's libc in squashfs (and initrd?) is incompatible with newer libc stuff in 'persistence' partition, so you'd get a segfault or whatever on boot. So before reboot we need to "resquash" live+persistence union back into squashfs file, and update vmlinuz+initrd to 'live' partition so that there is no incompatibility. The apt scripts write them to /boot on the 'persistence' partition and we need to manually move them to the 'live' partition at /lib/live/mount/medium/boot/. EDIT: If you update libc and you forgot to do this and get a segfault, guess what, you can still boot in 'live' mode with no segfault, copy /boot/initrd from 'persistence' partition to 'live' partition /boot/, and resquash if necessary. It's a chore but it will get live+persistence working again.

      • My netbook only has 2GB RAM so I don't use 'toram' on this netbook. The OS runs noticeably faster with 'toram' on a slow USB so consider it if you have plenty of RAM (and have a bottleneck on USB I/O slowing the system down).

      • EDIT:On my desktop with 8GB RAM I always have 'toram' in grub.cfg. I never install linux to HDD anymore, always USB, I can change machines at drop of a hat! Video driver setup difference sometimes causes a problem though, e.g. moving from NVIDIA machine to Intel GPU, so I have to boot in 'live' mode to fix that.

  3. On second partition, put a file named 'persistence.conf' on it, containing "/ union" (no quotes, just those 7 characters). This file contains directives on how to mount the union filesystem, you can do more sophisticated setups if you want, look up documentation elsewhere.

  4. Let us extract a bunsenlabs iso, and put relevant files into 'live' partition:

    • sudo mkdir /media/iso
      sudo mount -o loop lithium-dev-4-amd64.hybrid.iso /media/iso
      cd /media/iso/live
      #copy vmlinuz, initrd.img, filesystem.squashfs from here to 'live' partition
    • 'live' partition will have following structure:

      /boot/
        grub/
          fonts/
          grub.cfg
          grubenv
          i386-pc/
          locale/
      /live/
        filesystem.packages.xz   #optional for your own bookkeeping, compress if you want
        config-4.9.0-8-686-pae   #optional, Debian has wiki page for conventions regarding these /live files, this one contains kernel build options IIRC, nice to know sometimes
        filesystem.squashfs      #necessary!
        initrd.img               #necessary!
        vmlinuz                  #necessary!
    • folders have root:root and drwxr-xr-x permissions.

    • files have root:root rw-r--r-- permissions.

    • Simple, right! With the 'persistence' kernel parameter, and 'persistence.conf' file Debian will figure everything out and boot in live+persistence mode. No isolinux involved (stream decompressing large .iso to obtain these files in order to boot or whatever isolinux entails), this is very "minimalist" approach.

    • Just make sure 'live' partition is large enough to hold these files. In my linked "guide" I illustrate how to prune the squashfs to a much smaller size so that it boots faster.

      • You can skip this pruning of the squashfs to trial this USB setup out.

      • Actually, you might have to chroot into the squashfs anyway and 'adduser user' in line with my linked "guide". You didn't use to have to do this with #!, something about a live-scripts change makes this necessary, something about the user 'user' not existing in /etc/passwd during boot (it's added by the live-scripts too late in boot so errors happen from what I recon). So if you get problems then you'll want to do this...

      • For large frequently updated packages (e.g. chromium browser, java) it doesn't make sense to have those in 'live' partition's squashfs, they make more sense on 'persistence' partition.

      • Same thing with large font packages not used by system to boot.

      • I also have linked guide to do "resquash" of the squashfs file down the road. Consider the case of if you updated a ton of packages, so they exist not just in the squashfs but in the 'persistence' partition as well. So when you boot they're read from the USB not once, but twice, with "twice" the space consumed. But, the copy on the persistence partition is also larger as well as it's uncompressed, while the squashfs is compressed. So this makes the boot much slower and takes up USB space! I'd run out of room on a 4GB stick just from updates. With USB2 and old slow small USB drive, I'd occasionally "resquash" the squashfs to speed up the boot and free up space so I could continue to install new packages, but I'd recon this isn't worth the labor with newer USB sticks and USB3.

      • EDIT:On 4GB USB with live+persistence, you'll have to resquash to free up space maybe once or twice a year. I suggest a larger USB stick, I use 32GB now.

I looked at your post history and you wrote something about a secure environment. I think this setup is neat as say, if malicious software gained root access and replaced stock ABC library with malicious copy (or injected malicious code into it or whatever) you'd see the change on the 'persistence' partition, and the stock ABC library would be intact on the 'live' partition because its ro. Nice and clean separation of stock and "modified" components.

Anyways, I hope this helps. I love this setup. I added many of my thoughts in case they're relevant. I think this could be a nice "selling point" of any lightweight Debian distribution if persistence was packaged for use on USB so that the user doesn't have to think about or deal with those maintenance details. Like this, with:

  • A hook on apt pre-update to block the update if 'persistence' in the kernel parameter list, 'toram' isn't in kernel boot parameter list and libc/initrd is being updated (or whatever).

  • A hook on apt post-update to remount the 'live' partition /lib/live/mount/medium from ro to rw, and update initrd (and squashfs if libc?) to move /boot/initrd to /lib/live/mount/medium/boot/initrd.

I may have missed something, if you encounter problems write back here.

Last edited by AndrewSmart (2019-12-13 20:52:28)

Offline

Board footer

Powered by FluxBB