[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debian 11 Live USB with persistence?



El mié, 18 ago 2021 a las 8:38, Anssi Saari (<as@sci.fi>) escribió:
>
>
> I've tried a couple of ways to get a USB stick to boot (bios not efi)
> with persistence from debian-live-11.0.0-amd64-kde+nonfree.iso. Just
> stuffing that to the stick produces a working stick, just no
> persistence.
>
> The sparse instructions at
> https://wiki.debian.org/DebianLive/LiveUsbPersistence result in a stick
> that doesn't boot. Blinking underscore text cursor top left of the
> otherwise black screen. So syslinux doesn't even start.
>
> Using mkusb-minp and the instructions at
> https://help.ubuntu.com/community/mkusb/minp/details I end up with a
> black screen with a movable mouse cursor. So KDE tries to start but gets
> stuck somewhere. I can switch to a virtual console and kill sddm but
> trying to start KDE with startx ends up in the same situation
> again. Granted, the instructions are for Debian 10.
>
> Also, somehow mkusb-minp seems to do changes to the live system that I
> really don't like. Other than messing up KDE it also seems to go and
> mount all partitions RW and feels free to run fsck on them too. Wild for
> a live system and I'd really rather it didn't do that. Straight up live
> system doesn't do that or at least I haven't noticed (and I'm pretty
> sure I'd notice.) I hope this is not a common idea on how a live system
> with persistence should behave?
>
> A quick try with GRML and their tool grml2usb seems to work for text
> boot. I guess I can see what happens if I install plasma-desktop or
> actually task-kde-desktop on it.
>
> Anyways, any known working methods? The goal here is to try out Nvidia's
> proprietary drivers in Bullseye before updating. I'm sure I can do that
> without a DE to save some time come to think of it. My attempts to use
> drivers from the nvidia-driver package in a live system hasn't been
> successful so far, no image from the card. It might be caused by the
> nouveau driver loading automatically. That's why I'm trying to get
> persistence going, so that I can reboot with nouveau blacklisted.
>
> Hoping for answers.

Hi.

I wanted to do something exactly like that some months ago.
What I ended up doing is using a normal Debian installation
with an overlay file system mounted over the root.
It is too tricky to get the live images working with persistence.

Well, try this.  Install Debian with a normal ISO image from your disk;
you need to boot with the linux and initrd.gz from here:
https://ftp.debian.org/debian/dists/bullseye/main/installer-<arch>/current/images/hd-media/

                         ^
Substitute <arch> with the corresponding string to your architecture
(i386, amd64, etc).

>From this installer you can find the ISO in your disk and install
Debian in your USB,
or in a virtual machine and then copy with "dd" the disk image to your USB.
Then, change whatever you need to change.
After that, you will need to boot from the USB adding "break=bottom"
to the command of linux; which, for convenience, you can achieve modifying
the /boot/grub/grub.cfg in your USB and not have to do it every time you boot
pressing "e"; or do this last thing if you pretend to boot the USB only once.

>From the spawned shell you need to make a directory both in the rootfs
and in /root/ (here this is the USB, not root's home directory).
Mount a tmpfs over the directory in the rootfs.  Create three
directories in there
which you will use as the lowerdir, upperdir and workdir options of the overlay.
Patch /root/etc/fstab to reflect the final mounts you will have when finished;
you can do this at the end, but the patch would be lost then.
Run "modprobe -d /root/ overlay" to load the overlayfs module.
Check that /root/ is mounted as read-only; if not, fix it.  Mount
/root/ with "--bind"
at /dir/low/ (replace as appropriate, "dir" is the directory you made before
where the tmpfs is mounted).  Unmount /root/ (this is necessary).
Now, mount this:

mount -t overlay -o
lowerdir=/dir/low/,upperdir=/dir/up/,workdir=/dir/work overlay /root/

Mount with "--rbind" the tmpfs to the same directory you made in /root/.
Unmount the tmpfs and its submounts from the rootfs.
Exit from the shell.

You should get a normal Debian system with a read-only filesystem
and a temporary space for modifications.  I like to mount everything with the
noatime option also.

Some programs fail to work because AppArmor doesn't work well with this
mount configuration: LibreOffice is one of them.  You can boot the kernel
with apparmor=off in its command line to disable it.

You can save some changes from the tmpfs to the lower read-only
filesystem if you first mount it with "--bind" somewhere else and then
remount it with "-o remount,rw" there.  Be careful because the
documentation says it is undefined behaviour to do this, although
I have tried it and it works fine for changes in the lower directory tree.

I hope this helps.  Have a nice day.


Reply to: