amazonlinux / amazon-ec2-utils

amazon-ec2-utils contains a set of utilities and settings for Linux deployments in EC2
MIT License
59 stars 27 forks source link

udev rules and scripts should be (optionally) available in early-boot #34

Open ziggythehamster opened 10 months ago

ziggythehamster commented 10 months ago

There are situations where you require the block device mapping names to exist before you can mount the root volume in the early-boot process, and currently this package cannot be used there because it would require copying in Python.

One solution to this problem would be to rewrite the script to use nvme-cli >= 1.13, where the block device name can be grabbed with nvme amzn id-ctrl /dev/nvme0n1 | grep '^bdev' | awk '{ sub("/dev", ""); print $3 }' (sometimes the block device name begins with /dev, and this script is expected to strip that off). A more complicated Bash-only version could also be written to avoid needing to depend on grep and awk in the compact initrd/initramfs.

This solution works for EL8 and EL9 out of the box because both ship an nvme-cli that is new enough, but AL2023 and earlier ship too old of an nvme-cli for this to work. Since this repo primarily supports AL and AL does not typically support folks using non-default filesystems like ZFS, I figured contributing a PR that made this change would not be terribly useful. Since we need it (and in fact have already had this in place for years), these changes will exist, and I'm happy to strategize some way to make it work more broadly in this package (maybe different RPM specs? an RPM spec that uses macros to choose a strategy based on the OS?)

ziggythehamster commented 10 months ago

https://github.com/art19/amazon-ec2-utils/pull/2 implements this in our fork