Add a menuentry for persistence into the default grub.cfg and txt.cfg

I suggest that we add a menuentry for persistence into the default configuration files for grub and syslinux in the Lubuntu iso files. This would make it straightforward to get a persistent live Lubuntu system directly by cloning the iso file.

You have probably already noticed that when you boot a USB drive cloned from an iso file of 20.04 LTS, a partition with the label writable will be created. In the default ‘live’ case it is used to store logs (and maybe dump files) in order to help debug problems during booting and installing.

And if you add the boot option persistent the system will become a persistent live system, where you can install programs and save files in your standard directores (Documents, Downloads, Music, Pictures …) and they will survive shutdown and reboot.

So with an extra boot option in the grub.cfg and txt.cfg files, the user will get the option to run the default cloned drive not only live-only but also persistent live. This can be achieved with mkusb now, but most end users will never install it, they will probably not even know about it. But the standard Ubuntu Startup Disk Creator is there for cloning.

The boot menu can look like this:

syslinux menu in BIOS mode:

grub menu in UEFI mode:

Find more screenshots in post #8.

2 Likes

I’m all for documenting this (and would like to suggest this to @lynorian) but I’m not sure we should have it as the default.

@ Simon,

I agree about the default: live (live-only) should be the default as usual. I’m suggesting an additional menuentry to select persistent live.

I suggest to modify the standard iso file to include this.

What do you mean by ‘documenting this’? Should I suggest how to modify the config files for grub and syslinux, or do you mean some more general document?

Here are the two files that would bring new boot options for persistence, with and without nomodeset, the files grub.cfg and txt.cfg (and their md5sums).

$ cat grub.cfg 

if loadfont /boot/grub/font.pf2 ; then
	set gfxmode=auto
	insmod efi_gop
	insmod efi_uga
	insmod gfxterm
	terminal_output gfxterm
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray

set timeout=30
menuentry "Start Lubuntu live" {
	set gfxpayload=keep
	linux	/casper/vmlinuz  file=/cdrom/preseed/lubuntu.seed quiet splash ---
	initrd	/casper/initrd
}
menuentry "Run Lubuntu persistent live" {
	set gfxpayload=keep
	linux	/casper/vmlinuz  file=/cdrom/preseed/lubuntu.seed quiet splash fsck.mode=skip persistent ---
	initrd	/casper/initrd
}
menuentry "Start Lubuntu live (safe graphics)" {
	set gfxpayload=keep
	linux	/casper/vmlinuz  file=/cdrom/preseed/lubuntu.seed quiet splash nomodeset ---
	initrd	/casper/initrd
}
menuentry "Run Lubuntu persistent live (safe graphics)" {
	set gfxpayload=keep
	linux	/casper/vmlinuz  file=/cdrom/preseed/lubuntu.seed quiet splash nomodeset fsck.mode=skip persistent ---
	initrd	/casper/initrd
}
menuentry "OEM install (for manufacturers)" {
	set gfxpayload=keep
	linux	/casper/vmlinuz  file=/cdrom/preseed/lubuntu.seed only-ubiquity quiet splash oem-config/enable=true ---
	initrd	/casper/initrd
}
grub_platform
if [ "$grub_platform" = "efi" ]; then
menuentry 'Boot from next volume' {
	exit
}
menuentry 'UEFI Firmware Settings' {
	fwsetup
}
fi

$ cat txt.cfg 
default live
label live
  menu label ^Start Lubuntu live
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/lubuntu.seed initrd=/casper/initrd quiet splash ---
label persistent-live
  menu label ^Run Lubuntu persistent live
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/lubuntu.seed initrd=/casper/initrd quiet splash fsck.mode=skip persistent ---
label live-nomodeset
  menu label ^Start Lubuntu live (safe graphics)
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/lubuntu.seed initrd=/casper/initrd quiet splash nomodeset ---
label persistent-live-nomodeset
  menu label ^Run Lubuntu persistent live (safe graphics)
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/lubuntu.seed initrd=/casper/initrd quiet splash nomodeset fsck.mode=skip persistent ---
label memtest
  menu label Test ^memory
  kernel /install/mt86plus
label hd
  menu label ^Boot from first hard disk
  localboot 0x80

$ cat config2persist.md5 
0a8a260be7b500810a5863663665cc07  grub.cfg
c44bf4901b8d6949391d663eb4359bfe  txt.cfg

I can upload them somewhere or attach them to a mail if you wish.

The small configuration files and their md5sums as well as a compressed image file and its md5sum are uploaded at this link to a Google Drive directory.

If you extract the compressed image file to a USB pendrive or memory card (or other drive), you will get a system that behaves pretty much like a Lubuntu 20.04 LTS system cloned from the iso file.

Please notice that you need not create a partition for persistence. Lubuntu will do that automatically.

Try it and get a feeling of how the Lubuntu live system will work, when the new boot options for persistence are there.

You can use mkusb to extract directly to the target drive, Maybe you can also use Disks, gnome-disks, directly.You can use several tools to extract from compression to a file and after that clone to the drive.

1 Like

Hi

As a Newbie who was seeking a persistent SD card installation of 20.04 I would like to support the idea of adding in that option when one is doing an install.

Whilst at it, I would also like the opportunity to not have the SD install set up computer name and the principal user name as Lubuntu (lubuntu@lubuntu). One gets that installing to HD, but it did not appear for me installing to the SD. I am currently working on trying to find out how to change that by editing the boot files, which must be possible.

Regards

Pete

1 Like

Hi Pete,

There are two methods, that I have been using for your purpose to get a custom user name.

  • You can install from a USB drive (or another SD card) to an SD card like you install into an internal drive (with some minor modifications) according to this link. It will give you the normal choice of computer name and user name. It helps if you unplug, disconnect or disable the internal drive before you start the installation.

  • You can make a ‘standard’ persistent live drive (for example with mkusb). Log into the persistent live system and create a second user ID with the name you want. Check that you give this user sudo permissions (in order to perform system tasks). Then you can remove the default user ‘lubuntu’ with the user number 999 and log in as usual to your new user.

    I have not set up a custom computer name in a persistent live drive, so I don’t know if it would be straightforward.

1 Like

I uploaded some screenshots as a demo, if you think the compressed image file is too big to download. You can see them here too:

The default choice:

Run persistent live:

Showing the boot options with F6:

Running (booted into the desktop):

The default choice:

Run persistent live:

Showing the boot options with e:

1 Like

I understand that you (developers of Lubuntu) don’t want to add boot menuentries to the iso file, and I won’t ask you for it again.

So I have a less intrusive suggestion. It would help making a ‘semi-cloned’ persistent live drive, if you would provide some blank characters at or near the end of the linux line in the menuentries of grub.cfg and the append lines of txt.cfg (for syslinux). 14 blank characters (spaces) would be enough in each of those lines.

With that minor tweak, it would be very easy to use sed and create a modified iso file and then use the Ubuntu Startup Disk Creator (or some other safe cloning tool) to create a nice persistent live drive.


(As it is now, we can ‘sacrifice’

'quiet splash'

by replacing with

'persistent  '

and it works, but the boot sequence will be ugly.)

1 Like