.\" ================================================================================== .\" portsreinstall\-chroot(8) manual page .\" Copyright (C) 2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved. .\" ================================================================================== .TH PORTSREINSTALL\-CHROOT 8 "13 September 2018" "FreeBSD" "FreeBSD System Manager's Manual" .SH NAME portsreinstall\-chroot \- Support utility for \fBportsreinstall\fR(8) to build packages in a virtual environment .SH SYNOPSIS .B portsreinstall\-chroot [ .I OPTIONS ] [ .B \-\- ] [ .I command ] .SH DESCRIPTION This utility assists to update packages by creating and using \fBchroot\fR(8) environment for building. The ch\fBchroot\fR(8)root environment is first created by forking the host environment, and the user is asked to complete update of packages at the \fBchroot\fR(8) environment. .SH RESTRICTION When this utility is executed inside a \fBchroot\fR(8) or \fBjail\fR(8) virtual environment as the target, the execution MAY be terminated at the process of mounting and unmounting file systems. In this case, the user should follow a message which addresses to execute \fBportsreinstall\-chroot\-mount\fR(8) at the grand host environment. Note that this utility involves mounting and unmounting operations of unionfs whose implementation is still in a challenging level, and the user MAY find that the detection of the mounting/unmounting privilege is fluctuated, namely, sometimes available and sometimes not. If you want to forcibly invalidate the privilege of such operations inside \fBchroot\fR(8) or \fBjail\fR(8) environments, set \fB\-d\fR option. .PP \fI$basedir\fR/usr/local/share/portsreinstall/bin/portsreinstall\-chroot\-mount .PP for mounting, and .PP \fI$basedir\fR/usr/local/share/portsreinstall/bin/portsreinstall\-chroot\-mount unmount .PP for unmounting, where \fI$basedir\fR denotes the base directory of the target environment. Here, the exit code of the termination is 2 for mounting and 3 for unmounting. After the mounting or unmounting at the grand host environment, rerun this utility (\fBportsreinstall\-chroot\fR(8)) at the target environment. .PP If the installation path of \fBportsreinstall\fR(8) in the target environment is configured by non-default PREFIX, environment variable SYSTEMBASE must be defined for telling the base directory of the target environment as .PP .PD 0 env SYSTEMBASE=\fI$basedir\fR \\ .RS .PD 0 \fI$basedir\fR\fI$PREFIX\fR/share/portsreinstall/bin/portsreinstall\-chroot\-mount .RE .PD 0 for mounting, and .PP .PD 0 env SYSTEMBASE=\fI$basedir\fR \\ .RS .PD 0 \fI$basedir\fR\fI$PREFIX\fR/share/portsreinstall/bin/portsreinstall\-chroot\-mount unmount .RE .PD 0 for unmounting. .SH ROBUSTNESS AGAINST TERMINATION AND RESTART Execution of the commands except \fBclean\fR and \fBoptions\fR commands can be terminated at any points and restarted from there with the same options saved in the temporary database (independent among utilities). The saved options can be changed by the ways depending on the assigned groups of the options. The options and execution progress are reset to the default by \fBclean\fR command. .SH SHELL IN THE BUILDER CHROOT ENVIRONMENT The same login shell of the current user (which will be the superuser) is invoked as the login shell in the builder \fBchroot\fR(8) environment. For \fBsh\fR(1) and its families, environment variable \fIPS1\fR is modified for distinction from the host environment. For \fBtcsh\fR(1) and its families, the configuration file (\fB/root/.cshrc\fR) is modified to add a line for redefining \fBprompt\fR variable for the distinction. The original configuration file is backed up as \fB/root/.cshrc.bak\-portsreinstall\-chroot\fR. .SH ARGUMENTS One of the following \fIcommands\fR can be given for optional operations or confirmation. .TP \fBdo\fR (Default) Execute the whole process from creation of a builder \fBchroot\fR(8) environment to package update of the host system, where the flow corresponds to \fBmount\fR, \fBenter\fR, \fBportsreinstall packupgrade create\fR at the builder chroot, \fBportsreinstall packupgrade crop\fR at the builder chroot, \fBsync\fR, then \fBportsreinstall\-upgrade\fR at the host, in order. .TP \fBauto\fR [\fIoptions\fR] [\fIarguments\fR] Automatically execute \fBportsreinstall\fR(8) in the builder \fBchroot\fR(8) environment instead of the \fBenter\fR stage in the conventional \fBdo\fR process. If given, \fIoptions\fR and \fIarguments\fR are passed to \fBportsreinstall\fR(8). In case of the lost of the lower layer image of unionfs by its bug, the file system will be automatically recovered by re-mounting. .TP \fBenter\fR Just (create, if not yet, and) enter the builder \fBchroot\fR(8) environment. If once the upgrade of the host environment was completed, this command enables to reuse the same builder \fBchroot\fR(8) environment for the next upgrade with modified configuration or updated ports tree. .TP \fBmount\fR Just (create, if not yet, and) mount file systems for the builder \fBchroot\fR(8) environment. .TP \fBunmount\fR Just unmount file systems for the builder \fBchroot\fR(8) environment. .TP \fBsync\fR Synchronize the files affecting package installation (packages, distfiles, port options, ports/packages management tools configurations) of the host environment to the builder. .TP \fBdestroy\fR Destroy the builder \fBchroot\fR(8) environment. The difference from \fBclean\fR command is that the saved options are preserved. .TP \fBclean\fR .PD 0 .TP \fBclean [normal]\fR Destroy the builder \fBchroot\fR(8) environment and clean up the temporary database. .TP \fBclean force\fR Attempt to destroy the builder \fBchroot\fR(8) environment and clean up the temporary database without checking the lock and privilege. .TP \fBoptions\fR Show saved option settings and expected effects of option-resetting options \fB\-M\fR. With \fB\-a\fR option, the first, second and third columns denote the option-resetting options, reset options and remaining options, respectively. .TP .RE .SH OPTIONS If duplicated or conflicting ones are set, the last ones are effective. The end of options can be explicitly specified by \fB\-\-\fR. Short options can be given in compact forms, for example, \fB\-V \-a\fR to be \fB\-Va\fR. .PD .TP \fB*NOTE*\fR Option settings are loaded from the saved configuration (independent of \fBportsreinstall\fR(8)) unless explicitly reset by \fB\-M\fR option. The saved options can be checked by \fBportsreinstall-upgrade options\fR command. .PD .SS Group 1: Just show messages and exit without operation .IP \fB\-H\fR .PD 0 .TP \fB\-\-long\-help\fR Show a long help whose content is the same as the manual page. .PD .IP \fB\-h\fR .PD 0 .TP \fB\-\-help\fR .PD 0 .TP \fB\-\-short\-help\fR Show a short help. .PD .IP \fB\-V\fR .PD 0 .TP \fB\-\-show\-version\fR Show the current version. .PD .SS Group 2: Effective anytime .IP \fB\-a\fR .PD 0 .TP \fB\-\-batch\-mode\fR Suppress messages so as to be friendly for batch operations. Comments are suppressed as much as possible. It is noted that log output in build/installation processes are not suppressed. .PD .IP \fB\-E\fR\ \fIdelimiter(s)\fR .PD 0 .TP \fB\-\-extra\-dirs\-delim\fR=\fIdelimiter(s)\fR Sets a (set of) custom delimiter character(s) for \fB\-e\fR option. The default is comma (","). If a string longer than one-character length is set, the all characters are recognized as delimiters. .PD .IP \fB\-S\fR .PD 0 .TP \fB\-\-no\-opening\-message\fR Suppress the credit, opening and terminating messages. Option \fB\-a\fR takes higher priority over this option. .PD .SS Group 3: Saved and not renewable until cleaning .IP \fB\-b\fR \fIbasedir\fR .PD 0 .TP \fB\-\-basedir\fR=\fIbasedir\fR Specifies the base directory of the \fBchroot\fR(8) environment. The default is "/home/.portsreinstall\-chroot". .PD .IP \fB\-c\fR .PD 0 .TP \fB\-\-suppress\-cleaning\-obsolete\-database\fR Suppress cleaning the temporary database even if its obsolete. This option suppresses the default behavior that the temporary database is automatically cleaned up if it is older than the ports tree or portsreinstall itself is to be upgraded. Use of this option may cause unexpected results and basically unrecommended. .PD .IP \fB\-d\fR .PD 0 .TP \fB\-\-invalidate\-mount\-privilege\fR Forcibly invalidate the privilege of the current environment for mounting/unmounting file systems. This option can be meaningful when this utility is executed inside a \fBchroot\fR(8) or \fBjail\fR(8) virtual environment. .PD .IP \fB\-e\fR \fIdir1\fR[\fB,\fIdir2\fR[\fB,\fR...]] .PD 0 .TP \fB\-\-extra\-dirs\fR=\fIdir1\fR[\fB,\fIdir2\fR[\fB,\fR...]] Sets extra directories to mount for the chroot environment. By default (without this option), /bin, /compat, /etc, /lib, /libexec, /rootm /sbin, /sys, /usr and /var (or their entities if they themselves are symbolic links) as well as file systems overlaying their descendant directories are mounted by read-only nullfs from the host and overlaid by unionfs while /dev, /proc and /tmp are mounted with independent proper file systems. This option should be set if any of the above directories contain symbolic links referring to outside of the default directories, or if any package build/installation is customized to refer to outside of them. The delimiter is comma (",") by default and changeable by \fB\-E\fR option. .PD .IP \fB\-f\fR .PD 0 .TP \fB\-\-fullcourse\fR Carry out the \fBdo\fR process as the "full course" automatic mode where update of the ports tree and package repository are done first at the target host environment and thhen operation in the builder \fBchroot\fR(8) environment is started by cleaning of the temporary database and execution of \fBportsreinstall\fR(8) initiated with option \fB\-CGSjqx\fR (\fB\-CGSYajqx\fR if \fB\-a\fR option is set). Resuming \fBdo\fR command automatically executes \fBportsreinstall\fR(8) in the builder \fBchroot\fR(8) environment. With \fB\-a\fR option, the all detected leaf and obsolete packages will be deleted. .PD .IP \fB\-g\fR .PD 0 .TP \fB\-\-upgraded\-system\fR Adjust the all operations to be suitable as post-processes after system upgrade. Concretely, the full course mode is adjusted to reinstall the all ports by removing \fB\-q\fR option of \fBportsreinstall\fR(8). .PD .IP \fB\-P\fR .PD 0 .TP \fB\-\-load\-pkgtoolsconf\-as\-override\fR Import settings from \fBpkgtools.conf\fR(5) as the secondary. This option is effective only when \fBportupgrade\fR(1) is installed. For duplicated configurations, values in portsreinstall.conf are applied first and then those in \fBpkgtools.conf\fR(5) are. This option overrides preceding \fB\-p\fR option. .PD .IP \fB\-p\fR .PD 0 .TP \fB\-\-load\-pkgtoolsconf\-as\-default\fR Import settings from \fBpkgtools.conf\fR(5) as the primary (default). This option is effective only when \fBportupgrade\fR(1) is installed. For duplicated configurations, values in \fBpkgtools.conf\fR(5) are applied first and then those in portsreinstall.conf are. This option overrides preceding \fB\-P\fR option. .PD .IP \fB\-Q\fR .PD 0 .TP \fB\-\-ignore\-pkgtoolsconf\fR Ignore \fBpkgtools.conf\fR(5) even if it exists. .PD .IP \fB\-s\fR .PD 0 .TP \fB\-\-share\-port\-pkgs\-dirs\fR Share the ports tree (PORTSDIR=/usr/ports by default), portsnap work directory (WORKDIR=/var/db/portsnap in \fBportsnap.conf\fR(5) by default) and package cache (PKG_CACHEDIR=/var/cache/pkg in \fBpkg.conf\fR(5) by default) with the host by nullfs. .PD .SH DETAILS .SS Overview This utility is a supporting tool of \fBportsreinstall\fR(8) to build packages in a \fBchroot\fR(8) environment "forked" from the host environment which is the final target of upgrading. On-the-fly smart entire upgrade of all installed ports and robustness against termination/restart is pursued by this utility. .PP The forked environment is created by \fBnullfs\fR(5) and \fBmount_unionfs\fR(8) onto the host environment. Fetched/deleted distfiles and created/fetched/deleted packages are synchronized at the host to the forked environment. The ports options and other configurations of ports management (\fB/etc/make.conf\fR, \fB/usr/local/etc/portsreinstall.conf\fR, \fB/usr/local/etc/pkgtools.conf\fR, \fB/usr/local/etc/pkg.conf\fR and the temporary database of \fBportsreinstall\fR(8) in usual environments) are also synchronized as well. .PP The execution of \fBdo\fR command proceeds in the following step (while use of \fBauto\fR command can be more practical): .TP 1. This utility will create and mount the \fBchroot\fR(8) builder environment. .PD .TP 2. This utility will enter the builder environment, and the user will be prompted in a shell to complete the upgrade of packages by \fBportsreinstall\fR(8). .PD .TP 3. The user will exit from the builder environment when the upgrade is complete. .PD .TP 4. This utility will create packages and an archive of dispatch script for upgrade. .PD .TP 5. This utility will synchronize the host environment to the builder about distfiles, package files, ports options and other configurations of ports management. .PD .TP 6. The utility will upgrade the ports in host environment using the created packages and dispatched script set. .PD .SS Example The conventional flow of using this utility will be as follows: .PP 1. In the host (target) environment, execute this utility by the full course mode. .RS root@[host]# .B portsreinstall\-chroot -f .RE 2. After successful build of the temporary database, \fBportsreinstall\fR(8) may show select dialogues for leaf and obsolete ports/packages. Note that the choice made here can be changed afterward without any fatal risk as long as the current builder \fBchroot\fR(8) environment is preserved even after the upgrade of the host environment. .PP 3. \fBportsreinstall\fR(8) will continue to build, (re)install and deinstall processes, which take very long and impose a high load. You may want to interrupt the execution to cool down or shutdown your machine for your work or travel. In this case, press Ctrl+C at any point so that \fBportsreinstall\fR(8) will stop by preserving its progress marker information in the temporary database and this utility will unmount the builder \fBchroot\fR(8) environment. Some network troubles in fetching distfiles or packages may be resolved by terminating the process once. (Even damages due to critical accidents of kernel panics, overheating and sudden shutdown may be recovered without problem just like this intentional termination.) .RS .B Ctrl+C .RE 4. At any convenient time, restart the processes. Note that no option should be speified here. .RS root@[host]# .B portsreinstall\-chroot auto .RE 5. The process may stop with some failures which cannot be resolved automatically. It may be mismatches of port option configurations of dependencies, unrecognized conflict or essential conflict between needed packages. In this case, you will need to enter the builder \fBchroot\fR(8) environment for the manual troubleshooting. .RS root@[host]# .B portsreinstall\-chroot enter .RE 6. Then the you will be prompted in the builder \fBchroot\fR(8) environment. .RS root@[chroot]# .RE 7. Troubleshooting may be done by modifying the configuration files or struggling with \fBfreeze\fR/\fBtaboo\fR/\fBescape\fR/\fBok\fR/\fBneed\fR/\fBnoneed\fR/\fBreselect\fR/\fBreconf\fR commands of \fBportsreinstall\fR(8) referring to information obtained by \fBshow\fR command of \fBportsreinstall\fR(8). After such possible patchwork, exit from the builder \fBchroot\fR(8) environment. .RS root@[chroot]# .B exit .RE 8. Retry to continue the processes by executing .RS root@[host]# .B portsreinstall\-chroot auto .RE or, when the configuration files were modified, .RS root@[host]# .B portsreinstall\-chroot auto -L redo .RE 9. When the all necessary upgrade is completed inside the builder \fBchroot\fR(8) environment, you will be asked whether to reflect the upgrade to the host environment. If you select Yes here, package archiving in the builder \fBchroot\fR(8) environment, synchronization of package files, distfiles, port option database and configuration files for \fBportsreinstall\fR(8), and the update of the packages at the host environment will be automatically carried out. Here, again, Ctrl+C interruption and unintentional termination will be recovered by simple re-exeution of this utility. .SH "ENVIRONMENT VARIABLES" .TP .B SYSTEMBASE (Used only when the target environment is a virtual environment implemented by \fBchroot\fR(8) or \fBjail\fR(8)) The base directory of the target environment at its grand host environment. This variable is referred by \fBportsreinstall\-chroot\-mount\fR(8), which is to be executed in the grand host environment of the target environment. The default is the two-levels higher directory of PREFIX applied for installation of \fBportsreinstall\fR(8) in the target environment. .PP See also the corresponding section of \fBportsreinstall\fR(8). The variables are conveyed to the forked environment from the target host. .SH HISTORY This utility first appeared as a part of \fBportsreinstall\fR(8) version 4.0.0 released on June 29, 2018. .SH "SEE ALSO" \fBchroot\fR(8) \fBportsreinstall\fR(8), \fBportsreinstall\-chroot\-mount\fR(8), \fBportsreinstall\-upgrade\fR(8). .SH COPYRIGHT This software is distributed under the 2-Clause BSD License. .PP (C)\ 2018\ Mamoru\ Sakaue,\ MwGhennndo,\ All\ Rights\ Reserved. .PP Email:\ sakaue.mamoru@samurai.mwghennn.net .PP Homepage:\ http://www.mwghennndo.com/software/portsreinstall/