Repository navigation
feat(convert): support Ubuntu cloud images - #167
Merged
Merged
Conversation
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
3 of 5 tasks
virt-customize runs every --run-command through the guest's /bin/sh, which is dash on Ubuntu, so the guest-side blocks drop their bashisms (arrays, [[ ]], the #!/bin/bash marker) and are plain POSIX sh now. Package operations dispatch on the guest's package manager: DEB guests purge cloud-init and openssh-server with apt, RPM guests keep yum. The Alibaba-agent steps are guarded no-ops on images that never carried those agents, and each systemctl/rpm step that can only target missing components tolerates absence instead of failing the whole run. Signed-off-by: Kun Lai <laikun@linux.alibaba.com> Assisted-by: Claude Code:glm-5.3
Installing user-provided .debs now goes through "apt-get install" with the copied file paths, so the guest package's dependencies (dracut, dracut-network, lvm2, cryptsetup) are resolved from the repositories in one step instead of a dpkg -i plus an "apt-get -f install" whose failures were swallowed by "|| true". A failed install is now fatal with the real error visible: a half-installed guest package produces an image that cannot decrypt its rootfs at boot. Host-side version detection of cryptpilot-fde-host moves into pkg::host_fde_version, shared by the RPM and DEB installers, and validates the captured string: the query tools print "package ... is not installed" style errors when the host lacks the package, and a message that leaks into the version slot later fails as a baffling "unable to locate package" inside the chroot. Anything that does not start with a digit is discarded and the latest guest package is requested instead. The zram kernel-module step no longer aborts the conversion: the linux-modules-extra package for a custom kernel flavor is often not in any repo, and its absence only rules out the "ram" delta location, which the configuration in use may not need. Both failure paths downgrade to a warning. Signed-off-by: Kun Lai <laikun@linux.alibaba.com> Assisted-by: Claude Code:glm-5.3
Ubuntu cloud images default to GRUB_DEFAULT=0 and ship no grubenv, so the guest boots whichever menuentry grub-mkconfig happens to list first. The conversion only rebuilds the initramfs for the newest kernel, so the default now goes through the saved-entry mechanism: GRUB_DEFAULT=saved is written to /etc/default/grub and to every /etc/default/grub.d drop-in that defines the variable (drop-ins are sourced last and would otherwise win), and after grub.cfg is regenerated the environment block is created with the guest's own grub-editenv (grub2-editenv fallback; neither present is a fatal error, since hand-crafting the fixed 1024-byte block corrupts it). The saved_entry is taken verbatim from the generated grub.cfg: the menuentry title of the newest non-rescue kernel, prefixed with the submenu title path form when it is nested, which is the exact identifier GRUB resolves. The ESP grub.cfg sync no longer overwrites stub configs. Ubuntu keeps a tiny search.fs_uuid + configfile stub on the ESP that redirects to the real grub.cfg on the boot partition; the raw partition copy preserves that partition verbatim, UUID included, so the stub stays valid, while clobbering it with the full grub.cfg would break the redirect and the $prefix-relative grubenv. Full ESP copies (the layout the sync was built for) are still refreshed; a stub has no menuentry line, so that is the discriminator. Signed-off-by: Kun Lai <laikun@linux.alibaba.com> Assisted-by: Claude Code:glm-5.3
Ubuntu cloud images ship a ~100M ESP, far too small for the unified kernel image UKI mode writes there. When the source ESP is smaller than 512M, the output partition table is rewritten before it is applied: the ESP entry covers 512M and the partitions behind it on the disk are relocated (aligned starts), with the last partition absorbing the size change. Numbers, types and PARTUUIDs ride along on the untouched part of each sfdisk line, so every partition keeps its identity. The grown partition gets a fresh FAT32 filesystem spanning the whole partition plus a copy of the original ESP's files (FAT label kept so the guest's LABEL= fstab entry still resolves). Growing the partition without regrowing the filesystem leaves the old, smaller FAT inside, and the UKI write later fails with ENOSPC. A source ESP that already fits keeps the byte-identical raw copy of today. Signed-off-by: Kun Lai <laikun@linux.alibaba.com> Assisted-by: Claude Code:glm-5.3
Signed-off-by: Kun Lai <laikun@linux.alibaba.com> Assisted-by: Claude Code:glm-5.3
imlk0
force-pushed
the
convert-ubuntu-guest
branch
from
October 30, 2026 12:50
d199ecf to
c215318
Compare
|
@imlk0 ,您好,您的请求已接收,请耐心等待结果。 |
|
@imlk0 ,您好,未检测到有镜像需要构建,如需重新检测请评论 /start 。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Ubuntu 24.04 LTS (Noble) cloud images as conversion guests, for cryptpilot-convert and cryptpilot-enhance. Clean-room implementation on current master (supersedes the closed #166; test/CI coverage follows in a separate PR stacked on this one).
sh(the guest's/bin/shis dash on Ubuntu, where the old bash-only script breaks); the sshd hardening also covers/etc/ssh/sshd_config.d/*.confdrop-ins, which Ubuntu reads after the main file.dpkg -iruns; host-side version detection of cryptpilot-fde-host can no longer capture an error message as the version string; the zram module install no longer aborts conversions on kernels it cannot resolve.grub-editenv(fatal if absent: the block's fixed 1024-byte layout is easy to corrupt when hand-crafted), withsaved_entryprimed from the freshly generated grub.cfg (submenu path form supported), andGRUB_DEFAULT=savedset in every file that defines it. The ESP stub grub.cfg sync no longer overwrites the ESP's early grub configuration.Test plan
initrd.img-6.8.0-117-generic; ESP has shim/grub with the search.fs_uuid stub intact; grub.cfg has menuentries; 1024-byte grubenv withsaved_entry=Advanced options for Ubuntu>Ubuntu, with Linux 6.8.0-117-generic; all PARTUUIDs preserved.--uki --uki-stub-version 258): rc=0 (167 s); output ESP is 512M with the FAT spanning the partition and the UKI atEFI/BOOT/BOOTX64.EFI(stub 258.3, compact layout); every other partition's PARTUUID unchanged.LIBGUESTFS_BACKEND=direct): cloud-init purged with its directories gone, sshd hardened to key-only, root account locked.bash -n,shellcheck(both scripts),cargo fmt --checkclean.Notes