Skip to content

[mount] manual partitioning & btrfs setup#166

Open
beyondbrokkoli wants to merge 175 commits intoCachyOS:cachyos-devfrom
beyondbrokkoli:patch-1
Open

[mount] manual partitioning & btrfs setup#166
beyondbrokkoli wants to merge 175 commits intoCachyOS:cachyos-devfrom
beyondbrokkoli:patch-1

Conversation

@beyondbrokkoli
Copy link
Copy Markdown

@beyondbrokkoli beyondbrokkoli commented Feb 6, 2026

Conflicts
This ISO is based on ArchLinux ISO modified to provide Installation Environment for CachyOS.
https://cachyos.org

CachyOS Archiso Sources:
https://github.com/cachyos/cachyos-live-iso

ArchLinux ISO Source:
https://gitlab.archlinux.org/archlinux/archiso

Calamares is used as GUI installer:
https://github.com/calamares/calamares

Live environment will start now and let you install CachyOS to disk.

Getting help at the forum: https://discuss.cachyos.org

Welcome to your CachyOS!

                                          
[liveuser@CachyOS ~]$ lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
loop0    7:0    0  2.7G  1 loop /run/archiso/airootfs
sda      8:0    0   80G  0 disk 
├─sda1   8:1    0  4.1G  0 part /tmp/calamares-root-20bdpvzd/boot
├─sda2   8:2    0   20G  0 part /tmp/calamares-root-20bdpvzd/home
├─sda3   8:3    0   20G  0 part /tmp/calamares-root-20bdpvzd/srv
├─sda4   8:4    0   20G  0 part /tmp/calamares-root-20bdpvzd/var/log
│                               /tmp/calamares-root-20bdpvzd/var/tmp
│                               /tmp/calamares-root-20bdpvzd/var/cache
│                               /tmp/calamares-root-20bdpvzd/root
│                               /tmp/calamares-root-20bdpvzd
└─sda5   8:5    0 15.9G  0 part /tmp/calamares-root-20bdpvzd/var
sdb      8:16   1 28.9G  0 disk 
├─sdb1   8:17   1 28.9G  0 part 
└─sdb2   8:18   1   32M  0 part 
sr0     11:0    1  2.9G  0 rom  /run/archiso/bootmnt
zram0  253:0    0  7.7G  0 disk [SWAP]
[liveuser@CachyOS ~]$ 

Error Message

The device '/dev/sda4' is mounted in the target system. It is mounted at '/tmp/calamares-root-20bdpvzd/var/tmp'. The device could not be unmounted.

How To Reproduce partitions install crash

Setting a different partition for /var clashes with the settings in mount.conf

    - mountPoint: /var/log
      subvolume: /@log

Extended filtering avoids this issue
I suggest using a different directory for btrfs subvolume creation and blocking ntfs, ext2 and fat16
Only allowing fat32 on /boot /boot/efi
All partitions except for /home /srv /boot /boot/efi should be empty to avoid conflicts post-install

Isolated subvolume creation via temporary directories completely avoids unmounting the main calamares-root
The mounting logic is now phased to ensure physical disks are always ready before chroot binds
Defensive checks now prevent cluttered installs and the error function handles stray mounts

btrfs swap-to-file functionality remains untested due to current configuration constraints
Tested with 260124 ISO

