Reprise Manual

Diagnose and repair a SliTaz system

Reprise finds what is broken on a SliTaz system and proposes repairs. It works offline first. Use it when the desktop went black after an upgrade, the network died after a hand edit, or a program stopped starting after a library changed. It is a POSIX shell script for busybox ash, with no daemon.

Reprise repairs in three ways:

Nothing changes without your y. Every change is explained first, backed up, written to a journal, and can be undone. This manual describes reprise 0.4.9.

Install

Reprise is the reprise package (category system-tools). It puts the program in /usr/bin/reprise and its checks, repairs and fixes database in /usr/share/reprise:

# spk-add reprise

Two packages are suggested, both optional: filature-report sends the bug reports, spk brings spk-doctor and spk-search, which sharpen the package checks and find the package of a missing library. To install or reinstall packages, reprise uses spk-add, or tazpkg when spk is not there.

Quick start

$ reprise                      # diagnose, say what is wrong
# reprise --fix                # propose repairs, one [y/N] each
# reprise --undo               # put back what the last repairs changed
$ reprise --send               # report a bug to the SliTaz developers
# reprise --rescue=/mnt/sda1   # inspect a system mounted from a live CD

Options

OptionDoesRoot
(none)Diagnose: run the checks, show the known problems.no
--fixDiagnose, then propose repairs, one [y/N] each.yes
--checkMachine output (key=value), read-only, quick.no (yes to read snapshots)
--fullWith --check: full package audit, slower.
--reportPlain-text report, no color, no question, safe to pipe.no
--sendSend a bug report to the SliTaz developers.no
--undo[=STAMP]Undo the last repairs, or those of backup STAMP.yes
--update-dbFetch the latest fixes database from filature.yes
--prepareBefore an upgrade: fetch the database, take a snapshot, note what is already broken.yes (does nothing otherwise)
--snapshotTake a snapshot of the current state.yes
--mark-goodMark the current state as known good.yes (does nothing otherwise)
--boot-entryAdd a "SliTaz rescue (reprise)" boot menu entry.yes
--rescue=DIRInspect and repair a SliTaz system mounted on DIR. Combines with the other options.
--versionShow the version.
--help, -hShow the help.

Run as a regular user, an option that needs root stops and tells the command to type, for example su -c 'reprise --fix'.

Diagnose

$ reprise

Reprise runs every check, then matches the fixes database, and ends with a summary line (12 checks, 2 problems: network xorg). Each line has a tag:

[info]Information, not a problem.
[ ok ]A check passed.
[warn]A problem, or a known problem from the database.
[err ]A check failed.

A known problem shows its id, a hint and a link https://filature.slitaz.org/bug/N. When something is wrong, reprise reminds you of su -c 'reprise --fix' and reprise --send. Colors are used on a terminal only.

Exit status: 0 when all is fine, 1 when a check failed or a known problem matched, 2 when reprise itself is broken (a missing library file, an unknown option, a bad rescue root).

Repair

# reprise --fix
  1. When the network is up (a default route exists), reprise shows the version of its fixes database and asks whether to fetch the newest one.
  2. It runs the checks and matches the database.
  3. It proposes the repairs of the matching database entries first, then the generic repairs of each failed check.
  4. When a repair was applied, it runs the failed checks again and says which problems remain.
  5. It offers to send the results anonymously (see Reports).

Before each question, reprise shows what is broken, what will change exactly (a diff, a command, versions) and where the backup goes:

Problem : SLITAZ_ARCH has a wrong value in /etc/slitaz/slitaz.conf
Change  :
    - SLITAZ_ARCH="i486"
    + SLITAZ_ARCH="x86_64"
Backup  : /var/lib/reprise/backups/20261202-101530 - undo with: reprise --undo
Set SLITAZ_ARCH="x86_64" in /etc/slitaz/slitaz.conf? [y/N]

Only y, yes (or o, oui), in any case, is a yes. Enter, end of input or any other answer is a no. The same repair proposed by two checks is asked once. Exit status: 1 when checks had failed, else 0.

Undo

# reprise --undo
# reprise --undo=20261202-101530

Each reprise run that changes something keeps a backup directory /var/lib/reprise/backups/<YYYYMMDD-HHMMSS>/ with the saved files and a MANIFEST. --undo takes the newest one, --undo=STAMP a given one. Reprise lists what it will do (restore a file, remove a file it created, remove an installed package, reinstall the previous version of a package) and asks first. The manifest is then renamed MANIFEST.undone. When no backup matches, reprise lists the existing ones.

A forced reinstall (reinstall-pkg) cannot be undone: the packages come back as published.

Rescue a broken system

From a live CD

Boot a SliTaz live CD or USB key, mount the broken system and give its mount point to --rescue:

# mount /dev/sda1 /mnt/sda1
# reprise --rescue=/mnt/sda1
# reprise --rescue=/mnt/sda1 --fix

The directory must hold etc/slitaz-release, else reprise stops (is the partition mounted?). In rescue mode, the tests that need the running system are skipped (network state, DNS, sound card, kernel command line, library tracing), packages are installed with --root=DIR, and the backups, snapshots and journal are those of the inspected system. Repairs need the root mounted read-write. When the broken system has no fixes database cache, reprise uses the one of the live system.

The rescue boot entry

# reprise --boot-entry

This adds a "SliTaz rescue (reprise)" entry to /boot/grub/grub.cfg (or /boot/grub/menu.lst): the same kernel and arguments as the first entry, plus reprise. On an EFI install without a GRUB configuration in /boot/grub, mount the EFI partition on /boot/efi and edit its grub.cfg, or press e in the GRUB menu and add reprise to the linux line for one boot.

With reprise on the kernel command line, the system starts in text mode and runs a reprise session on the console before anything graphical. It waits up to 15 seconds for the network and fetches the newest fixes database when it is up, runs the checks, proposes the repairs, offers to send the results, then asks to reboot. Answer no and the boot goes on without the graphical session; type reboot when done.

Known good state and snapshots

A snapshot is kept in /var/lib/reprise/snapshots/<stamp>/ (a few MB, mode 700):

etc.tar.gz        /etc as it was
boot.tar.gz       /boot/grub/grub.cfg and menu.lst
packages.list     installed packages, "name version"
files.tsv.gz      files of each package
missing.tsv       files already missing then (not a breakage)
INFO              why it was taken: prepare, mark-good or manual

Snapshots are taken by:

The known good state is the snapshot named in /var/lib/reprise/good, or the newest snapshot when the system was never marked good. --prepare and --mark-good keep the 5 newest snapshots and the known good one, and remove the others.

spk keeps the packages an upgrade replaced in /var/cache/spk/previous: this is what lets reprise roll a package back offline.

The checks

The checks run in this order: network, arch, packages, changes, libs, desktop, xorg, kernel, then audio, backups, commands, users.

CheckLooks atProposes
networkAn interface other than lo is up; /etc/resolv.conf has a nameserver; slitaz.org resolves (nslookup). net-reset
archSLITAZ_ARCH in /etc/slitaz/slitaz.conf (i486 when unset) matches the real architecture, read from /bin/busybox. A wrong value makes every install and upgrade fail. sync-arch
packagesThe package database in /var/lib/tazpkg: installed.info, a receipt for each package, listed files present on disk, declared dependencies installed (PROVIDE and packages.equiv are honoured). Uses spk-doctor when installed. reinstall-pkg, install-pkg
changesAgainst the known good state: packages upgraded since, packages that came back with far fewer files (at least 10 and a third of them lost), configuration files changed in /etc. rollback-pkg
libsA library overwritten by a twin package; every program in /bin, /sbin, /usr/bin, /usr/sbin resolves its libraries and symbols; libraries of /lib and /usr/lib find their dependencies. Nothing is run: the glibc loader only traces. reinstall-pkg, provide-missing-lib, rollback-pkg
desktopWhen Xorg is installed: the slim theme of /etc/slim.conf exists (when LOGIN_MANAGER="slim" in /etc/rcS.conf), openbox has /etc/xdg/openbox/rc.xml, lxpanel has a panel profile, the configured GTK theme is installed. rollback-pkg, restore-conf
xorg/var/log/Xorg.0.log: fatal server error and its cause, (EE) lines; configured drivers installed; /dev/dri/card0 for a KMS driver; X stuck on the slow fbdev driver of an old repair. restore-conf, xorg-safe
kernelModules for the running kernel, a root= on the kernel command line, in rescue mode a /boot/vmlinuz-<version> for each /lib/modules/<version>, kernel and initrd files of /boot/grub/menu.lst. boot-fallback
audioWith sound hardware: ALSA support and a sound card; /etc/asound.conf not empty, with balanced braces.-
backupsReprise's own backups and snapshots: more than 10, backups older than 30 days, or more than 50 MB in all. remove the oldest (the newest and the known good snapshot are kept)
commandsuname, mount, umount, grep, sed, awk, ps, df, free, tar, gzip, wget, vi, login, init are present. -
users/etc/passwd: numeric uid, an entry in /etc/shadow, for regular users (uid 1000 and up) a home and a shell; the system users of dbus (messagebus), avahi and pelote when those packages are installed. reinstall the daemon package, create the missing home (owner uid:gid, mode 755)

Notes:

The repairs

Reprise ships a closed set of repairs; the fixes database can only select one of them. Each first checks that its symptom is really there and does nothing otherwise.

RepairDoesUndo
rollback-pkg <pkg>Reinstall the newest cached version older than the installed one, offline, without dependencies. Packages come from /var/cache/spk/previous, /var/cache/tazpkg, /var/cache/spk. yes
restore-conf <path>Put back a file from the known good snapshot (the diff is shown).yes
provide-missing-lib <soname>Install the package shipping a missing library, found with spk-search. yes
install-pkg <pkg>...Install missing packages. yes
reinstall-pkg <pkg>...Forced reinstall of broken packages. Configuration files you changed are kept. no
set-conf-key <file> <key> <value>Set one variable in /etc/slitaz/slitaz.conf or /etc/rcS.conf.yes
xorg-safe [auto|vesa|modesetting|fbdev|tazx]auto: set aside xorg.conf and the device files of xorg.conf.d (renamed .reprise) so X autodetects. vesa, fbdev, modesetting: also write /etc/X11/xorg.conf.d/60-Device.conf with that driver (on the boot card when there are two KMS cards). tazx: let tazx video write the setup of the boot card. yes
net-reset/etc/network.conf from the known good snapshot, else DHCP (DHCP="yes", STATIC="no", wifi settings kept), else add nameserver 9.9.9.9 to /etc/resolv.conf.yes
boot-fallbackAdd a "SliTaz GNU/Linux (previous kernel)" entry for /boot/bzImage.old or vmlinuz*.old to the GRUB configuration. The main entry is never touched.yes
sync-archWrite the real architecture in SLITAZ_ARCH of slitaz.conf.yes

After an X repair, restart X to test. After a DHCP switch, restart the network: /etc/init.d/network.sh restart.

Safety rules

The fixes database

The SliTaz developers write it on filature, each entry attached to a bug. It is plain text and carries no code: an entry only selects one of the shipped repairs. Reprise uses the newest of two copies, by its fixes_version: the cache /var/lib/reprise/fixes.txt and the copy shipped in /usr/share/reprise/fixes.txt.

# reprise --update-db

The cache is refreshed by --update-db, by --prepare before each upgrade, by the rescue boot, and at the start of --fix when you say yes. The file is downloaded with wget and checked against its published sha256; the previous one is kept as fixes.txt.prev. A failed download keeps the current database.

An entry, from the shipped database:

fix=slitaz-arch-i486
bug=1001
min_reprise=0.3
when=arch x86_64
when=grep /etc/slitaz/slitaz.conf ^SLITAZ_ARCH="i486"
repair=sync-arch
hint=x86_64 cooking ISOs shipped SLITAZ_ARCH="i486"...

An entry matches when all its when= lines are true. The predicates are arch, release, pkg <name> installed|missing|<op> <version>, pkgsync <pkg>... (split packages with different versions), grep <path> <regex>, file <path> exists|missing|modified, check <name> fail|warn, sig <check> <hash>, live yes|no and rescue yes|no. An entry with no predicate, an unknown predicate or a min_reprise above the installed reprise is ignored. The shipped database covers, among others, missing Wi-Fi, Bluetooth, Ethernet and AMD graphics firmware, the efivar line that breaks /etc/init.d/local.sh, glib and libgio out of step, and Xorg drivers that fail.

Reports

Reprise never sends anything itself: filature-report does.

$ reprise --report > report.txt
$ reprise --send

--report prints a plain-text report: release, architecture, the checks and the known problems. --send runs the checks, asks you to describe the problem in a few lines (end with an empty line), shows the report and asks before sending it. Not sent or refused, it is kept in /tmp/reprise-report.<pid>; send it later with filature-report send <file>. Without filature-report, install it, or paste the output of reprise --report on filature.slitaz.org/report.

After --fix, the results of the repairs (applied, failed, declined, undone, and whether they really fixed the problem) are kept in /var/lib/reprise/feedback. Reprise offers to send them anonymously: this is how the fixes database learns which repairs work. Results not accepted are offered again after the next --fix.

Machine output

# reprise --check
# reprise --check --full

--check prints key=value lines only, problems first. It changes nothing and asks nothing. It is quick: package files and libraries are checked only for packages upgraded since the known good state; --full checks them all. TazHelper and filature-report known use it. Run it as root to read the snapshots.

check.<name>=ok|warn|failResult of each check, with .info (first problem).
sig.<name>Normalized signature of the first problem (8 hex digits), with .text.
issue.<fix>=matchedA database entry, with .hint, .bug, .repair.
upgraded.<n><pkg> <old>-><new> since the known good state.
prepare.sinceStamp of the last --prepare snapshot.
check.<name>.newProblems that check did not have at that snapshot, with .new.info: what an upgrade broke, apart from what was already broken.

Exit status: 0 healthy, 1 problems, 2 reprise itself broken.

Files and environment

PathContent
/usr/bin/repriseThe program.
/usr/share/reprise/Library, checks, repairs, shipped fixes database.
/var/lib/reprise/backups/One directory per run that changed something, with its MANIFEST.
/var/lib/reprise/snapshots/Snapshots.
/var/lib/reprise/goodThe known good snapshot and its date.
/var/lib/reprise/boot-pendingBoots that did not reach --mark-good.
/var/lib/reprise/fixes.txtFixes database cache (and .prev).
/var/lib/reprise/feedbackRepair results not sent yet.
/var/log/reprise.logJournal of repairs, undos and snapshots.
VariableUse
REPRISE_FIXES_URLDatabase URL, default https://filature.slitaz.org/fixes.txt (its checksum is the same name ending in .sha256).
REPRISE_SHAREShare directory, default /usr/share/reprise.
TMPDIRTemporary files and kept reports, default /tmp.

Troubleshooting

... needs rootRun the command given, e.g. su -c 'reprise --fix'.
does not look like a SliTaz rootThe partition is not mounted on the --rescue directory, or it is not the root partition.
... is read-only, remount it read-writeIn rescue mode: mount -o remount,rw /mnt/sda1.
No previous version of ... available offlineNo older package in the caches: a rollback is not possible; reinstall or wait for a fixed package.
spk-search is not installedInstall spk to let reprise find the package of a missing library.
... is a package this system boots onBoot the "SliTaz rescue (reprise)" entry or a live CD and use --rescue.
X configuration changed since the last startRestart X, then run reprise again.
No known good state yetNormal on a new install: the first good boot marks one.

About

Reprise is free software under the BSD license. Sources: hg.slitaz.org/reprise. Bugs and the fixes database live on filature.slitaz.org.