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:
- Checks: a set of tests (network, packages, libraries, X, users...) with a generic repair for each problem they find.
- The known good state: snapshots of
/etc, the boot loader configuration and the installed packages, taken when the system worked. Reprise compares the system with them and can roll back a package or put back a configuration file without knowing the bug. - The fixes database: problems learned on other machines, published by the SliTaz developers on filature.slitaz.org.
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
- Quick start
- Options
- Diagnose
- Repair
- Undo
- Rescue a broken system
- Known good state and snapshots
- The checks
- The repairs
- Safety rules
- The fixes database
- Reports
- Machine output
- Files and environment
- Troubleshooting
- About
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
| Option | Does | Root |
|---|---|---|
| (none) | Diagnose: run the checks, show the known problems. | no |
| --fix | Diagnose, then propose repairs, one [y/N] each. | yes |
| --check | Machine output (key=value), read-only, quick. | no (yes to read snapshots) |
| --full | With --check: full package audit, slower. | |
| --report | Plain-text report, no color, no question, safe to pipe. | no |
| --send | Send a bug report to the SliTaz developers. | no |
| --undo[=STAMP] | Undo the last repairs, or those of backup STAMP. | yes |
| --update-db | Fetch the latest fixes database from filature. | yes |
| --prepare | Before an upgrade: fetch the database, take a snapshot, note what is already broken. | yes (does nothing otherwise) |
| --snapshot | Take a snapshot of the current state. | yes |
| --mark-good | Mark the current state as known good. | yes (does nothing otherwise) |
| --boot-entry | Add a "SliTaz rescue (reprise)" boot menu entry. | yes |
| --rescue=DIR | Inspect and repair a SliTaz system mounted on DIR. Combines with the other options. | |
| --version | Show the version. | |
| --help, -h | Show 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
- 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.
- It runs the checks and matches the database.
- It proposes the repairs of the matching database entries first, then the generic repairs of each failed check.
- When a repair was applied, it runs the failed checks again and says which problems remain.
- 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:
reprise --prepare, called by spk-up before every upgrade. It also fetches the fixes database while the network works and notes which problems already exist. It never blocks the upgrade.reprise --mark-good, run at the end of a good boot and at the graphical login. It takes a snapshot only when/etcor the package set changed since the last one, and records it in/var/lib/reprise/good.reprise --snapshot, by hand.
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.
| Check | Looks at | Proposes |
|---|---|---|
| network | An interface other than lo is up;
/etc/resolv.conf has a nameserver;
slitaz.org resolves (nslookup). |
net-reset |
| arch | SLITAZ_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 |
| packages | The 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 |
| changes | Against 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 |
| libs | A 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 |
| desktop | When 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 |
| kernel | Modules 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 |
| audio | With sound hardware: ALSA support and a sound
card; /etc/asound.conf not empty, with balanced
braces. | - |
| backups | Reprise'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) |
| commands | uname, 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:
- In a live session (root on tmpfs), files missing from the package
lists were trimmed when the ISO was built: they are counted once as
information. Files under
/devand/boot, and files already missing in the known good state, are not counted. - On an EFI install the kernel lives on the EFI partition, which is
not mounted: an empty
/bootis not a problem. - When the X configuration changed after the last X start, the log tells about the old one: restart X before checking again.
- A changed configuration file alone is not a problem: it is offered for restore only when the xorg, desktop or network check fails.
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.
| Repair | Does | Undo |
|---|---|---|
| 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-fallback | Add 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-arch | Write 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
- Nothing changes without a
y. - Every changed file is saved first in
/var/lib/reprise/backups/<stamp>/; every repair is written to/var/log/reprise.log. - Repairs write only inside these paths:
/etc/X11/,/etc/slim.conf,/etc/lxdm/,/etc/xdg/,/etc/lxpanel/,/etc/gtk-2.0/,/etc/gtk-3.0/,/etc/network.conf,/etc/resolv.conf,/etc/hosts,/etc/rcS.conf,/etc/slitaz/,/etc/fstab,/etc/inittab,/etc/asound.conf,/etc/init.d/local.sh,/etc/locale.conf,/etc/keymap.conf,/etc/TZ,/etc/wpa/,/etc/modprobe.d/,/boot/grub/. Never passwd, shadow or group. - Packages the machine boots on (glibc, busybox, linux, grub, eudev,
gcc-lib-base and the
linux-*,grub*,*efi*,glibc*families) are replaced on the running system only when the static rename helper of spk-add (/usr/libexec/spk/spk-mv) or tazpkg is installed. Otherwise boot the rescue entry or a live CD and use--rescue. Reboot right after such a repair.
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|fail | Result of each check,
with .info (first problem). |
| sig.<name> | Normalized signature of the first
problem (8 hex digits), with .text. |
| issue.<fix>=matched | A database entry, with
.hint, .bug,
.repair. |
| upgraded.<n> | <pkg>
<old>-><new> since the known good state. |
| prepare.since | Stamp of the last --prepare
snapshot. |
| check.<name>.new | Problems 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
| Path | Content |
|---|---|
| /usr/bin/reprise | The 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/good | The known good snapshot and its date. |
| /var/lib/reprise/boot-pending | Boots that did not reach
--mark-good. |
| /var/lib/reprise/fixes.txt | Fixes database cache (and
.prev). |
| /var/lib/reprise/feedback | Repair results not sent yet. |
| /var/log/reprise.log | Journal of repairs, undos and snapshots. |
| Variable | Use |
|---|---|
| REPRISE_FIXES_URL | Database URL, default
https://filature.slitaz.org/fixes.txt (its checksum is
the same name ending in .sha256). |
| REPRISE_SHARE | Share directory, default
/usr/share/reprise. |
| TMPDIR | Temporary files and kept reports, default
/tmp. |
Troubleshooting
| ... needs root | Run the command given, e.g.
su -c 'reprise --fix'. |
| does not look like a SliTaz root | The partition is not
mounted on the --rescue directory, or it is not the
root partition. |
| ... is read-only, remount it read-write | In rescue mode:
mount -o remount,rw /mnt/sda1. |
| No previous version of ... available offline | No older package in the caches: a rollback is not possible; reinstall or wait for a fixed package. |
| spk-search is not installed | Install spk to let reprise find the package of a missing library. |
| ... is a package this system boots on | Boot the
"SliTaz rescue (reprise)" entry or a live CD and use
--rescue. |
| X configuration changed since the last start | Restart X, then run reprise again. |
| No known good state yet | Normal 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.