Before You Begin
⚠️ WARNING: Removal destroys your data, and it does so by itself
Removing the RPM or the Debian package deletes the spool directory, the printer setup files, the socket directory, the master configuration, the hosts file, the licence file and the spooler account. There is no prompt and no data-preserving form of the command. On Debian, apt remove destroys as much as apt purge. Save everything you want to keep before you start.
⚠️ WARNING: The licence file goes with it
The licence file is deleted by every packaged removal and by the tarball de-installer. If you install Xi-Text again afterwards, the installation writes a trial licence in its place and says nothing, so the loss shows up weeks later when the trial expires. Copy the licence file out of the installation before you remove anything.
⚠️ WARNING: Service interruption
Removal stops all printing. A clean stop can take up to five minutes on a busy system. Schedule the work in a maintenance window.
Stop Xi-Text First
Stop the spooler before you take the backup, and take the backup before you remove anything. The saved queue files are rewritten at most every 300 seconds, so an export taken from a running spooler can be minutes behind the live queue. Stopping flushes both files.
# Stop the spooler
sstop -y
# Verify stopped
ps -ef | grep spshed
sstop -y halts every printer, synchronises the spool files and then releases the shared memory. It waits in fifteen-second intervals for up to 300 seconds and prints its progress, so let it finish rather than interrupting it.
If you started Xi-Text with spstart by hand rather than through the service, note that removing the package asks systemd to stop the service and systemd knows nothing about a hand-started spooler. The removal will then delete the spool tree underneath a running scheduler. Stop it yourself, as above, in every case.
Backup Important Data
With the spooler stopped, export what you want to keep. Put the backup directory somewhere outside /var/spool/xi, because that whole tree is deleted by a packaged removal.
# Create backup directory
BACKUP_DIR="/var/tmp/xitext-final-$(date +%Y%m%d-%H%M%S)"
mkdir -p "$BACKUP_DIR/Scripts"
# The licence file - save this first, every removal route deletes it
cp /usr/libexec/xi/.xitext.lic "$BACKUP_DIR"
# Export jobs (writes a replayable script plus the job files)
xt-cjlist -D /var/spool/xi/spd spshed_jfile "$BACKUP_DIR/joblist.sh" "$BACKUP_DIR/Scripts"
# Export printers
xt-cplist -D /var/spool/xi/spd spshed_pfile "$BACKUP_DIR/ptrlist.sh"
# Export user permissions
xt-spuconv -D /var/spool/xi/spd spufile23 "$BACKUP_DIR/userlist.sh"
# Backup printer setup files
cd /var/spool/xi/printers
tar cf "$BACKUP_DIR/ptrdefs.tar" .
# Backup configuration files
cp /etc/xi/textconfig /etc/xi/text-hosts "$BACKUP_DIR"
Xi-Text ships xt-backup, which runs the same four export steps - jobs, printers, printer definitions and user permissions - and asks you where to put the results. It must be run as root, and it is installed by the RPM, the Debian package and the tarball alike. It is the easier route if you would rather answer questions than type paths.
The three converters produce shell scripts you can replay on a new installation, and the printer archive restores by unpacking. Neither xt-backup nor the converters save the licence file or the master configuration, which is why both are copied by hand above.
Determine Installation Type
Check which installation method was used. The three tests are independent, and on a relocated or custom installation the paths may differ - see the note on directories below.
# Find any Xi packages that are installed
rpm -qa | grep -E 'xitext|xibatch'
dpkg -l | grep -E 'xitext|xibatch'
# Tarball installations, and only tarball installations, write this file
ls -l /usr/lib/xi/install.manifest
An RPM answers to a name that carries the build variant, so a standard build is xitext_standard and a cronus build is xitext_cronus. A Debian package answers to xitext with no variant in the name. The tarball installer records every file it copies in /usr/lib/xi/install.manifest, which neither package format installs, so the presence of that file identifies a tarball installation.
Finding Your Own Directories
The paths in this article are the standard ones. A relocated installation, or one of the custom builds, puts the same files elsewhere. Your own directories are recorded in the master configuration:
grep -E 'SPOOLDIR|SPOOLPT|SPUDSOCKS|SPROGDIR|SPHELPDIR|USERPATH' /etc/xi/textconfig
A setting that matches the product's own default is written out commented, so an entry starting with # still tells you the value in use.
Uninstalling RPM Installation
Step 1: Stop Xi-Text and Check the IPC Resources
Stop the spooler as described above if you have not already. A clean stop releases every System V resource Xi-Text holds: the three shared memory segments are removed, the two lock files and the two request sockets are unlinked. Xi-Text creates no semaphores and no message queue, so there is nothing else to release.
Check that the stop did its job, while the package - and therefore Xi-Text's own tools - are still installed:
# Xi-Text's shared memory keys all begin 0x58691
ipcs -m | grep 0x58691
Expected: no results. If segments remain - which happens when the scheduler was killed rather than stopped, or when the service stop timed out and systemd terminated it part-way - clear them with Xi-Text's own tool before removing the package, because the package removal deletes the tool along with everything else:
# Run as root: dump and delete the leftover Xi-Text IPC resources
xt-ripc -d
A leftover segment is easy to recognise in ipcs -m: it has no dest flag, which means the scheduler never got as far as releasing it. That flag is a Linux one, and it comes with a trap worth knowing - the moment a segment is marked for destruction its key is reported as 0x00000000, so a segment showing dest has already dropped out of the listing above. Run ipcs -m unfiltered before concluding that nothing is left.
If xt-ripc has already gone, remove the segments by key. List them with ipcs -m, take each key that begins 0x58691, and remove it individually:
ipcrm -M 0x58691003
Do not match on 0x5869 alone. That prefix is shared with Xi-Batch, whose keys begin 0x5869b, so a four-digit match on a machine running both products destroys Xi-Batch's live queue.
The stop timing out is worth guarding against in advance on an RPM installation, because the service unit the RPM writes uses systemd's default 90-second stop timeout while a clean stop can need up to 300 seconds. Check yours, and raise it before a removal on a busy system:
systemctl show xitext -p TimeoutStopUSec
Step 2: Remove RPM Package
Remove the GUI sub-packages in the same command if they are installed, because each of them requires the main package:
# Uninstall package (add the sub-packages you have)
rpm -e xitext_standard-motif xitext_standard-gtk3 xitext_standard
# Verify removal
rpm -q xitext_standard
Expected output: package xitext_standard is not installed
Step 3: What the Removal Has Already Done
The package does the clean-up itself. It stops and disables the service and deletes the service unit; it removes the licence file, /etc/xi/textconfig, /etc/xi/text-hosts, /etc/Xitext-extern and the Xi-Text entries in /etc/services; it deletes the spool, printers and socket directories with everything in them; it deletes /etc/xi itself unless Xi-Batch is still installed; and it deletes the spooler account. The table below states this for each format.
Two things survive an RPM removal and are worth knowing about:
- The physical printers and their device files. Removal deletes Xi-Text's printer definitions and their setup files; the devices themselves, and any ownership or permission changes made to them when the printers were installed, are left as they are.
- A spooler group, on installations that have one. The RPM gives the account an existing system group rather than creating one, so there is normally no spooler group to remove. Check with getent group spooler before assuming there is.
Uninstalling a Debian Package Installation
Debian and Ubuntu-family systems install Xi-Text from a .deb. The procedure is the same shape as the RPM one, and the package is named xitext with no build variant in the name.
# Stop and check the IPC resources exactly as for the RPM
sstop -y
ipcs -m | grep 0x58691
# Remove the package
dpkg -r xitext
# Verify removal
dpkg -l xitext
On Debian there is no data-preserving removal. dpkg -r and apt remove run the same clean-up as dpkg --purge: the spool tree, the printer setup files, the licence, /etc/xi/textconfig, /etc/xi/text-hosts and the spooler account all go. This is contrary to what a Debian administrator expects, and it is the reason the backup step above is not optional.
Two things the RPM removes are left behind by the Debian package, and you may want to tidy them by hand:
# The Xi-Text entries in the services file (xitext, spq, xtnetsrv, xtapi)
grep -E 'xitext|xtnetsrv|xtapi' /etc/services
# The external-printer definition file
rm -f /etc/Xitext-extern
What Each Removal Route Destroys
| Item | RPM | Debian package | Tarball DEINSTALL.sh |
|---|---|---|---|
| Installed programs and help files | removed | removed | removed, from the install manifest |
| Saved queue, printer and user files, and the report file | removed | removed | removed |
| Spool directory and the queued job files in it | removed | removed | kept - the directory is only removed when it is empty |
| Printer setup files | removed | removed | kept |
| Licence file | removed | removed | removed |
| Master configuration and hosts file | removed | removed | removed |
| /etc/Xitext-extern | removed | kept | kept |
| Xi-Text entries in /etc/services | removed | kept | kept |
| spooler account | removed | removed | kept |
| systemd unit | removed | removed | removed on systemd only |
| SysV init script, inittab or /etc/rc entries | never installed | never installed | kept - see the tarball section |
The /etc/xi directory itself is removed by both packages unless Xi-Batch's batchconfig is still in it, and by the tarball de-installer only when it is empty.
Uninstalling Tarball Installation
Step 1: Locate the DEINSTALL.sh Script
The distribution archive contains a script called DEINSTALL.sh. There is no file called UNINSTALL and no file called DEINSTALL - the name carries its suffix. It lives at the top level of the unpacked distribution, beside INSTALL:
# In the directory the distribution was unpacked into
ls -l DEINSTALL.sh
If the unpacked distribution has been deleted, unpack the archive again from your download or your media; the script needs nothing from it but itself.
Step 2: Check Its Prerequisites
Xi-Text's de-installer will refuse to run without all of the following:
- root. It exits immediately for any other user.
- The install manifest at /usr/lib/xi/install.manifest, which the tarball installer wrote and which lists every file and directory it created. Without it the script exits, because it has no other record of what to remove. Keep a copy of this file - it is your only inventory afterwards.
- Today's date as its only argument, in YYYYMMDD form. This is a deliberate confirmation step, and the script prints what it is about to do and exits when the argument is missing or stale.
- sudo on the PATH. The script deletes the manifest's files through sudo, even when it is already running as root.
Step 3: Run DEINSTALL.sh
# Execute as root, with today's date
./DEINSTALL.sh $(date +%Y%m%d)
The script runs sstop -y itself, so it stops Xi-Text for you. Take the backup before you run it, which means stopping the spooler yourself first, as above.
It then removes the systemd unit, deletes the licence file, the saved job, printer, user and report files and the request socket, and finally deletes every file the manifest lists and removes the manifest's directories.
Step 4: Finish the Parts DEINSTALL.sh Leaves
Five categories of thing are left behind, by design or by omission, and each needs a decision rather than a blind deletion.
Queued Jobs and the Spool Directory
The script removes directories with rmdir, which fails on a directory that still has contents. A queue with jobs in it therefore survives, along with the numbered subdirectories the spool directory uses. Inspect before deleting:
ls -la /var/spool/xi/spd
# When you are satisfied nothing there is wanted
rm -rf /var/spool/xi/spd
Printer Setup Files
Printer setup files are created after installation, by Ptrinstall rather than by the installer, so the manifest never lists them and they survive. This is usually what you want: they are the record of how each printer was configured, and they are the hardest part of an installation to reproduce. Save them before deleting them.
# One directory per printer
ls -l /var/spool/xi/printers
# Keep a copy
cd /var/spool/xi/printers
tar cf /var/tmp/xitext-printers.tar .
# Then, if you are sure
rm -rf /var/spool/xi/printers
The physical printers and their device files are untouched by any removal route, as are any ownership and permission changes made to those devices when the printers were installed.
Startup Integration on Systems Without systemd
The de-installer removes the systemd unit and prints a warning for every other init system rather than acting. On a machine using SysV init, upstart, AIX inittab or the HP-UX /etc/rc mechanism, remove the entries the installer added by hand:
# SysV init
/etc/init.d/xitext stop
rm -f /etc/init.d/xitext
rm -f /etc/rc*.d/*xitext
# AIX - remove the spstart line
grep spstart /etc/inittab
# HP-UX - remove the Xi-Text lines from /etc/rc
Leftover Sockets and Lock Files
The de-installer removes the stream request socket and leaves its datagram twin and the two lock files. They are harmless, and they are tidied with the socket directory:
ls -l /var/spool/xi/spuds /var/spool/xi/spd/*.lock
rm -f /var/spool/xi/spuds/spshed_req_udp /var/spool/xi/spd/spjob.lock /var/spool/xi/spd/spptr.lock
The System Account, the Services File and the Extern File
# Xi-Text service entries (xitext, spq, xtnetsrv, xtapi)
grep -E 'xitext|xtnetsrv|xtapi' /etc/services
# External printer definitions
rm -f /etc/Xitext-extern
# The system account - only if Xi-Batch is not also using it
userdel spooler
Check before removing the account: Xi-Batch runs as batch rather than spooler, so the two products do not share it, but a site may have given the account other work.
Verification Steps
After uninstallation, verify complete removal.
Check Processes
# No Xi-Text processes should be running
ps -ef | grep -E 'spshed|spd|xtnetserv'
Expected: no results, other than the grep itself.
Check IPC Resources
# No Xi-Text shared memory should remain
ipcs -m | grep 0x58691
Expected: no results. There is nothing to check with ipcs -q or ipcs -s, because Xi-Text uses neither message queues nor semaphores.
Check Files
# User commands
ls -l /usr/local/bin/sp* /usr/local/bin/xt-* 2>/dev/null
# Internal programs and help files
ls -ld /usr/libexec/xi /usr/share/xi 2>/dev/null
# Spool, sockets and printer setup files
ls -ld /var/spool/xi/spd /var/spool/xi/spuds /var/spool/xi/printers 2>/dev/null
# Tarball install manifest
ls -l /usr/lib/xi/install.manifest 2>/dev/null
Expected: "No such file or directory" for each, on a packaged removal. After a tarball removal, expect the spool and printers directories to remain if they had contents.
Check Configuration
ls -l /etc/xi/textconfig /etc/xi/text-hosts /etc/Xitext-extern 2>/dev/null
grep -E 'xitext|xtnetsrv|xtapi' /etc/services
Expected after an RPM removal: no results from either. After a Debian or tarball removal, expect /etc/Xitext-extern and the services entries to remain.
Check Services
systemctl status xitext
ls -l /usr/lib/systemd/system/xitext.service /lib/systemd/system/xitext.service 2>/dev/null
Expected: unit not found, and no unit file. Note that the unit is installed under /usr/lib/systemd/system or /lib/systemd/system depending on the format, and never under /etc/systemd/system.
Check User
id spooler
Expected: "no such user" after a packaged removal. After a tarball removal the account is still there, because the de-installer leaves it.
Platform-Specific Considerations
RPM and Debian packages are Linux-only formats. On Solaris, AIX and HP-UX the tarball is the only distribution, so the tarball procedure above is the one that applies - including the point that its startup clean-up is implemented for systemd alone, which none of those platforms uses.
Removing the System Account
Only the tarball route leaves the account behind. The command differs by platform:
# Linux, Solaris and HP-UX
/usr/sbin/userdel spooler
# AIX
rmuser spooler
Clearing IPC Resources
xt-ripc -d is the portable answer and works on every platform Xi-Text ships for. Where it has already been removed, list the segments with ipcs -m and remove each Xi-Text key individually with ipcrm -M <key>, which avoids the differences between the platforms' ipcs output formats.
Troubleshooting
- "Permission denied" errors
- Ensure running as root or with sudo privileges. The tarball de-installer also requires sudo to be on the PATH, because it deletes the manifest's files through it.
- RPM removal fails with a dependency error
- The Motif and GTK3 GUI sub-packages each require the main package. Remove them in the same command rather than forcing the removal.
- Shared memory segments remain after the stop
- The scheduler releases them itself during a clean shutdown, so leftovers mean the shutdown did not complete - commonly because the service stop timed out and the scheduler was terminated part-way. A clean stop can need up to 300 seconds. Run sstop -y, wait for it, and use xt-ripc -d for anything still there.
- DEINSTALL.sh exits with "Date didn't match"
- The script takes today's date as its argument in YYYYMMDD form, as its own message shows. This is the confirmation step working as intended.
- DEINSTALL.sh exits with "Manifest file ... not readible"
- The install manifest at /usr/lib/xi/install.manifest is missing. The script cannot proceed without it, because the manifest is its only record of what was installed. Restore a copy if you kept one; otherwise the installation has to be removed by hand, directory by directory, using the master configuration to find where each one is.
- Files remain after uninstall
- Check for files in relocated directories. Read the master configuration first if it is still there, and otherwise search:
find / \( -name 'spshed*' -o -name '.xitext.lic' \) -print 2>/dev/null - Cannot remove user (user busy)
- Other processes may still be running as the account. Identify them with:
ps -ef | grep spooler - You removed Xi-Text and now need it back
- Reinstall, then restore the licence file you copied out before the removal and confirm it with xt-checklic. A fresh installation writes a trial licence, so check this rather than assuming the product is correctly licensed because it starts.