Score:0

Trouble modifying initrd for custom live iso

cn flag

I am trying to customize an LUbuntu Live CD (22.04.2), following the instructions at https://help.ubuntu.com/community/LiveCDCustomization. Some of the things I would like to do, such as removing the "Install LUbuntu" desktop icon, require modifying scripts that are packed inside initrd. If I don't touch initrd, I am able to unpack the iso files, unpack filesystem.squashfs, repack filesystem.squashfs, and use xorriso to rebuild the iso, and it works. However, if I attempt to modify initrd, via unmkinitramfs and the pack it back together following the instructions, then the resulting iso starts to boot, and I see the grub menu followed by the LUbuntu screen, but then the screen goes black and I get the message, "Unable to find a medium containing a live file system".

A gist of my script I've been using is here:
https://gist.github.com/plynch-se/6113a2770fd30ee52d61191c7814d648

I suspect the problem is not with the new initrd file itself, but some option to xorriso that needs to be different now that initrd has changed, but I am not sure. The xorriso command I am using is basically this (generated in part based on the original iso as you can see in the gist): xorriso -outdev custom.iso -map /root/tmp/custom_iso / -- -volid Lubuntu 22.04.2 LTS amd64 -boot_image grub grub2_mbr=mbr.img -boot_image any partition_table=on -boot_image any partition_cyl_align=off -boot_image any partition_offset=16 -boot_image any mbr_force_bootable=on -append_partition 2 28732ac11ff8d211ba4b00a0c93ec93b EFI.img -boot_image any appended_part_as=gpt -boot_image any iso_mbr_part_type=a2a0d0ebe5b9334487c068b6b72699c7 -boot_image any cat_path=/boot.catalog -boot_image grub bin_path=/boot/grub/i386-pc/eltorito.img -boot_image any platform_id=0x00 -boot_image any emul_type=no_emulation -boot_image any load_size=2048 -boot_image any boot_info_table=on -boot_image grub grub2_boot_info=on -boot_image any next -boot_image any efi_path=--interval:appended_partition_2:all:: -boot_image any platform_id=0xef -boot_image any emul_type=no_emulation -boot_image any load_size=5154816

I was suspicious of the load_size number at the end, so I also tried "load_size=full", but that did not help.

Suggestions would be appreciated. I am out of ideas at this point.

guiverc avatar
cn flag
Ubuntu releases of 20.10 & later have an inbuilt hash that is used to ensure they aren't altered, if the hash check fails the message you mention "*Unable to find a medium containing a live file system*" appears and the user is asked if they want to download a valid ISO. I did **not** look at your code, but did you calculate & store/use a valid hash? as changes will mean the original will show as invalid (*Creating the ISO Image* in the doc you provided). Note: this comment is based on the error message you mention only
Paul Lynch avatar
cn flag
@guiverc The only hash I am aware of is the one mentioned in https://help.ubuntu.com/community/LiveCDCustomization which an optional hash of the iso file for checking a download. It sounds like you mean some hash internal to the iso's files. Where can I find information about that?
Paul Lynch avatar
cn flag
Actually, I do see a note in those instructions saying "Remove the old md5sum.txt file and calculate new md5 sums, as follows:...." I skipped over that. I will give that a try.
Paul Lynch avatar
cn flag
Unfortunately I am getting the same result after updating the m5sum.txt file, though it sounds like that was one of the problems.
guiverc avatar
cn flag
This is a Q&A site & not a forum, your additional details (*details of your altered md5sum*) should be added to your question; I can then remove my comment(s). Sorry I provided the wrong section in the link; but I'm only aware of the message about medium appearing because of failures on hash/checksum; NOTE I've not looked at the code, my knowledge coming most from discussions on bug reports as consequence of changes during *groovy* (20.10) & later cycles & issues in QA. An invalid has/checksum can also appear when ISO isn't *cloned* to media perfectly but that's related to ISO writer software
guiverc avatar
cn flag
Additional thought: We did have the *Unable to find medium* appear on boxes that had *firmware* bugs too... in fact Ubuntu is carrying some *patches* (in `casper`) so it doesn't appear on some old HP hardware which contain *never fixed bugs in firmware*. Were is specific hardware related though (like the HP example I'm using) though the ISO will boot on other devices without issue. You can also get it as stated if ISO is written incorrectly (*in which case it may boot correctly on other devices with different firmware or different boot type*).
Paul Lynch avatar
cn flag
In case someone else is having this issue, I found a workaround. For the customization I wanted to do in initrd (disabling the autologin of the lubuntu user), I was able to add an "@reboot" root cronjob to the unpacked filesystem.squashfs that comments out the "User" and "Session" entries in /etc/sddm.conf.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.