evidence
successfull install
[halim@cachyos-x8664 ~]$ lsblk; cat /etc /fstab
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                           8:0    0 931,5G  0 disk 
├─sata--lvm-sata--lvm_tmeta 253:0    0   9,3G  0 lvm  
└─sata--lvm-sata--lvm_tdata 253:1    0 912,8G  0 lvm  
sdb                           8:16   0 931,5G  0 disk 
├─sdb1                        8:17   0   300M  0 part 
├─sdb2                        8:18   0   200G  0 part 
└─sdb3                        8:19   0   200G  0 part 
sdc                           8:32   0    32G  0 disk 
├─sdc1                        8:33   0   4,1G  0 part 
└─sdc2                        8:34   0  27,9G  0 part 
sdd                           8:48   0   150G  0 disk 
└─sdd1                        8:49   0   150G  0 part 
sde                           8:64   0   150G  0 disk 
└─sde1                        8:65   0   150G  0 part 
sdf                           8:80   0    80G  0 disk 
├─sdf1                        8:81   0   4,1G  0 part /boot/efi
├─sdf2                        8:82   0    20G  0 part /home
├─sdf3                        8:83   0    20G  0 part /srv
├─sdf4                        8:84   0    20G  0 part /root
│                                                     /
└─sdf5                        8:85   0  15,9G  0 part /var
sdg                           8:96   1  28,9G  0 disk 
├─sdg1                        8:97   1  28,9G  0 part 
└─sdg2                        8:98   1    32M  0 part 
sr0                          11:0    1   2,9G  0 rom  
zram0                       252:0    0  15,6G  0 disk [SWAP]
nvme0n1                     259:0    0 119,2G  0 disk 
├─nvme0n1p1                 259:1    0   512M  0 part 
└─nvme0n1p2                 259:2    0 118,7G  0 part 
cat: /etc: Is a directory
cat: /fstab: No such file or directory
[halim@cachyos-x8664 ~]$ lsblk; cat /etc/fstab
NAME                        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                           8:0    0 931,5G  0 disk 
├─sata--lvm-sata--lvm_tmeta 253:0    0   9,3G  0 lvm  
└─sata--lvm-sata--lvm_tdata 253:1    0 912,8G  0 lvm  
sdb                           8:16   0 931,5G  0 disk 
├─sdb1                        8:17   0   300M  0 part 
├─sdb2                        8:18   0   200G  0 part 
└─sdb3                        8:19   0   200G  0 part 
sdc                           8:32   0    32G  0 disk 
├─sdc1                        8:33   0   4,1G  0 part 
└─sdc2                        8:34   0  27,9G  0 part 
sdd                           8:48   0   150G  0 disk 
└─sdd1                        8:49   0   150G  0 part 
sde                           8:64   0   150G  0 disk 
└─sde1                        8:65   0   150G  0 part 
sdf                           8:80   0    80G  0 disk 
├─sdf1                        8:81   0   4,1G  0 part /boot/efi
├─sdf2                        8:82   0    20G  0 part /home
├─sdf3                        8:83   0    20G  0 part /srv
├─sdf4                        8:84   0    20G  0 part /root
│                                                     /
└─sdf5                        8:85   0  15,9G  0 part /var
sdg                           8:96   1  28,9G  0 disk 
├─sdg1                        8:97   1  28,9G  0 part 
└─sdg2                        8:98   1    32M  0 part 
sr0                          11:0    1   2,9G  0 rom  
zram0                       252:0    0  15,6G  0 disk [SWAP]
nvme0n1                     259:0    0 119,2G  0 disk 
├─nvme0n1p1                 259:1    0   512M  0 part 
└─nvme0n1p2                 259:2    0 118,7G  0 part 
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=0BE1-587A                            /boot/efi      vfat    defaults,umask=0077 0 2
UUID=6c40ed2e-3e69-4167-8bda-ecaa24459ae6 /home          btrfs   defaults,noatime,compress=zstd 0 0
UUID=a0f5cb8e-27c4-441e-8418-7feedc4c0646 /srv           xfs     defaults,lazytime,noatime,inode64,logbsize=256k,noquota 0 2
UUID=f433e604-4ad0-4e91-8cbc-c19e8261d12d /              btrfs   subvol=/@,defaults,noatime,compress=zstd 0 0
UUID=f433e604-4ad0-4e91-8cbc-c19e8261d12d /root          btrfs   subvol=/@root,defaults,noatime,compress=zstd 0 0
UUID=b2d79dbe-8d2b-4ee7-9dc1-00fd937abd67 /var           ext4    defaults,noatime 0 2
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
[halim@cachyos-x8664 ~]$ btrfs subvolume list /
ERROR: can't perform the search: Operation not permitted
[halim@cachyos-x8664 ~]$ sudo btrfs subvolume list /
[sudo] password for halim: 
ID 256 gen 58 top level 5 path @
ID 257 gen 24 top level 5 path @root
ID 258 gen 36 top level 256 path .snapshots
ID 259 gen 25 top level 258 path .snapshots/1/snapshot
ID 260 gen 28 top level 258 path .snapshots/2/snapshot
ID 261 gen 30 top level 258 path .snapshots/3/snapshot
ID 262 gen 31 top level 258 path .snapshots/4/snapshot
ID 263 gen 33 top level 258 path .snapshots/5/snapshot
ID 264 gen 35 top level 258 path .snapshots/6/snapshot
ID 265 gen 36 top level 258 path .snapshots/7/snapshot
[halim@cachyos-x8664 ~]$ sudo mount /dev/sdf
sdf   sdf1  sdf2  sdf3  sdf4  sdf5  
[halim@cachyos-x8664 ~]$ sudo mount /dev/sdf
sdf   sdf1  sdf2  sdf3  sdf4  sdf5  
[halim@cachyos-x8664 ~]$ sudo mount /dev/sdf4 /mnt
[halim@cachyos-x8664 ~]$ sudo btrfs subvolume list /mnt
ID 256 gen 58 top level 5 path @
ID 257 gen 24 top level 5 path @root
ID 258 gen 36 top level 256 path @/.snapshots
ID 259 gen 25 top level 258 path @/.snapshots/1/snapshot
ID 260 gen 28 top level 258 path @/.snapshots/2/snapshot
ID 261 gen 30 top level 258 path @/.snapshots/3/snapshot
ID 262 gen 31 top level 258 path @/.snapshots/4/snapshot
ID 263 gen 33 top level 258 path @/.snapshots/5/snapshot
ID 264 gen 35 top level 258 path @/.snapshots/6/snapshot
ID 265 gen 36 top level 258 path @/.snapshots/7/snapshot
[halim@cachyos-x8664 ~]$ ^C
[halim@cachyos-x8664 ~]$ ls /mnt
@  @root
[halim@cachyos-x8664 ~]$ 

