Skip to content
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

cos-upgrade uses COS_STATE for temporary files during upgrades #480

Closed
bk201 opened this issue Aug 4, 2021 · 4 comments · Fixed by #482
Closed

cos-upgrade uses COS_STATE for temporary files during upgrades #480

bk201 opened this issue Aug 4, 2021 · 4 comments · Fixed by #482
Assignees
Labels
Projects

Comments

@bk201
Copy link
Member

bk201 commented Aug 4, 2021

cos-toolkit version:
RancherOSv2 with utils/installer-0.8+9.

Describe the bug
Fail to upgrade OS from a registry.

To Reproduce

  • Setup self-signed SSL things for private registry and accept the certs on nodes.
  • Push OS image to the registry.
  • Upgrade the OS from the registry. e.g.,
cos-upgrade --docker-image 192.168.2.106/rancher/harvester-os:c22323d-dirty

And the output:

Upgrading system..
-> Upgrade target: active.img
3240+0 records in
3240+0 records out
3397386240 bytes (3.4 GB, 3.2 GiB) copied, 2.10756 s, 1.6 GB/s
mke2fs 1.43.8 (1-Jan-2018)
Discarding device blocks: done
Creating filesystem with 829440 4k blocks and 207584 inodes
Filesystem UUID: 27619c9c-dd09-4eff-afe1-d439dabe734f
Superblock backups stored on blocks:
	32768, 98304, 163840, 229376, 294912, 819200

Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done

mkdir: cannot create directory ‘/tmp/upgrade/usr/local’: No such file or directory
Upgrading from container image: 192.168.2.106/rancher/harvester-os:c22323d-dirty
+ luet util unpack --enable-logfile --logfile /tmp/luet.log --plugin luet-mtree 192.168.2.106/rancher/harvester-os:c22323d-dirty /usr/local/tmp/rootfs
 Downloading 192.168.2.106/rancher/harvester-os:c22323d-dirty to /usr/local/tmp/rootfs
 failed listing images: copying of parent failed: failed to copy files: copy file range failed: no space left on device
+ cleanup
+ EXIT=1
+ cleanup2
+ return 1

Expected behavior
The image content should be writtend into active.img.

Logs

Additional context
The space of /run/initramfs/cos-state is exhausted during the upgrade (the free space 11GB should be enough for the 1.27GB image and the new 3G active.img).

Screen Recording 2021-08-04 at 5 12 07 PM

If I modify the code to this, the upgrade succeeds:

diff --git a/packages/installer/upgrade.sh b/packages/installer/upgrade.sh
index 1920bf9..351203c 100644
--- a/packages/installer/upgrade.sh
+++ b/packages/installer/upgrade.sh
@@ -162,7 +162,6 @@ upgrade() {
     # FIXME: Define default /var/tmp as tmpdir_base in default luet config file
     export XDG_RUNTIME_DIR=$temp_upgrade
     export TMPDIR=$temp_upgrade
-    export LUET_PRIVILEGED_EXTRACT=true

     args=""
     if [ -z "$VERIFY" ] || [ "$VERIFY" == true ]; then
@@ -181,6 +180,7 @@ upgrade() {
     else
         echo "Upgrading from container image: $UPGRADE_IMAGE"
         set -x
+        mkdir -p /usr/local/tmp/rootfs
         luet util unpack $args $UPGRADE_IMAGE /usr/local/tmp/rootfs
         set +x
         rsync -aqzAX --exclude='mnt' --exclude='proc' --exclude='sys' --exclude='dev' --exclude='tmp' /usr/local/tmp/rootfs/ $TARGET

The image will be extraced to /usr/local/tmp/rootfs rather than $STATEDIR/tmp/upgrade. And it only consumes the as much as the image size (~1.27GB).

@bk201 bk201 added the kind/bug Something isn't working label Aug 4, 2021
@mudler mudler added this to 🗳️ To Do in Releases Aug 4, 2021
@mudler mudler removed their assignment Aug 4, 2021
@mudler
Copy link
Contributor

mudler commented Aug 4, 2021

👀 On first place, the upgrade process should use the temporary space in COS_PERSISTENT, so this is a bug. About the LUET_PRIVILEGED_EXTRACT is something required as for now as disabling makes our test suite to fail (#260), and that needs further investigation

@kkaempf
Copy link
Contributor

kkaempf commented Aug 4, 2021

eyes On first place, the upgrade process should use the temporary space in COS_PERSISTENT, so this is a bug. About the LUET_PRIVILEGED_EXTRACT is something required as for now as disabling makes our test suite to fail (#260), and that needs further investigation

So this is two separate issues. Can you please create the second one, @mudler ?

@mudler
Copy link
Contributor

mudler commented Aug 4, 2021

eyes On first place, the upgrade process should use the temporary space in COS_PERSISTENT, so this is a bug. About the LUET_PRIVILEGED_EXTRACT is something required as for now as disabling makes our test suite to fail (#260), and that needs further investigation

So this is two separate issues. Can you please create the second one, @mudler ?

I was already on my way :)

@mudler
Copy link
Contributor

mudler commented Aug 4, 2021

More context about LUET_PRIVILEGED_EXTRACT is provided here: #481 and why we have that turned on (and required)

@mudler mudler changed the title Fail to upgrade OS from a registry cos-upgrade uses COS_STATE for temporary files during upgrades Aug 4, 2021
@mudler mudler self-assigned this Aug 4, 2021
mudler added a commit that referenced this issue Aug 4, 2021
Fixes #480

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
mudler added a commit that referenced this issue Aug 4, 2021
Fixes #480

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
@mudler mudler moved this from 🗳️ To Do to 🏃🏼‍♂️ In Progress in Releases Aug 4, 2021
mudler added a commit that referenced this issue Aug 4, 2021
Fixes #480

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
Releases automation moved this from 🏃🏼‍♂️ In Progress to ✅ Done Aug 4, 2021
mudler added a commit that referenced this issue Aug 4, 2021
Fixes #480

Signed-off-by: Ettore Di Giacinto <edigiacinto@suse.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Releases
✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants