Skip to content

armbian-zram-config: refine check for existing /tmp mount#9514

Merged
igorpecovnik merged 2 commits intoarmbian:mainfrom
vidplace7:zram-loosen
Mar 15, 2026
Merged

armbian-zram-config: refine check for existing /tmp mount#9514
igorpecovnik merged 2 commits intoarmbian:mainfrom
vidplace7:zram-loosen

Conversation

@vidplace7
Copy link
Member

@vidplace7 vidplace7 commented Mar 11, 2026

Description

activate_compressed_tmp has a guard clause preventing zram tmpfs creation when a "tmpfs /tmp" entry exists.
This PR extends this behavior to include any /tmp mount in /etc/fstab, preventing duplicate /tmp entries.

How Has This Been Tested?

  • Created /etc/fstab entry /opt/tmp /tmp none bind 0 0 -- guard-code succesfully triggers
  • Created /etc/fstab entry tmpfs /tmp tmpfs defaults,nosuid 0 0 (Default) -- guard-code successfully triggers as before
  • Manually ensured guard-code does not trigger when /tmp is not present (when activate_compressed_tmp should run)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved robustness of compressed temporary file configuration by enhancing mount detection logic to properly identify existing temporary file mounts, preventing conflicts during system initialization.

activate_compressed_tmp has a guard clause preventing zram tmpfs creation when a manually created `tmpfs /tmp` exists.
Extend this behaviour to include *any* `/tmp` mount in /etc/fstab.
@vidplace7 vidplace7 requested a review from a team as a code owner March 11, 2026 04:40
@vidplace7 vidplace7 requested review from PanderMusubi and matthijskooijman and removed request for a team March 11, 2026 04:40
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 11, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 14a4b88b-0ca5-49ca-bf7a-ec98fe5b8465

📥 Commits

Reviewing files that changed from the base of the PR and between a8bc634 and ea26af1.

📒 Files selected for processing (1)
  • packages/bsp/common/usr/lib/armbian/armbian-zram-config

📝 Walkthrough

Walkthrough

Modified the activate_compressed_tmp function in the Armbian zram configuration script to detect any non-comment mount entry for /tmp (not just tmpfs), so the function skips creating a compressed /tmp when any filesystem is already mounted there.

Changes

Cohort / File(s) Summary
Zram configuration script
packages/bsp/common/usr/lib/armbian/armbian-zram-config
Adjusted the regex check in activate_compressed_tmp to match any non-comment /tmp mount entry instead of only tmpfs /tmp, broadening the condition that prevents creating a compressed /tmp.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 I nibble lines where mounts align,
One pattern changed, now any sign,
If /tmp is set, whatever type,
The rabbit skips the zram pipe.
Hooray for simpler checks — hop, hop!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the main change: refining the check for detecting existing /tmp mounts to handle all filesystem types, not just tmpfs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions bot added size/small PR with less then 50 lines Needs review Seeking for review BSP Board Support Packages 05 Milestone: Second quarter release labels Mar 11, 2026
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/bsp/common/usr/lib/armbian/armbian-zram-config`:
- Line 143: The current one-liner grep (grep -qE
'^[^#]+[[:space:]]+/tmp[[:space:]]' /etc/mtab && return) only inspects /etc/mtab
and wrongly skips fstab entries and mount sources containing ‘#’;
replace/augment this with a field-wise check of /etc/fstab: skip blank/comment
lines, split each line into fields and test whether the second field (mount
point) is exactly /tmp (and treat whitespace safely), and if such an fstab entry
exists return; keep the existing /etc/mtab check as a fast-path but ensure the
new fstab check runs before creating zram-backed /tmp so no declared noauto/bind
fstab entries are missed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a137651d-b76f-4e93-a261-9aff5b6fe58a

📥 Commits

Reviewing files that changed from the base of the PR and between addbce1 and a8bc634.

📒 Files selected for processing (1)
  • packages/bsp/common/usr/lib/armbian/armbian-zram-config

Co-authored-by: tabrisnet <96966042+tabrisnet@users.noreply.github.com>
Copy link
Collaborator

@tabrisnet tabrisnet left a comment

Choose a reason for hiding this comment

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

nothing obviously wrong

tabris@brunnt:~/build/armbian-build$ grep -E '^[^#[:space:]][^[:space:]]*[[:space:]]+/dev/shm[[:space:]]' /etc/mtab
tmpfs /dev/shm tmpfs rw,nosuid,nodev,inode64 0 0

this system doesn't have a separately mounted /tmp so I modified the regex to match something the system does have. works as expected.

@github-actions github-actions bot added the Ready to merge Reviewed, tested and ready for merge label Mar 14, 2026
@github-actions
Copy link
Contributor

✅ This PR has been reviewed and approved — all set for merge!

@github-actions github-actions bot removed the Needs review Seeking for review label Mar 14, 2026
@igorpecovnik igorpecovnik merged commit 97c185c into armbian:main Mar 15, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

05 Milestone: Second quarter release BSP Board Support Packages Ready to merge Reviewed, tested and ready for merge size/small PR with less then 50 lines

Development

Successfully merging this pull request may close these issues.

3 participants