try it out

https://github.com/beyondbrokkoli/cachyos-calamares/blob/patch-1/src/modules/mount/main.py
sudo rm /usr/lib/calamares/modules/mount/main.py
sudo nano /usr/lib/calamares/modules/mount/main.py
copy + paste
sudo calamares -d

summary
Isolated Setup: Temp-dir subvolume creation protects root.

Pre-flight Checks: Blocks incompatible configurations early.

Safe Rollback: Reverses all mounts on failure.

Two-Phase Logic: Mounts physical disks before binds.

benefit: the btrfs umount is not happening in the same loop as the --bind chroot mounts.
separating btrfsSubvolumes from extraMounts for "good measure".
other relevant changes: sorting mountpoints by number of "/".
the rest of the changes are irrelevant "auto" refactoring.
revert back to lexical sorting
exclude subvolumes that would be nested on another partition causing umount errors
pacman permission error workaround
breaking everything
now that everything is separated we can do the lazy umount -l without risking hitting sensitive bind mounts. the calamares parent process holds the directory so a regular umount doesn't work
"magic tricks"
option is already present
@beyondbrokkoli beyondbrokkoli marked this pull request as ready for review February 7, 2026 23:05
@beyondbrokkoli beyondbrokkoli changed the title mount: btrfs fix suggestion + error handling mount: btrfs fix suggestion Feb 17, 2026
@beyondbrokkoli beyondbrokkoli changed the title mount: btrfs fix suggestion mount: btrfs fix suggestion refactor Feb 17, 2026
@beyondbrokkoli beyondbrokkoli changed the title mount: btrfs fix suggestion refactor [mount] Defensive Phasing & Atomic Btrfs Setup Feb 17, 2026
@beyondbrokkoli beyondbrokkoli changed the title [mount] Defensive Phasing & Atomic Btrfs Setup [mount] Reliable Phasing & Defensive Btrfs Setup Feb 17, 2026
@beyondbrokkoli beyondbrokkoli changed the title [mount] Reliable Phasing & Defensive Btrfs Setup [mount] Reliable Phasing & Btrfs Setup Feb 17, 2026
@beyondbrokkoli beyondbrokkoli changed the title [mount] Reliable Phasing & Btrfs Setup [mount] btrfs fix suggestion Feb 18, 2026
@beyondbrokkoli beyondbrokkoli changed the title [mount] btrfs fix suggestion [mount] manual partitioning Feb 21, 2026
@beyondbrokkoli beyondbrokkoli changed the title [mount] manual partitioning [mount] manual partitioning & btrfs setup Feb 21, 2026
@ptr1337 ptr1337 requested a review from Copilot February 21, 2026 13:29
Copy link
Copy Markdown

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

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


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/modules/mount/main.py
Comment thread src/modules/mount/main.py
Comment thread src/modules/mount/main.py
Comment thread src/modules/mount/main.py
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.

2 participants