pseudo(1)
π NAME π
pseudo β run a command in a virtual root environment π«Ά
okay so this is the manual page for pseudo(1), from the General Commands Manual section, and bestie, it's a whole vibe. buckle up. π
β¨ SYNOPSIS β¨
pseudo [-dflv] [ -x flags ] [ -P prefix ] [ -rR root ] [ -t timeout ]
[command]
pseudo -h
pseudo [-dflv] [ -x flags ] [ -P prefix ] [-BC] -i path
pseudo [-dflv] [ -x flags ] [ -P prefix ] [-BC] -m from -M to
pseudo [-dflv] [ -x flags ] [ -P prefix ] -S
pseudo [-dflv] [ -x flags ] [ -P prefix ] -V
six whole ways to summon it. we love a flexible queen π
πΈ DESCRIPTION πΈ
So. The pseudo utility gives you a virtual root environment β from here on out we're calling it the pseudo environment, periodt β and it lets you create file system images and packages even though you do not have root privileges. no sudo, no gatekeeping, just vibes and files. π
How does it do this absolute sorcery? It pushes a special library, libpseudo.so, into the LD_PRELOAD environment variable. That library intercepts a large number of common filesystem operations, plus some user-id related operations, and hands back values that look as though the operations had been performed by a root user. the audacity. the range. π
All of that is then managed by a daemon program which keeps a list of virtualized file ownership and permissions β and that daemon program itself is pseudo. it's giving main character energy honestly.
The pseudo program itself can also be used as a program launcher. The launcher automatically configures a working environment, then executes processes within that environment. Alternatively, you can bypass this whole thing by setting up certain environment variables (see the ENVIRONMENT section below). Once that's set up, the pseudo client library (libpseudo.so) can start the server automatically. lowkey elegant. π¦
You can invoke the pseudo command in one of several possible modes:
-Bβ causespseudoto scan its database, exactly like the-Coption does, but instead of reporting mismatches,pseudotries to repair them. Specifically, device and inode number mismatches get corrected, and symlink or directory mismatches result in deletion of database entries. it's the fixer arc. π₯-Cβ causespseudoto scan its database, comparing against the filesystem, and report likely errors. heads up though: this may be unreliable when the server is actively running. π-hβ causespseudoto print a usage message and exit. the classic "help me bestie" move.-iβ causespseudoto attempt to correct device number mismatches by checking inodes. Ifpathhas the same inode number as recorded in the database, but a different device number, then all instances of the device number recorded in the database are updated to the device number in the live filesystem forpath. This is intended to handle the mismatches that can occur when remounting an NFS filesystem. The-ioption implies the-Coption. You can also specify the-Boption to request that the database be rebuilt. π οΈ-mβ the-mand-Moptions causepseudoto rename files, replacing the string from with the string to. The-moption pair implies the-Coption. You can also specify the-Boption to request that the database be rebuilt. glow-up for your paths β¨-Vβ causespseudoto print configuration information and exit immediately. info dump, no notes.-Sβ causespseudoto try to find an existing server, and if it finds one, instructs that server to shut down as soon as all clients are detached from it. Note that the server will not shut down while clients are connected to it; in this case,pseudowill print a list of the remaining client PIDs. it's polite about it. π«Ά-dβ causespseudoto immediately detach and run in the background as a daemon. This is rarely useful except for debugging. niche use case, but we respect it.
And finally β invoked with none of these options β pseudo sets up an emulated root environment, then invokes command if it was provided, otherwise a shell (using the SHELL environment variable if it is set, or /bin/sh otherwise). the default path. the chill path. π
The following options modify the behavior of pseudo:
-d(daemonize) β Run as a daemon;pseudodetaches from the calling environment and runs as a daemon. The command returns successfully if this appears to have succeeded, otherwise it produces an error message and returns a failure status. π€-f(foreground) β Run in the foreground;pseudoruns as a server, and does not try to start other commands. This mode is useful for debugging. π-l(log) β Enable logging. Thepseudodaemon will log every filesystem transaction in the log database. every single one. it's a chronicler. π-rroot /-Rroot β Set thePSEUDO_CHROOTenvironment variable, running as though the program had calledchroot(2)on the specified path. With-r, this implies changing the working directory to the specified directory; with-R, it does not. know the difference bestie, it matters. π-ttimeout β Set the timeout of thepseudodaemon, in seconds. The default is currently 30 seconds. After this long with no attached clients, thepseudodaemon shuts down automatically. The server never shuts down while it has attached clients. Note that this does not prevent continued use; new clients can restart the daemon if they need it. it naps, it doesn't die. π΄-v(verbose) β Increase the verbosity of thepseudodaemon, and the client library for any programs started by this invocation ofpseudo. This is equivalent to the numeric form of thePSEUDO_DEBUGenvironment variable; multiple-voptions increase the debugging level. stack 'em. π£οΈ-x(debug) β Set specific debugging flags (thepseudoutility's help message lists them). This is equivalent to the string form of thePSEUDO_DEBUGenvironment variable. π
π« EXAMPLES π«
The two most common usages of pseudo are: using it to run specific commands, and setting up an environment manually for running various other commands.
Case one β running specific commands. The usage is reasonably simple:
$ /path/to/pseudo
# commands which require root privileges
You may have to use the -Pprefix option to tell pseudo where to look for its database and server. If you specify a full path, pseudo assumes that PSEUDO_PREFIX should be the path to the directory containing the pseudo program, or to the /bin directory containing the pseudo program. π
Case two β setting up an environment. This is suitable for use in Makefiles or similar environments, where you want to run a series of commands in the pseudo environment, but not to keep invoking the pseudo command. To do this, set up the PSEUDO_PREFIX, LD_PRELOAD, and LD_LIBRARY_PATH environment variables, then run programs normally. You do not need to separately invoke the pseudo daemon; the client library starts it as needed. it just knows. β¨
If you have moved a directory which pseudo was tracking, you may be able to get the database reattached using the -m option. A typical usage might be:
$ /path/to/pseudo -B -m oldpath -M newpath
This requests that pseudo replace the string oldpath with the string newpath at the beginnings of filenames, then regenerate the database, correcting any device/inode numbers. moving day, no cap. π¦
π©Ί DIAGNOSTICS π©Ί
Depending on invocation, diagnostic messages usually go either to standard error or to the file PSEUDO_PREFIX /var/pseudo/pseudo.log. By default, pseudo daemon messages go into the log file, but messages generated by the client code go to standard error. These can be changed using the PSEUDO_DEBUG_FILE environment variable, documented in ENVIRONMENT. π¨
At the default logging level, only critical messages are displayed. If you have raised the logging level (using the -v option or the PSEUDO_DEBUG environment variable), additional messages are displayed. Levels higher than 2 are very unlikely to be useful outside of pseudo development. like, genuinely, don't. π
Diagnostic messages seen by default are those which are believed to indicate either a serious internal flaw in pseudo or a completely unexpected failure from the underlying operating system. In normal use, you should see no diagnostic messages. so if you're seeing them... bestie, something's up. π¨
π ENVIRONMENT π
okay so the two biggest env vars for pseudo are LD_PRELOAD and LD_LIBRARY_PATH. but bestie, listen β these don't have any special sauce for pseudo itself. they're just used the normal way to gaslight the dynamic linker into loading libpseudo so it can intercept calls into the underlying C library. π
the following environment variables are used directly by pseudo:
PSEUDO_BINDIRβ this dir holds the path to the pseudo binary. by default, it's thebindirectory underPSEUDO_PREFIX. β¨PSEUDO_CHROOTβ holds the current emulatedchroot(2)path. paths that are relative to this are treated as if they were relative to the filesystem root instead. πΈPSEUDO_DEBUGβ either a numeric "debug level" for pseudo to run at, or a set of specific debugging flags (generally letters). usepseudo -hto see the available flags. ngl this is useful only for debugging pseudo itself. πPSEUDO_DEBUG_FILEβ the name of a file to use for debugging messages from the pseudo client. default is to log to standard error. if the string contains a single%s, that gets replaced with the short program name; if it contains a single%d, that gets replaced with the process ID. other format specifiers (other than%%) are not allowed. by default, the pseudo server logs to the filepseudo.login thevar/pseudodirectory, while clients log to standard error. πPSEUDO_DISABLEDβ if this is set to a value that doesn't look likef,F,n,N,s,S, or a numeric zero, the pseudo client library does not modify the behavior of called functions β though it still intercepts them and blocks signals while processing them. this variable is reevaluated on every call tofork(2),clone(2)or related functions. if the value starts with a lowercase or uppercases, the pseudo client disables all server spawning and communications but still operates locally. that means no filesystem mode or permissions changes are actually recorded or reported, but functions likechown()will still report success even though nothing happens. this function is intended for debugging of issues which are complicated by the server's involvement. π«PSEUDO_ALLOW_FSYNCβ if set, pseudo will allowfsync()and related system calls, even if it was configured with the--enable-force-asyncoption. otherwise, that option results in all such calls being discarded silently, even whenPSEUDO_DISABLEDis set. the value specified doesn't matter. π₯PSEUDO_ENOSYS_ABORTβ if set, the pseudo client library callsabort()rather than settingerrnotoENOSYSwhen there's a call to a missing underlying function. this variable has no function outside of debugging pseudo itself. πPSEUDO_LIBDIRβ this directory holds the path to the pseudo shared libraries. by default, it's thelibdirectory underPSEUDO_PREFIX. (on 64-bit hosts,lib64is also used.) πPSEUDO_LOCALSTATEDIRβ this directory holds the pseudo database files and log files. by default, it's thevar/pseudodirectory underPSEUDO_PREFIX. πPSEUDO_NOSYMLINKEXPβ by default, when chrooted, pseudo prepends the chroot directory to the paths used for absolute symlinks; this makes opening symlinks produce expected results in most cases. sometimes you might want to suppress this. if this variable is unset, or set to any value other than0, pseudo expands symlink paths like this. if it's set to0, the behavior is disabled. π¦PSEUDO_OPTSβ holds options to be passed to any new pseudo servers started. typically, when pseudo is used as a launcher, this is set automatically. but you can also use it to pass options when usingLD_PRELOADto manually run things in the pseudo environment. πPSEUDO_PASSWDβ holds the path to a directory containing password and group files to use for emulation of various password and group routines. it should be the path to a directory containing theetcdirectory containing files namedpasswdandgroup. when pseudo is emulating a chroot environment, the chroot directory is used by preference. the parallelism between these cases is why this variable points at the parent directory ofetcrather than the directory containing the files. if there's no chroot environment, and this variable is also unset, pseudo falls back to a directory specified at configure time, with the default being the root directory. this is controlled by thePSEUDO_PASSWD_FALLBACKdefinition. πΈPSEUDO_PREFIXβ if set, this is used to determine the path to find the pseudo server, inPSEUDO_PREFIX/bin, and the pseudo data files, inPSEUDO_PREFIX/var/pseudo. this variable is automatically set by the pseudo program when it's used as a launcher. β¨PSEUDO_PROFILE_PATHβ if pseudo was configured with profiling enabled, this specifies a path in which to write client profiling information for use with thepseudo_profileutility (not built by default). πPSEUDO_TAGβ if set in a client's environment, its value is communicated to the server at the beginning of each client session, and recorded in the log database if any logging occurs related to a specific client. note that different clients may have different tags associated with them; the tag value is per-client, not per-server. π·οΈPSEUDO_UIDS,PSEUDO_GIDSβ these are used internally to pass info about the current emulated user and group identity from one process to another. πPSEUDO_UNLOADβ this variable is reevaluated on every call tofork(2),exec(3)or related functions. if the variable exists,libpseudo.sowill be removed fromLD_PRELOADandPSEUDO_DISABLEDbehavior will also be triggered. for processes that simplyfork(2), the behavior will be the same as ifPSEUDO_DISABLEDwas set. for new processes, after a call toexec(3)orsystem(3), pseudo will not be loaded in the new process. πͺSHELLβ if set, this will be used when pseudo is invoked without either a command or one of the options which directs it to do something other than run a command. otherwise, pseudo defaults to/bin/sh. π
π BUGS π
- the pseudo database is not particularly robust when whole directory trees get moved, or when the underlying device and inode numbers change. it has a reasonable chance of recovering if only the path or the device numbers have changed, but it is not particularly designed to address this. a future release is expected to have improved resilience in these cases. π
- the filesystem on which pseudo keeps its database and files must at a minimum support UNIX domain sockets and reasonable file locking semantics. note that pseudo relies on
flock(2)locking semantics; a lock has to persist into a child process. this should probably eventually be fixed. π - the pseudo client library is probably thread-safe, but has not been adequately tested or debugged in that context. π§΅
- filesystem performance is noticeably worse under pseudo than it is otherwise. this is probably because nearly every operation (other than reads and writes) involves at least one round-trip network communication with the server, and probably some kind of database activity. π’
π SEE ALSO π
π FURTHER READING π
documentation of the internals of pseudo may be found in the doc subdirectory of the pseudo source tree. π
and that's the whole vibe! the footer says pseudo - pretending to be root and pseudo(1) β that's the source/version and section, so you know it's official. periodt. π
β¨
π¦ where this page comes from
- ubuntu stonking: pseudo 1.9.2+git20250711+d1db9c219abf-2 Β· LGPL-2.1-only
- Copyright (c) 2010 Wind River Systems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms