openwrt / openwrt/fstools

Overlay reformats on reboot with fstools_overlay_name bootparam

Open Beginner friendly
#18 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
4
Forks
19
PR merge metrics
No merged PRs in 30d

Description

I tested the latest fstools boot parameter option (fstools_overlay_name) introduced in #9, but it has an issue: the overlay partition gets reformatted on every boot, causing all changes on the device to be lost.

It appears that during the mount_root done phase, mount_root does not pick up the overlay name from the fstools_overlay_name boot parameter, so it fails to locate the correct partition. As a result, the .fs_state file is not created.

From fad83e23386ae9101c3a5785be2bd9c5131c6ce5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?B=C3=A1lint=20Husz=C3=A1r?= <balint.huszar@intelliport.hu>
Date: Thu, 9 Apr 2026 17:11:13 +0200
Subject: [PATCH] Fix volume_find dataname param to use bootargs

---
 mount_root.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/mount_root.c b/mount_root.c
index 392e912..37c5650 100644
--- a/mount_root.c
+++ b/mount_root.c
@@ -115,7 +115,13 @@ stop(int argc, char *argv[1])
 static int
 done(int argc, char *argv[1])
 {
-	struct volume *v = volume_find("rootfs_data");
+	char dataparam[BUFLEN];
+	char *dataname = "rootfs_data";
+
+	if (get_var_from_file("/proc/cmdline", "fstools_overlay_name", dataparam, sizeof(dataparam)))
+		dataname = dataparam;
+	
+	struct volume *v = volume_find(dataname);
 
 	if (!v)
 		return -1;
-- 
2.39.5


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in mount_root.c, especially the done() phase and its volume_find("rootfs_data") lookup; compare this path with the fstools_overlay_name value in /proc/cmdline. Reproduce a reboot with that boot parameter and verify that the overlay partition is found, .fs_state is created, and existing device changes are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.