-
Notifications
You must be signed in to change notification settings - Fork 159
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
live-iso: add erofs support #3342
base: testing-devel
Are you sure you want to change the base?
Conversation
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator
Outdated
Show resolved
Hide resolved
54a26ac
to
5d5f047
Compare
Where=/sysroot | ||
Type=squashfs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if there are any consequences for removing Type=
but it sounds good to me if there aren't any. I'm sure the kernel just autodetects here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, there is no need for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's the kernel doing the auto-detection here, but util-linux. I think in general it's better to specify the type you expect to not rely on it getting it right and just be more strict. One way that I think should work here is to make this an env var and then add an EnvironmentFile
that we populate from coreos-livepxe-rootfs.sh
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we can write out an override from coreos-livepxe-rootfs.sh
for this particular mount where we can set the Type
that won't be so easy for the sysroot.mount
from ~line 150 because we don't know whether the file inside the rootfs.img
is erofs or squashfs at that point in time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For setting the What= and Type= here this seems to work:
diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh
index 61b4661f..d62443ab 100755
--- a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh
+++ b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh
@@ -88,6 +88,20 @@ else
fi
# we support both squashfs and erofs, let's create the symlink for sysroot.mount
-sysroot=$(ls /root.*fs)
-echo "Creating symlink '/sysrootfs.img -> ${sysroot}'"
-ln -s "${sysroot}" /sysrootfs.img
+if [ -f /root.squashfs ]; then
+ fs='/root.squashfs'
+ fstype='squashfs'
+elif [ -f /root.erofs ]; then
+ fs='/root.erofs'
+ fstype='erofs'
+else
+ echo "No root.squashfs or root.erofs exists" >&2
+ exit 1
+fi
+
+# Let sysroot.mount know what path and type to use for mounting
+echo "Updating /rootfs.env with WHAT=${fs} TYPE=${fstype}"
+cat >/rootfs.env <<EOF
+WHAT=${fs}
+TYPE=${fstype}
+EOF
diff --git a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator
index 9c052e5a..013a8d23 100755
--- a/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator
+++ b/overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator
@@ -58,18 +58,19 @@ isoroot=$(getarg coreos.liveiso= ||:)
if [ -z "${isoroot}" ]; then
# In this case, the rootfs is already unpacked into the initrd, or we need
# to retrieve it
- cat >"${UNIT_DIR}/sysroot.mount" <<EOF
+ cat >"${UNIT_DIR}/sysroot.mount" <<'EOF'
# Automatically generated by live-generator
[Unit]
DefaultDependencies=false
-# Verifies that we have the right sysrootfs.img, or downloads it if needed
+# Verifies that we have the right rootfs image, or downloads it if needed
After=coreos-livepxe-rootfs.service
Before=initrd-root-fs.target
-
[Mount]
-What=/sysrootfs.img
+EnvironmentFile=/rootfs.env
+What=${WHAT}
Where=/sysroot
+Type=${TYPE}
Options=loop
EOF
else
but I'm not opposed to leaving it the way it is either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For setting the What= and Type= here this seems to work:
Ahh yes, I do like the explicitness of just templating the What
also actually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, should i add Dusty's patch on top ? Does it make sense to have this explicity just in 1 place, while omitting the else
case?
the code LGTM - I'll test it out today. |
5d5f047
to
fec6ebb
Compare
PXE installation doesn't work:
Fixing ... |
fec6ebb
to
32a0c00
Compare
Now PXE works, here are logs
|
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/live-generator
Outdated
Show resolved
Hide resolved
overlay.d/05core/usr/lib/dracut/modules.d/35coreos-live/coreos-livepxe-rootfs.sh
Outdated
Show resolved
Hide resolved
32a0c00
to
96e9938
Compare
96e9938
to
41e313d
Compare
41e313d
to
2249d88
Compare
No description provided.