fix(recovery): use modern no-log-replay mount option and report stderr

This commit is contained in:
Codex
2026-10-13 23:04:11 +03:00
parent 579f3bb071
commit 6baccefde2
2 changed files with 16 additions and 4 deletions
+7 -3
View File
@@ -150,8 +150,12 @@ def sync_tree(root):
class Btrfs:
def run(self, argv):
return subprocess.run(argv, check=True, text=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=dict(os.environ, LC_ALL='C')).stdout
try:
return subprocess.run(argv, check=True, text=True, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, env=dict(os.environ, LC_ALL='C')).stdout
except subprocess.CalledProcessError as exc:
detail = (exc.stderr or '').strip()[:2000]
raise RecoveryError(f'{argv[0]} failed ({exc.returncode}): {detail}') from exc
def info(self, path):
output = self.run(['btrfs', 'subvolume', 'show', str(path)])
fields = dict(line.strip().split(':', 1) for line in output.splitlines() if ':' in line)
@@ -476,7 +480,7 @@ def mounted(backend, device, filesystem, writable=False):
options = ['rw' if writable else 'ro', 'nosuid', 'nodev', 'noexec']
if filesystem == 'btrfs':
options.append('subvolid=5')
if not writable: options.append('nologreplay')
if not writable: options.append('rescue=nologreplay')
backend.run(['mount', '-t', filesystem, '-o', ','.join(options), device, str(directory)])
did_mount = True
if filesystem == 'btrfs':