Preface
Goal: Examine Package Manager, Focus on Command Line Interface
This Crux is even easier with docker container, no need to set up system. Therefore we can dive right away to compilation.
Test Bed
-
Container: Docker
-
Operating System: Artix (OpenRC )
-
Window Manager: Herbstluftwm
Since we are going to use docker again, you can read a common overview here.
Of course you can use virtualization, the issue is distraction. We need to avoid tendency to focus on GUI tools. At the same time, limiting the scope to CLI tools. Most of the time, CLI tools is considered lower level than the GUI one.
Getting Started With Docker
As usual, first, we do attach docker process.
$ docker pull crux
$ docker image list
--format 'table {{.Repository}}\t{{.Size}}'
REPOSITORY SIZE
opensuse/amd64 101MB
dock0/arch 870MB
gentoo/stage3-amd64 873MB
debian 100MB
fedora 232MB
busybox 1.13MB
vbatts/slackware 86.7MB
voidlinux/voidlinux 202MB
kevinleptons/lfs-auto 753MB
crux 342MB
$ docker run -it crux
bash-4.3# exit
$ docker ps
--format 'table {{.Image}}\t{{.Names}}\t{{.Status}}'
IMAGE NAMES STATUS
opensuse/amd64:tumbleweed elegant_nightingale Up 17 hours
crux lucid_brown Up 6 hours
fedora:rawhide musing_torvalds Up 7 hours
voidlinux/voidlinux awesome_davinci Up 6 hours
gentoo/stage3-amd64 amazing_shirley Up 8 hours
vbatts/slackware cranky_keller Up 6 hours
$ docker start lucid_brown
nifty_beaver
$ docker attach lucid_brown
bash-4.3#
Package Management
Before Arch, there was Crux.
Arch was intended as additional Crux package manager,
but then was recreated from scratch.
While Arch Linux use .pkg.tar.xz
extension for package,
Crus use .pkg.tar.gz
extension for package.
Reading
Source
Front End
prt-get
Get Help
If you are helpless, just add this help | less
argument.
$ prt-get help | less
Or if you have man-db
installed.
I mean after, source downloaded, compiled, built, and finally installed,
yes you can do below command.
$ man prt-get
Updating System
First Thing First
First thing to do is updating my system as usual.
Ports Update
You can use ports -u
command.
That remind me of emerge -u
command.
$ ports -u
Updating file list from crux.nu::ports/crux-3.1/core/
Updating collection core
Finished successfully
Updating file list from crux.nu::ports/crux-3.1/opt/
Updating collection opt
Finished successfully
Updating file list from crux.nu::ports/crux-3.1/xorg/
Updating collection xorg
Finished successfully
System Upgrade
Now is time to use prt-get
,
an advanced package management tool for CRUX.
Consider system update using prt-get sysup
.
$ prt-get sysup
prt-get: updating /usr/ports/core/openssl
=======> Building '/usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz'.
bsdtar -p -o -C /usr/ports/core/openssl/work/src -xf /usr/ports/core/openssl/openssl-1.0.2g.tar.gz
cp mksslcert.sh /usr/ports/core/openssl/work/src
+ build
+ cd openssl-1.0.2g
+ export 'MAKEFLAGS= -j1'
+ MAKEFLAGS=' -j1'
...
As you can see above, openssl has been failed to compile. Which we will solve later.
Package IRSIF
Install, Remove, Search, Info, File
Read the fine manual.
Package Install
You can use prt-get install
to install new package,
or prt-get update
to upgrade package currently installed package.
$ prt-get install man nano htop mc ncdu fish
prt-get: installing /usr/ports/opt/mc
=======> Building '/usr/ports/opt/mc/mc#4.8.15-1.pkg.tar.gz'.
bsdtar -p -o -C /usr/ports/opt/mc/work/src -xf /usr/ports/opt/mc/mc-4.8.15.tar.xz
+ build
+ cd mc-4.8.15
...
Package Removal
$ prt-get remove htop
Removing package would not not package that depend on it. Package would be removed without prior warning. Therefore be careful while remove.
Package Query Search
$ prt-get search htop
htop
$ prt-get dsearch htop
htop
$ prt-get fsearch htop
Found in /usr/ports/opt/bash-completion:
/usr/share/bash-completion/completions/htop
Found in /usr/ports/opt/htop:
/usr/bin/htop
Package Show Info
$ prt-get info htop
Name: htop
Path: /usr/ports/opt
Version: 1.0.3
Release: 1
Description: an interactive process viewer
URL: http://hisham.hm/htop
Packager: Simone Rota, sip at crux dot nu
Maintainer: Thomas Penteker, tek at serverop dot de
Dependencies: ncurses
List Files
Listing files in particular package.
$ pkginfo -l wget
Or
$ pkginfo --list wget
etc/
etc/wgetrc
usr/
usr/bin/
usr/bin/wget
usr/man/
usr/man/man1/
usr/man/man1/wget.1.gz
There is this file owner command.
$ pkginfo -o /etc/wgetrc
$ pkginfo --owner /etc/wgetrc
Package File
wget etc/wgetrc
System Wide
System wide information.
Installed Packages
$ pkginfo -i
Equal to:
$ pkginfo --installed
acl 2.2.52-1
attr 2.4.47-1
autoconf 2.69-1
automake 1.15-1
bash 4.3.42-1
...
wget 1.17-1
which 2.21-1
xz 5.2.2-1
zip 3.0-1
zlib 1.2.8-1
Dependency
There are two main topics in dependency, dependency itself, and reverse dependency. Beside these two, there are other topic as well, such as managing conflict that we do not cover here.
Help
Ports has a very nice help that show all dependency related options.
$ prt-get help | less
...
DEPENDENCIES
depends <port1 port2...> show dependencies for these ports
quickdep <port1 port2...> same as 'depends' but simple format
deptree <port> show dependencies tree for <port>
dependent [opt] <port> show installed packages which depend on 'port'
...
Dependency
Package that required by: such as man-db need libpipeline and other.
This dependency information can be achieved by
depends
or deptree
command.
This will show required parts of the package.
$ prt-get depends man-db
-- dependencies ([i] = installed)
[i] zlib
[i] gdbm
[i] libpipeline
[i] man-db
Most people love tree
$ prt-get deptree man-db
-- dependencies ([i] = installed, '-->' = seen before)
[i] man-db
[i] zlib
[i] gdbm
[i] libpipeline
Reverse Dependency
Package that require: such as libpipeline needed by man-db or other.
This reverse dependency require dependent
command.
$ prt-get dependent libpipeline
man-db
Test
Removing libpipeline
would not remove man-db
.
libpipeline
would be removed without prior warning.
Therefore be careful while remove.
$ prt-get remove libpipeline
-- Packages removed
libpipeline
$ man man
man: error while loading shared libraries: libpipeline.so.1:
cannot open shared object file: No such file or directory
Ports Difference
You check the ports difference.
$ ports -d
Collection Name Port Installed
core openssl 1.0.2g-1 1.0.2d-1
$ prt-get diff
Differences between installed packages and ports tree:
Port Installed Available in the ports tree
openssl 1.0.2d-1 1.0.2g-1
bash-4.3#
Group
I cannot find any reference about group in Crux’s Ports. I guess there is no group concept.
The Log File
This is most the forgotten part of package management, although it is not uncommon to notice messages. For that reason, I put the recorded event here, before discussing about any further feature.
Log options in Crux is disabled as default.
You have to enable it manually by editing prt-get.conf
$ vim /etc/prt-get.conf
writelog enabled # (enabled|disabled)
logfile /var/log/pkgbuild/%n.log
This is the nano log after nano installation.
$ less /var/log/pkgbuild/nano.log
=======> Building '/usr/ports/opt/nano/nano#2.4.3-1.pkg.tar.gz' succeeded.
prt-get: Using PKGMK_PACKAGE_DIR: /usr/ports/opt/nano
prt-get: installing nano 2.4.3-1
prt-get: /usr/bin/pkgadd nano#2.4.3-1.pkg.tar.gz
prt-get: build done Thu Aug 24 10:20:01 2017
Most likely you want the tail, latest transaction, at the bottom of the recorded event.
Reading
Clean Up
Time after time, your cache size may growing bigger and bigger.
Package Cache
- /usr/ports/core/ * / * .pkg.tar.gz
$ ls -lR /usr/ports/core/man-db/
Unfortunately, I haven’t find any reference, on how to clean up this port directory.
Hold Package
Hold in prt-get is pretty straightforward. Ports can hold package using lock mechanism. This is just a terminology.
Consider a system upgrade,
we choose to hold openssl as our guinea pig example.
We can see that sysup
will have different result.
$ prt-get sysup
prt-get: updating /usr/ports/core/openssl
$ prt-get lock openssl
$ prt-get sysup
System is up to date
$ prt-get listlocked
openssl
$ prt-get unlock openssl
$ prt-get sysup
prt-get: updating /usr/ports/core/openssl
=======> Building '/usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz'.
bsdtar -p -o -C /usr/ports/core/openssl/work/src -xf /usr/ports/core/openssl/openssl-1.0.2g.tar.gz
cp mksslcert.sh /usr/ports/core/openssl/work/src
Issues with Unmaintained Docker Container
pkgadd
Sometimes prt-get
does not work, as you can see below.
We have to face openssl
install issue.
$ prt-get update openssl
...
=======> ERROR: Building '/usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz' failed.
-- Packages where update failed
openssl
I was lucky, the package is there in openssl
directory.
Therefore I can install using lower level pkg
command directly.
$ ls /usr/ports/core/openssl/
Pkgfile openssl#1.0.2g-1.pkg.tar.gz
mksslcert.sh openssl-1.0.2g.tar.gz
$ pkgadd -u /usr/ports/core/openssl/openssl#1.0.2g-1.pkg.tar.gz
$ prt-get diff
No differences found
Dependency Build
$ prt-get install mc
...
configure: WARNING: 'Check' utility not found. Check your environment
checking for GLIB... no
configure: error: glib-2.0 not found or version too old (must be >= 2.26)
=======> ERROR: Building '/usr/ports/opt/mc/mc#4.8.15-1.pkg.tar.gz' failed.
-- Packages where install failed
mc
$ prt-get search glib
dbus-glib
glib
glibc
glibc-32
poppler-glib
taglib
It turned out that glibc
version is
2.19
, which is less than 2.26
.
$ prt-get info glibc
Name: glibc
Path: /usr/ports/core
Version: 2.19
Release: 5
Description: The C library used in the GNU system
URL: http://www.gnu.org/software/libc/
Maintainer: CRUX System Team, core-ports at crux dot nu
Files: post-install
Unfortunately, update command, not uprading the glibc
version.
$ prt-get update glibc
prt-get: updating /usr/ports/core/glibc
=======> Package '/usr/ports/core/glibc/glibc#2.19-5.pkg.tar.gz' is up to date.
prt-get: reinstalling glibc 2.19-5
pkgadd: rejecting etc/ld.so.cache, keeping existing version
pkgadd: rejecting etc/resolv.conf, keeping existing version
pkgadd: rejecting etc/hosts, keeping existing version
-- Packages updated
glibc
prt-get: updated successfully
Distribution Upgrade
Distribution upgrade from 3.1
to 3.2
can be done using live DVD.
But cannot be done directly due to ncurse break.
Distribution upgrade from 3.2
to 3.3
also can be done using live DVD.
Since we are using Docker, it can’t be done with external boot.
I should stay with 3.1 instead
Conclusion
There are things unsolved
Thank you for reading