Maintain the NetBSD Base
System Using pkg_* Tools
Yuuki Enomoto
Ken’ichi Fukamachi
Chitose Institute of Science and Technology

Abstract• This presentation explains “basepkg.sh”.
• Fine granular system can be easily updated and customized.
• “syspkg” consisting a lot of Makefiles and shell script.
• We have developed a script simpler than syspkg framework.

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. Conclusion

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. Conclusion

Background 1/3• In Unix, it is important to keep it up to date
for security.
• Usually, we use “Package Manager”
for up-to-date system.
Ex. pkgsrc, ports, apt, yum, ...
• Third-party softwares can be updated
using package manager.

Background 2/3• But, how do we keep
the base system
up-to-date?
• This picture shows
NetBSD-7.0.2 amd64
base binaries.

Background 3/3• This picture showspart of
NetBSD base.tgz.
• It is an example ofthe base system.
• How do we manage
these files?

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. Conclusion

Case Study -- Debian GNU/Linux 1/2• Debian is an example of base system management.
• Debian manages the base system and third-party software
as a package.
• Debian package’s document can be viewed from the web.

Case Study -- Debian GNU/Linux 2/2

Case Study – FreeBSD 1/3• FreeBSD has “PkgBase” since FreeBSD-11.0.
• This mechanism can manage the base system using “pkg”.
• outstanding issues are remaining.
– # pkg delete -aCase Study – FreeBSD 2/3/usr
FreeBSD PkgBase
Initial Setup
src

obj
...

user

$ make buildworld$ make buildkernel$ make package

latestFreeBSD-acct-11.0_1.txz
FreeBSD-acpi-11.0_1.txz…

packagesite.txz

Case Study – FreeBSD 3/3
Remote Repo
pkg
user
PkgBase Repo

Case Study – OpenBSD 1/2• OpenBSD can’t manage the base system yet.
• But, OpenBSD’s package management mechanism
serves as a useful reference.
• OpenBSD provides Perl modules.
pkg_* tools developed by the modules.

Case Study – OpenBSD 2/2• OpenBSD’s
pkg_add and
pkg_deletecommand scriptedby the same
Perl code.
• Command jobs
judged by thecommand name.

pkg_add
pkg_deleteuserpkg_info
pkg_create…

OpenBSD
PerlModules

anyworks

In NetBSD…
• The mechanism called “syspkg” like PkgBase.
• The syspkg’s process included in the build.sh.
• $ build.sh syspkgs• But syspkg project is not achieved.

syspkg 1/2• syspkg creates many packages of the base system.
• NetBSD wiki(wiki.netbsd.org) says
“There has been a lot of work in this area already,but it has not yet been finalized.”-- http://wiki.netbsd.org/projects/project/syspkgs/

syspkg 2/2• syspkg consisting of a lot ofMakefiles and shell scripts.
– src/distrib/syspkg (Makefile – bsd.syspkg.mk)– src/distrib/sets (database and shellscript)• syspkg mechanism is difficult for the above reason.
• We thought We could develop
another base system packaging system
simpler than syspkg.

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. ConclusionOur Goals• Develop a base system packaging program
simpler than syspkg for NetBSD.
• Clarify the problems of base system packaging of NetBSD.
• It is possible to ...
• easy to update.
• granular custom installation more than current installer.

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. ConclusionProposal for another Script• We have developed “basepkg.sh” for packaged NetBSD.
(https://github.com/user340/basepkg)• This script makes packages from NetBSD binaries.
• Packages can be installed to NetBSD (base) system.

About basepkg.sh 1/4• Easy to make a base package.
• Prepare information files, then running pkg_create command.

• NetBSD’s base package use the following files.
• +BUILD_INFO – Information of the environment.
• +COMMENT – Comment of the package.
• +CONTENTS – Information on the path of the file.
• +DESC – Description of the package.

About basepkg.sh 2/4

About basepkg.sh 3/4• The files areclassified.
• basepkg.sh makes
hierarchicaldirectories from“list” file.

About basepkg.sh 4/4

How to install basepkg.sh●Requirements–

NetBSD Source (For src/sys/conf/osrelease.sh)–

NetBSD Binaries tarball (From build.sh)
Or download tarball from NetBSD ftp server, and extract tarballs at basepkg/work

tar zxf base.tgz -C basepkg/work/basetar zxf comp.tgz -C baepkg/work/comp...
–

pkgtools/pkg_install (From pkgsrc)–

devel/git$ git clone git://github.com/user340/basepkg

How to run basepkg.sh$ ./basepkg.sh dir$ ./basepkg.sh list
$ ./basepkg.sh pkg• Packages are placed at basepkg/packages• Use pkg_add to install package

basepkg.sh demonstration
1. Create packages using basepkg.sh
2. Install packages to NetBSD system on QEMU.
3. Reboot, and try to delete the part of base packages.

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. Conclusion

basepkg.sh outstanding issues 1/5• Overwrite files• This picture showsthat /etc/rc.conf isoverwritten by"etc-sys-rc" package• rc_configured=NObasepkg.sh outstanding issues 2/5• This picture
shows that/etc/group and/etc/passwd files
are overwrittenby "etc-sys-sys"
packagebasepkg.sh outstanding issues 3/5• “basepkg.sh” generates 879 (base) packages.
• Is it clear that the granularity is properfor managing system?
• What is criterion of the granularity and classificationof packages?

basepkg.sh outstanding issues 4/5• There are some empty packages named "obsolete".
• For example, "comp-obsolete" package.
• We have to fix the empty packages.

basepkg.sh outstanding issues 5/5• Where is base packages document like as Debian?
• It is desirable to be able to be browse on the web.
• Hard work.

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. Conclusion

Suggestions to Improve of NetBSD Source Tree●In pkgsrc, its functions in the its tree.

●But, syspkg’s functions not in the src/distrib/syspkg.

●

List files which is categorize base system files arelocated at src/distrib/sets/lists.

●

Why pull together syspkg’s functions into one tree?

Index1. Background
2. Case Study
3. Our Goals
4. Proposal Scripts
5. Outstanding Issues
6. Suggestions to Improve NetBSD Source Tree
7. Conclusion

Conclusion• We could manage the NetBSD base system using pkg_*.
• But, outstanding issues are remaining.
• Unexpected overwrite files• Granularity of packages• Empty packages• Documentation• Thank you for listening.