Skip to content

Conversation

@Itxaka
Copy link
Member

@Itxaka Itxaka commented Jun 11, 2025

Looks like the mount lib did not called the proper options on the remount AND we couold not easily remount RO the state partition.

Instead, after upgrade, just remount with bind so its immidiatly RO and we avoid in use errors.

This also adds a umount/remount for the persistent partition during upgrade if it was mounted by us, to not leave stuff around

Fix kairos-io/kairos#3416

Looks like the mount lib did not called the proper options on the
remount AND we couold not easily remount RO the state partition.

Instead, after upgrade, just remount with bind so its immidiatly RO and
we avoid in use errors.

This also adds a umount/remount for the persistent partition during
upgrade if it was mounted by us, to not leave stuff around

Signed-off-by: Itxaka <[email protected]>
@Itxaka Itxaka requested review from a team and Copilot June 11, 2025 13:01
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that after an upgrade, partitions are correctly remounted as read-only using a bind remount strategy and that any persistent partition mounts are cleaned up.

  • Use a bind+remount approach to enforce read-only on the state partition and avoid “device busy” errors
  • Push an unmount callback for the persistent partition if it was mounted during upgrade

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/elemental/elemental.go Replace the simple remount helper with a direct syscall.Mount call using `MS_BIND
pkg/action/upgrade.go Add cleanup.Push(umount) after mounting the persistent partition

Use the syscall interface in the config

Signed-off-by: Itxaka <[email protected]>
@codecov
Copy link

codecov bot commented Jun 11, 2025

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 48.41%. Comparing base (e644203) to head (3874c0e).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pkg/action/upgrade.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #811      +/-   ##
==========================================
+ Coverage   48.38%   48.41%   +0.03%     
==========================================
  Files          48       48              
  Lines        6575     6579       +4     
==========================================
+ Hits         3181     3185       +4     
  Misses       3089     3089              
  Partials      305      305              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Itxaka Itxaka merged commit f60f499 into main Jun 11, 2025
15 checks passed
@Itxaka Itxaka deleted the fix_remount_upgrade branch June 11, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mount point is busy error on cos-state when running kairos-agent upgrade twice in a row

3 participants