/ FAQ.md
FAQ.md
  1  pkgng - Frequently Asked Questions (FAQ)
  2  ========================================
  3  
  4  Table of Contents
  5  -----------------
  6  
  7  * [How can I start using pkgng?](#0)
  8  * [Is there an equivalent for pkg-orphan/pkg_cutleaves with pkgng?](#1)
  9  * [How is pkgng different from the FreeBSD pkg_* tools? What is the motivation behind pkgng?](#2)
 10  * [How is pkgng different from PC-BSD PBI packages?](#3)
 11  * [What is the difference between `pkg delete -y` and `pkg delete -f`?](#4)
 12  * [Where is `pkg info -R`, the old `pkg_info` had `-R`?](#5)
 13  * [Can pkgng replace a package with an another version, eg. pkg upgrade pkg-1.0 pkg-2.0?](#6)
 14  * [How does pkgng deal with dependencies?](#7)
 15  * [The repository format of pkgng is different from the old one. Will pkgng adapt the old format too?](#8)
 16  * [Does `pkg repo` include symlinked packages?](#9)
 17  * [How do I know if I have packages with the same origin?](#10)
 18  * [How to start working with multi-repos in pkgng?](#11)
 19  * [Why is `pkg create` slow?](#12)
 20  * [Does pkgng work with portaudit?](#13)
 21  * [When will pkgng be the default package manager?](#14)
 22  * [How can I use pkgng with portmaster?](#15)
 23  * [How can I use pkgng with portupgrade?](#16)
 24  * [pkgng does not work it says: /usr/local/sbin/pkg: Undefined symbol "pkg_event_register"](#17)
 25  * [Can pkgng cope with parallel installs?  What happpens if I simultaneously (attempt to) install conflicting packages?](#18)
 26  * [If I use "pkg delete -f", what happens to packages that depended on the forcibly-deleted package?](#19)
 27  * [What happens if I delete a package where I've modified one of the files managed by the package?](#20)
 28  * [What facilities does it have for auditing and repairing the package database? (ie checking for inconsistencies between installed files and the content of the package database)?](#21)
 29  * [Will it detect that a package install would overwrite an existing?](#22)
 30  * [If so, what happens to the file metadata (particularly uid, gid and mtime)?](#23)
 31  * [Can it track user-edited configuration files that are associated with packages?](#24)
 32  * [Can it do 2- or 3-way merges of package configuration files?](#25)
 33  * [The README states "Directory leftovers are automatically removed if they are not in the MTREE."  How does this work for directories that are shared between multiple packages?  Does this mean that if I add a file to a directory that was created by a package, that file will be deleted automatically if I delete the package?](#26)
 34  
 35  <a name="0"></a>
 36  ### Q: How can I start using pkgng?
 37  
 38  In order to start using pkgng, please follow the steps below.
 39  
 40  Install ports-mgmt/pkg:
 41  
 42          # make -C /usr/ports/ports-mgmt/pkg install clean
 43          # echo "WITH_PKGNG=yes" >> /etc/make.conf
 44  
 45  Now register all packages you have in the pkgng database:
 46  
 47  	# pkg2ng
 48  
 49  And that was it. Please read the man pages for more information on the commands.
 50  
 51  <a name="1"></a>
 52  ### Q: Is there an equivalent for pkg-orphan/pkg_cutleaves with pkgng?
 53  
 54  `pkg autoremove` is what you are looking for.
 55  
 56  <a name="2"></a>
 57  ### Q: How is pkgng different from the FreeBSD pkg_* tools? What is the motivation behind pkgng?
 58  
 59  The [README](https://github.com/freebsd/pkg/blob/master/README.md) should explain all of that :)
 60  
 61  <a name="3"></a>
 62  ### Q: How is pkgng different from PC-BSD PBI packages?
 63  
 64  PBI are flat/complete packages, where pkgng do package ports as there are.
 65  
 66  <a name="4"></a>
 67  ### Q: What is the difference between `pkg delete -y` and `pkg delete -f`?
 68  
 69  By default pkgng will ask before doing something, `-y == yes` means yes do it.
 70  But if a package it depends on it will fail saying it is depend on, `-f == force` means that delete it anyway.
 71  
 72  <a name="5"></a>
 73  ### Q: Where is `pkg info -R`, the old `pkg_info` had `-R`?
 74  
 75  New flags are: `pkg info -d` for depends on, and `pkg info -r` for reverse dependencies.
 76  
 77  <a name="6"></a>
 78  ### Q: Can pkgng replace a package with an another version, e.g. `pkg upgrade pkg-1.0 pkg-2.0`?
 79  
 80  Currently not, but it is in the todo list.
 81  
 82  <a name="7"></a>
 83  ### Q: How does pkgng deal with dependencies? If `pkgA-1.0` depends on `pkgB-1.0` and `pkgB-1.0` is updated to `pkgB-2.0`, will `pkgA` notice the change?
 84  
 85  Yes, `pkgA` will automatically notice the change.
 86  
 87  <a name="8"></a>
 88  ### Q: The repository format of pkgng is different from the old one. Will pkgng adapt the old format too?
 89  
 90  The documented (README) way to create a new repository creates all packages in one directory.
 91  
 92  This is different from earlier repository format, which creates it in separate directories.
 93  
 94  Pkgng does not depend on a hierarchy, it recursively finds the packages from the provided directory entry.
 95  
 96  <a name="9"></a>
 97  ### Q: Does `pkg repo` include symlinked packages?
 98  
 99  The default hierarchy has lots of symlinks which should just be ignored and thus pkgng does not read symlinks.
100  
101  <a name="10"></a>
102  ### Q: How do I know if I have packages with the same origin?
103  
104  Here is how to do that:
105  
106      sh -c 'find . -type f -name "*-*.txz" -exec pkg query -F {} %o \;' | sort | uniq -d
107  
108  As of beta17, `pkg repo` will emit a warning message and ignore any
109  older versions if it finds multiple packages from the same origin
110  when building a repo.
111  
112  <a name="11"></a>
113  ### Q: How to start working with multi-repos in pkgng?
114  
115  Please refer to the [README](https://github.com/freebsd/pkg/blob/master/README.md#multirepos), which explains how to enable and get started with multi-repos in pkgng.
116  
117  <a name="12"></a>
118  ### Q: Why is `pkg create` slow?
119  
120  The number one reason is the XZ compression, which is slow.
121  
122  <a name="13"></a>
123  ### Q: Does pkgng work with portaudit?
124  
125  No, pkgng uses internal `pkg audit` command.
126  
127  <a name="14"></a>
128  ### Q: When will pkgng be the default package manager of FreeBSD?
129  
130  Possibly in version 9.2+
131  
132  <a name="15"></a>
133  ### Q: How can I use pkgng with portmaster?
134  
135  Ensure your ports tree is up-to-date, select the PKGNG option, and install/upgrade portmaster:
136  
137      # portsnap fetch update
138      # make -C /usr/ports/ports-mgmt/portmaster config clean build deinstall install
139      # echo "WITH_PKGNG=yes" >> /etc/make.conf
140      # pkg2ng
141  
142  <a name="16"></a>
143  ### Q: How can I use pkgng with portupgrade?
144  
145  Install the latest **ports-mgmt/portupgrade**, or **ports-mgmt/portupgrade-devel**. Both support pkgng.
146  
147      # portsnap fetch update
148      # portupgrade ports-mgmt/portupgrade
149      # echo "WITH_PKGNG=yes" >> /etc/make.conf
150      # pkg2ng
151  
152  More information can be found in the portupgrade [NEWS](https://github.com/freebsd/portupgrade/blob/master/NEWS.md) file.
153  
154  <a name="17"></a>
155  ### Q: pkgng does not work it says: /usr/local/sbin/pkg: Undefined symbol "pkg_init"
156  
157  You forgot to run `make delete-old-libs` when you upgraded your system.
158  
159  During 9-CURRENT life the pkg_install tools have been split to provide a
160  shared library: libpkg.so.0. This has been reverted, this error message means
161  that this library is still on your system. Check for and delete /usr/lib/libpkg.so.0.
162  
163  <a name="18"></a>
164  ### Q: Can pkgng cope with parallel installs?  What happpens if I simultaneously (attempt to) install conflicting packages?
165  
166  No.  Parallel installs will not work -- the first to start will lock the DB, and
167  the second won't be able to proceed.
168  
169  <a name="19"></a>
170  ### Q: If I use "pkg delete -f", what happens to packages that depended on the forcibly-deleted package?
171  
172  Nothing.  If you forcibly delete a package it's assumed you understand that you know you're doing something that can break your system.
173  pkg check will detect missing dependency packages and reinstall as required.
174  
175  <a name="20"></a>
176  ### Q: What happens if I delete a package where I've modified one of the files managed by the package?
177  
178  The package is removed, but modified file is not:
179  
180  	# pkg check -s pciids
181  	pciids-20120625: checksum mismatch for /usr/local/share/pciids/pci.ids
182  	# pkg delete pciids
183  	The following packages will be deinstalled:
184  	
185  		pciids-20120625
186  	
187  	The deinstallation will free 788 kB
188  	Deinstalling pciids-20120625...pkg: /usr/local/share/pciids/pci.ids
189  	fails original SHA256 checksum, not removing
190  	pkg: rmdir(/usr/local/share/pciids/): Directory not empty
191  	done
192  	# pkg info pciids
193  	pkg: No package(s) matching pciids
194  	# ls -l /usr/local/share/pciids/pci.ids
195  	-rw-r--r--  1 root  wheel  752925 Jul 16 07:05
196  	/usr/local/share/pciids/pci.ids
197  
198  <a name="21"></a>
199  ### Q: What facilities does it have for auditing and repairing the package database? (ie checking for inconsistencies between installed files and the content of the package database)
200  
201  See pkg-check(8)
202  
203  <a name="22"></a>
204  ### Q: Will it detect that a package install would overwrite an existing
205  
206  Yes exactly that.  Files in the older package that are identical in the
207  newer one are left untouched.  Otherwise, files from the older package
208  are removed, and files from the newer package are installed.
209  
210  <a name="23"></a>
211  ### Q: If so, what happens to the file metadata (particularly uid, gid and mtime)?
212  
213  Nothing.
214  
215  <a name="24"></a>
216  ### Q: Can it track user-edited configuration files that are associated with packages?
217  
218  This works in exactly the same way as it does currently in the ports. Except if the package provide the configuration with a .pkgconf extension
219  In that if there is no user config the default configuration is created otherwise, the user edited version is kept
220  
221  <a name="25"></a>
222  ### Q: Can it do 2- or 3-way merges of package configuration files?
223  
224  No.  In general the package will install sample configuration files,
225  and will only touch the live config files if either the live configs
226  don't exist, or the live configs are identical to the sample configs.
227  This is the standard way things work in the ports at the moment.
228  
229  <a name="26"></a>
230  ### Q: The README states "Directory leftovers are automatically removed if they are not in the MTREE."  How does this work for directories that are shared between multiple packages?  Does this mean that if I add a file to a directory that was created by a package, that file will be deleted automatically if I delete the package?
231  
232  No.  Directories have to be empty before they will be removed.