1

I have a working liveboot usb, with persistence. It has two partitions, one being the actual os, the other containing an image file that is the persistence.

The desired result is a live usb with one partition, and in the root of that partition is an image that is mounted read only to /home. This is so I can easily swap out configs in /home/user, without having to run lb build each time, and then dd it to each flash drive.

I've spent a bit of time trying to get it working with persistence, but there are two problems. Firstly, when booting, live debian seems to not check for a persistence file in the root of the live medium. Furthermore, I can't get it to do persistence read only. I had been trying with the persistent-read-only boot flag. Couldn't find much documentation on it, but it's mentioned here. Does not work, however.

At this point, I'm pretty sure persistence is not the correct way to go, and the better option would be some kind of boot script to mount an image to /home. This is theoretically simple enough, as the root of the medium is always at /lib/live/mount/medium, but I'm unsure of the correct way to go about actually mounting an image. The two options as I see them are:

  • a boot script
    • If I were to try to use init.d, it needs you to run update-rc.d, which I can't do here
    • silly option would be to put a script in /etc/skel/.bashrc or whatever, and have it rm everything in /home and then mount the image, but that's a wee bit horrifying.
    • Live-Build startup scripts are only mentioned here , which is extremely outdated, and obviously useless. This looks to have been replaced by boot hooks, but I don't have /lib/live/config/ to examine, and I'm going to wait on a suggestion for the proper method before attempting to follow up on this
  • fstab
    • Unsure if using fstab to mount an image to /home would happen before or after live debian creates a new user from /etc/skel, as trying to mount to a populated directory isn't going to work.

So either how do I get a boot script to run in a not horrifying way, or would just copying the fstab from a running live version, modifying it to have an image, and putting that in config/includes.chroot/ect/fstab work?

UPDATE:

So I tried using fstab, and it was mounted read only, and then I couldn't login on the gui portion of the system as it couldn't lock .Xauthority. Unsure how to proceed, I think it will be learning how the live system can pretend to accept changes, and then not write them and do that. Unsure how to do that or word the query, however.

0

The solution I got working was in fact to us fstab, but the important bit is using aufs, as explained here.

Final fstab looks like

# <file system>                 <mount point>   <type>  <options>                      <dump>  <pass>
/lib/live/mount/medium/home.img /mnt/homeRO     ext4    ro,auto                         0       0
none                            /mnt/ramFS      tmpfs   size=50M                         0       0
none                            /home           aufs    br:/mnt/ramFS:/mnt/homeRO=ro    0       0

Unsure if it would be better to put the tmpfs in /tmp or in /run/shm or something, but it's running and I don't care.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.