SlideShare a Scribd company logo
1 of 36
Download to read offline
FreeBSD package management system
Vsevolod Stakhov
vsevolod@FreeBSD.org
BSDCan May 17, 2014
What is pkg
Pkg (previously pkgng) is the binary package management
system written for FreeBSD.
Binary packages management
Replaces old pkg_* tools
Uses central sqlite3 based storage
Provides the comprehensive toolset for binary packages
management
Vsevolod Stakhov vsevolod@FreeBSD.org 2 of 26
Pkg development goals
The main goal of pkg is to simplify system management tasks.
Easy install, remove and upgrade of binary packages
Integration with the ports
Automatic resolving of dependencies and conflicts
Provide secure package management tool
Encourage users to install software from binary packages
Vsevolod Stakhov vsevolod@FreeBSD.org 3 of 26
Pkg development goals
The main goal of pkg is to simplify system management tasks.
Easy install, remove and upgrade of binary packages
Integration with the ports
Automatic resolving of dependencies and conflicts
Provide secure package management tool
Encourage users to install software from binary packages
. . . but do not prevent users from building custom
packages using the ports
Vsevolod Stakhov vsevolod@FreeBSD.org 3 of 26
Planned ports and pkg interaction
Build STAGE Packages Pkg Instal
Build Depends
Run Depends
Vsevolod Stakhov vsevolod@FreeBSD.org 4 of 26
What is new in pkg 1.3
New solver that can automatically resolve complex
upgrade or install scenarios
Vsevolod Stakhov vsevolod@FreeBSD.org 5 of 26
What is new in pkg 1.3
New solver that can automatically resolve complex
upgrade or install scenarios
Improved security by sandboxing untrusted operations:
Pkg environment Sandbox
Unsafe operation
Result
Sandboxing:
archives extracting
vulnxml parsing
repositories signatures checking and public keys
extracting
Vsevolod Stakhov vsevolod@FreeBSD.org 5 of 26
What is new in pkg 1.3
New solver that can automatically resolve complex
upgrade or install scenarios
Improved security by sandboxing untrusted operations:
Pkg environment Sandbox
Unsafe operation
Result
Sandboxing:
archives extracting
vulnxml parsing
repositories signatures checking and public keys
extracting
Concurrent locking system
Vsevolod Stakhov vsevolod@FreeBSD.org 5 of 26
Pkg architecture
Mirrors Jobs
fetch
Solver
Checksum
+ Manifest
Files...
Package Install
FS
PkgDB
User
Request
Remote
Repos
Vsevolod Stakhov vsevolod@FreeBSD.org 6 of 26
The problems of the old solver in pkg
Absence of conflicts resolving
No alternatives support (plain dependencies only)
Can perform merely a single task: either install or
upgrade or remove
Vsevolod Stakhov vsevolod@FreeBSD.org 7 of 26
Tasks to solve
Ports renaming:
simple: racket-textual → racket-minimal
splitting/merging:
A
A B C A B C
A
Ports reorganising:
files moving
dependencies change
adding or removing new conflicts
Vsevolod Stakhov vsevolod@FreeBSD.org 8 of 26
Tasks to solve
There are another issues to be resolved:
Find conflicts using files list
Set jobs priorities using the following rules:
install dependencies first
check for reverse dependencies and increase priority
deal with conflicts using the same priority
packages removing reverses the priority order
Vsevolod Stakhov vsevolod@FreeBSD.org 9 of 26
Existing systems
There are many examples of solvers used in different package
management systems, for example:
Zypper/SUSE - uses libsolv as the base
Yum/RedHat - migrating to libsolv
OpenBSD/pkg_add - uses internal solver
Apt/Debian - uses internal solver
Pacman/Archlinux - uses internal solver
Vsevolod Stakhov vsevolod@FreeBSD.org 10 of 26
External solvers
To interact with an external solver we have chosen the CUDF
format used in the Mancoosi research project
http://mancoosi.org:
package: devel/libblah
version: 1
depends: x11/libfoo
package: security/blah
version: 2
depends: devel/libblah
conflicts: security/blah-devel
Vsevolod Stakhov vsevolod@FreeBSD.org 11 of 26
Interaction with external solver
There are some limitations and incompatibilities with CUDF.
CUDF supports plain integers as versions and we need to
convert versions twice
There is no support of options in CUDF packages formulas
External solvers are often too complicated and large
CUDF transformation is expensive in terms of
performance
Vsevolod Stakhov vsevolod@FreeBSD.org 12 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?
Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?
Use some existing solution?
Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?
Use some existing solution?
Use some known algorithm?
Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
We need an internal solver!
Alternatives:
Write own logic of dependencies and conflicts resolution?
Use some existing solution?
Use some known algorithm?
Use SAT solver for packages management
SAT expression
(x1 ¬x2 x3)
Clause
&(x3 ¬x1)&(x2)
Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
Packages universe
We convert all packages involved to a packages universe of
the following structure:
Name
Version
Conflicts Chain
Depend
Conflict
N1 N2 N3 Nn
V1 V1 V1 V1
V2 V2 V2
V3
Vsevolod Stakhov vsevolod@FreeBSD.org 14 of 26
Making a SAT problem
Assign a variable to each package: package A → a1,
package B → b1
Interpret a request as a set of unary clauses:
Install/Upgrade package A → (a1)
Delete package B → (¬b1)
Convert dependencies and conflicts to disjuncted clauses
Vsevolod Stakhov vsevolod@FreeBSD.org 15 of 26
Converting dependencies and conflicts
If package A depends on package B (versions B1 and B2),
then we can either have package A not installed or any of
B installed:
(¬A B1 B2)
Vsevolod Stakhov vsevolod@FreeBSD.org 16 of 26
Converting dependencies and conflicts
If package A depends on package B (versions B1 and B2),
then we can either have package A not installed or any of
B installed:
(¬A B1 B2)
If we have a conflict between versions of B (B1, B2 and B3)
then we ensure that merely one version is installed:
(¬B1 ¬B2)&(¬B1 ¬B3)&(¬B2 ¬B3)
Conflicts chain
Vsevolod Stakhov vsevolod@FreeBSD.org 16 of 26
The solving of SAT problem
Some rules to follow to speed up SAT problem solving.
Trivial propagation - solve unary clauses
Unit propagation - solve clauses with only a single
unsolved variable
DPLL algorithm backtracking.
Package specific assumptions.
Vsevolod Stakhov vsevolod@FreeBSD.org 17 of 26
SAT problem propagation
Trivial propagation - direct install or delete rules
(¬A B)& (A)
true
& (¬C)
false
&(¬A ¬D)
Vsevolod Stakhov vsevolod@FreeBSD.org 18 of 26
SAT problem propagation
Trivial propagation - direct install or delete rules
(¬A B)& (A)
true
& (¬C)
false
&(¬A ¬D)
Unit propagation - simple depends and conflicts
Dependency
(¬A B)
B→true
&
true
(A) &
false
(¬C) &
Conflict
(¬A ¬D)
D→false
Vsevolod Stakhov vsevolod@FreeBSD.org 18 of 26
DPLL algorithm
DPLL is proved to be one of the efficient algorithms to solve
SAT problem (not the fastest but more simple than
alternatives).
x1
x2
x3
1
0
1
Vsevolod Stakhov vsevolod@FreeBSD.org 19 of 26
DPLL algorithm
DPLL is proved to be one of the efficient algorithms to solve
SAT problem (not the fastest but more simple than
alternatives).
x1
x2
x3
1
0
1
0
Vsevolod Stakhov vsevolod@FreeBSD.org 19 of 26
DPLL algorithm
DPLL is proved to be one of the efficient algorithms to solve
SAT problem (not the fastest but more simple than
alternatives).
x1
x2
x3
1
0
1
0
1
0 0
1
Vsevolod Stakhov vsevolod@FreeBSD.org 19 of 26
Package specific assumptions
Pure SAT solvers cannot deal with package management as
they do not consider several packages peculiarities:
try to keep installed packages (if no direct conflicts)
do not install packages if they are not needed (but try to
upgrade if a user has requested upgrade)
These options also improve SAT performance providing a
good initial assignment.
Vsevolod Stakhov vsevolod@FreeBSD.org 20 of 26
Solvers and Pkg
Pkg may pass the formed universe to an external CUDF
solver:
convert versions
format request
parse output
Alternatively the internal SAT solver may be used:
convert the universe to SAT problem
formulate request
???
PROFIT
Vsevolod Stakhov vsevolod@FreeBSD.org 21 of 26
Perspectives
Using pkg solver for ports management
Better support of multiple repositories
Test different solvers algorithms using CUDF
New dependencies and conflicts format
Provides and alternatives
Vsevolod Stakhov vsevolod@FreeBSD.org 22 of 26
New dependencies format
libblah >= 1.0 + option1, +option2 libfoo! = 1.1
Can depend on normal packages and virtual
packages (provides)
Easy to define the concrete dependency versions
Alternative dependencies
P1
Depends
P2 Vx
> Vy Vz !
P3
Or
Conflict
Vsevolod Stakhov vsevolod@FreeBSD.org 23 of 26
Alternatives
Used to organize packages with the same functionality
(e.g. web-browser)
May be used to implement virtual dependencies
(provides/requires)
Alternatives
Text Editor
Depends
Package
Vsevolod Stakhov vsevolod@FreeBSD.org 24 of 26
Existing issues to be solved prior to 1.3
A solver cannot find install candidates for non-automatic
top level packages (those without reverse depends)
Package upgrade is performed improperly (need to
rename, install and unlink)
Minor issues and crashes
Vsevolod Stakhov vsevolod@FreeBSD.org 25 of 26
Questions?
vsevolod@FreeBSD.org
Vsevolod Stakhov vsevolod@FreeBSD.org 26 of 26

More Related Content

Viewers also liked

Cryptography and secure systems
Cryptography and secure systemsCryptography and secure systems
Cryptography and secure systemsVsevolod Stakhov
 
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...StarWind Software
 
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...Circling Cycle
 

Viewers also liked (8)

Cryptography and secure systems
Cryptography and secure systemsCryptography and secure systems
Cryptography and secure systems
 
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
Log-Structured File System (LSFS) as a weapon to fight “I/O Blender” virtuali...
 
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
Brief summary-standard-password-hashes-Aix-FreeBSD-Linux-Solaris-HP-UX-May-20...
 
Rspamd testing
Rspamd testingRspamd testing
Rspamd testing
 
ast-rspamd
ast-rspamdast-rspamd
ast-rspamd
 
rspamd-slides
rspamd-slidesrspamd-slides
rspamd-slides
 
rspamd-hyperscan
rspamd-hyperscanrspamd-hyperscan
rspamd-hyperscan
 
rspamd-fosdem
rspamd-fosdemrspamd-fosdem
rspamd-fosdem
 

Similar to FreeBSD pkg management system SAT solver

Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Nils Adermann
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemGilad Garon
 
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovLukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovZabbix
 
LinuxLabs 2017 talk: Container monitoring challenges
LinuxLabs 2017 talk: Container monitoring challengesLinuxLabs 2017 talk: Container monitoring challenges
LinuxLabs 2017 talk: Container monitoring challengesXavier Vello
 
Ada in Fedora linux
Ada in Fedora linuxAda in Fedora linux
Ada in Fedora linuxPavel Zhukov
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2 Adil Khan
 
What's new in FreeBSD 10
What's new in FreeBSD 10What's new in FreeBSD 10
What's new in FreeBSD 10Gleb Smirnoff
 
You're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareYou're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareCylance
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of featuresvidyamittal
 
PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...
PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...
PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...Michael Herzog
 
DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldSchalk Cronjé
 
Ten years analysing large code bases: a perspective
Ten years analysing large code bases: a perspectiveTen years analysing large code bases: a perspective
Ten years analysing large code bases: a perspectiveRoberto Di Cosmo
 
Debian Packaging tutorial
Debian Packaging tutorialDebian Packaging tutorial
Debian Packaging tutorialnussbauml
 
Erp 2.50 openbravo environment installation openbravo-wiki
Erp 2.50 openbravo environment installation   openbravo-wikiErp 2.50 openbravo environment installation   openbravo-wiki
Erp 2.50 openbravo environment installation openbravo-wikiyaranusa
 

Similar to FreeBSD pkg management system SAT solver (20)

Composer
ComposerComposer
Composer
 
Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)Composer (PHP Usergroup Karlsruhe)
Composer (PHP Usergroup Karlsruhe)
 
JavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control systemJavaEdge 2008: Your next version control system
JavaEdge 2008: Your next version control system
 
Go 1.8 Release Party
Go 1.8 Release PartyGo 1.8 Release Party
Go 1.8 Release Party
 
tools.ppt
tools.ppttools.ppt
tools.ppt
 
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with UciprovLukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
Lukas Macura - Employing Zabbix to monitor OpenWrt (Beesip) devices with Uciprov
 
LinuxLabs 2017 talk: Container monitoring challenges
LinuxLabs 2017 talk: Container monitoring challengesLinuxLabs 2017 talk: Container monitoring challenges
LinuxLabs 2017 talk: Container monitoring challenges
 
Ada in Fedora linux
Ada in Fedora linuxAda in Fedora linux
Ada in Fedora linux
 
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2   Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
Recipe to build open splice dds 6.3.xxx Hello World example over Qt 5.2
 
What's new in FreeBSD 10
What's new in FreeBSD 10What's new in FreeBSD 10
What's new in FreeBSD 10
 
You're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security SoftwareYou're Off the Hook: Blinding Security Software
You're Off the Hook: Blinding Security Software
 
Core Java- An advanced review of features
Core Java- An advanced review of featuresCore Java- An advanced review of features
Core Java- An advanced review of features
 
Native Hadoop with prebuilt spark
Native Hadoop with prebuilt sparkNative Hadoop with prebuilt spark
Native Hadoop with prebuilt spark
 
PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...
PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...
PURL and vers: The Mostly Universal Package URL and Version Ranges Identifier...
 
DocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM WorldDocuOps & Asciidoctor in a JVM World
DocuOps & Asciidoctor in a JVM World
 
What's New in Java 9
What's New in Java 9What's New in Java 9
What's New in Java 9
 
Ten years analysing large code bases: a perspective
Ten years analysing large code bases: a perspectiveTen years analysing large code bases: a perspective
Ten years analysing large code bases: a perspective
 
Debian Packaging tutorial
Debian Packaging tutorialDebian Packaging tutorial
Debian Packaging tutorial
 
Readme
ReadmeReadme
Readme
 
Erp 2.50 openbravo environment installation openbravo-wiki
Erp 2.50 openbravo environment installation   openbravo-wikiErp 2.50 openbravo environment installation   openbravo-wiki
Erp 2.50 openbravo environment installation openbravo-wiki
 

Recently uploaded

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

FreeBSD pkg management system SAT solver

  • 1. FreeBSD package management system Vsevolod Stakhov vsevolod@FreeBSD.org BSDCan May 17, 2014
  • 2. What is pkg Pkg (previously pkgng) is the binary package management system written for FreeBSD. Binary packages management Replaces old pkg_* tools Uses central sqlite3 based storage Provides the comprehensive toolset for binary packages management Vsevolod Stakhov vsevolod@FreeBSD.org 2 of 26
  • 3. Pkg development goals The main goal of pkg is to simplify system management tasks. Easy install, remove and upgrade of binary packages Integration with the ports Automatic resolving of dependencies and conflicts Provide secure package management tool Encourage users to install software from binary packages Vsevolod Stakhov vsevolod@FreeBSD.org 3 of 26
  • 4. Pkg development goals The main goal of pkg is to simplify system management tasks. Easy install, remove and upgrade of binary packages Integration with the ports Automatic resolving of dependencies and conflicts Provide secure package management tool Encourage users to install software from binary packages . . . but do not prevent users from building custom packages using the ports Vsevolod Stakhov vsevolod@FreeBSD.org 3 of 26
  • 5. Planned ports and pkg interaction Build STAGE Packages Pkg Instal Build Depends Run Depends Vsevolod Stakhov vsevolod@FreeBSD.org 4 of 26
  • 6. What is new in pkg 1.3 New solver that can automatically resolve complex upgrade or install scenarios Vsevolod Stakhov vsevolod@FreeBSD.org 5 of 26
  • 7. What is new in pkg 1.3 New solver that can automatically resolve complex upgrade or install scenarios Improved security by sandboxing untrusted operations: Pkg environment Sandbox Unsafe operation Result Sandboxing: archives extracting vulnxml parsing repositories signatures checking and public keys extracting Vsevolod Stakhov vsevolod@FreeBSD.org 5 of 26
  • 8. What is new in pkg 1.3 New solver that can automatically resolve complex upgrade or install scenarios Improved security by sandboxing untrusted operations: Pkg environment Sandbox Unsafe operation Result Sandboxing: archives extracting vulnxml parsing repositories signatures checking and public keys extracting Concurrent locking system Vsevolod Stakhov vsevolod@FreeBSD.org 5 of 26
  • 9. Pkg architecture Mirrors Jobs fetch Solver Checksum + Manifest Files... Package Install FS PkgDB User Request Remote Repos Vsevolod Stakhov vsevolod@FreeBSD.org 6 of 26
  • 10. The problems of the old solver in pkg Absence of conflicts resolving No alternatives support (plain dependencies only) Can perform merely a single task: either install or upgrade or remove Vsevolod Stakhov vsevolod@FreeBSD.org 7 of 26
  • 11. Tasks to solve Ports renaming: simple: racket-textual → racket-minimal splitting/merging: A A B C A B C A Ports reorganising: files moving dependencies change adding or removing new conflicts Vsevolod Stakhov vsevolod@FreeBSD.org 8 of 26
  • 12. Tasks to solve There are another issues to be resolved: Find conflicts using files list Set jobs priorities using the following rules: install dependencies first check for reverse dependencies and increase priority deal with conflicts using the same priority packages removing reverses the priority order Vsevolod Stakhov vsevolod@FreeBSD.org 9 of 26
  • 13. Existing systems There are many examples of solvers used in different package management systems, for example: Zypper/SUSE - uses libsolv as the base Yum/RedHat - migrating to libsolv OpenBSD/pkg_add - uses internal solver Apt/Debian - uses internal solver Pacman/Archlinux - uses internal solver Vsevolod Stakhov vsevolod@FreeBSD.org 10 of 26
  • 14. External solvers To interact with an external solver we have chosen the CUDF format used in the Mancoosi research project http://mancoosi.org: package: devel/libblah version: 1 depends: x11/libfoo package: security/blah version: 2 depends: devel/libblah conflicts: security/blah-devel Vsevolod Stakhov vsevolod@FreeBSD.org 11 of 26
  • 15. Interaction with external solver There are some limitations and incompatibilities with CUDF. CUDF supports plain integers as versions and we need to convert versions twice There is no support of options in CUDF packages formulas External solvers are often too complicated and large CUDF transformation is expensive in terms of performance Vsevolod Stakhov vsevolod@FreeBSD.org 12 of 26
  • 16. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 17. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? Use some existing solution? Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 18. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? Use some existing solution? Use some known algorithm? Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 19. We need an internal solver! Alternatives: Write own logic of dependencies and conflicts resolution? Use some existing solution? Use some known algorithm? Use SAT solver for packages management SAT expression (x1 ¬x2 x3) Clause &(x3 ¬x1)&(x2) Vsevolod Stakhov vsevolod@FreeBSD.org 13 of 26
  • 20. Packages universe We convert all packages involved to a packages universe of the following structure: Name Version Conflicts Chain Depend Conflict N1 N2 N3 Nn V1 V1 V1 V1 V2 V2 V2 V3 Vsevolod Stakhov vsevolod@FreeBSD.org 14 of 26
  • 21. Making a SAT problem Assign a variable to each package: package A → a1, package B → b1 Interpret a request as a set of unary clauses: Install/Upgrade package A → (a1) Delete package B → (¬b1) Convert dependencies and conflicts to disjuncted clauses Vsevolod Stakhov vsevolod@FreeBSD.org 15 of 26
  • 22. Converting dependencies and conflicts If package A depends on package B (versions B1 and B2), then we can either have package A not installed or any of B installed: (¬A B1 B2) Vsevolod Stakhov vsevolod@FreeBSD.org 16 of 26
  • 23. Converting dependencies and conflicts If package A depends on package B (versions B1 and B2), then we can either have package A not installed or any of B installed: (¬A B1 B2) If we have a conflict between versions of B (B1, B2 and B3) then we ensure that merely one version is installed: (¬B1 ¬B2)&(¬B1 ¬B3)&(¬B2 ¬B3) Conflicts chain Vsevolod Stakhov vsevolod@FreeBSD.org 16 of 26
  • 24. The solving of SAT problem Some rules to follow to speed up SAT problem solving. Trivial propagation - solve unary clauses Unit propagation - solve clauses with only a single unsolved variable DPLL algorithm backtracking. Package specific assumptions. Vsevolod Stakhov vsevolod@FreeBSD.org 17 of 26
  • 25. SAT problem propagation Trivial propagation - direct install or delete rules (¬A B)& (A) true & (¬C) false &(¬A ¬D) Vsevolod Stakhov vsevolod@FreeBSD.org 18 of 26
  • 26. SAT problem propagation Trivial propagation - direct install or delete rules (¬A B)& (A) true & (¬C) false &(¬A ¬D) Unit propagation - simple depends and conflicts Dependency (¬A B) B→true & true (A) & false (¬C) & Conflict (¬A ¬D) D→false Vsevolod Stakhov vsevolod@FreeBSD.org 18 of 26
  • 27. DPLL algorithm DPLL is proved to be one of the efficient algorithms to solve SAT problem (not the fastest but more simple than alternatives). x1 x2 x3 1 0 1 Vsevolod Stakhov vsevolod@FreeBSD.org 19 of 26
  • 28. DPLL algorithm DPLL is proved to be one of the efficient algorithms to solve SAT problem (not the fastest but more simple than alternatives). x1 x2 x3 1 0 1 0 Vsevolod Stakhov vsevolod@FreeBSD.org 19 of 26
  • 29. DPLL algorithm DPLL is proved to be one of the efficient algorithms to solve SAT problem (not the fastest but more simple than alternatives). x1 x2 x3 1 0 1 0 1 0 0 1 Vsevolod Stakhov vsevolod@FreeBSD.org 19 of 26
  • 30. Package specific assumptions Pure SAT solvers cannot deal with package management as they do not consider several packages peculiarities: try to keep installed packages (if no direct conflicts) do not install packages if they are not needed (but try to upgrade if a user has requested upgrade) These options also improve SAT performance providing a good initial assignment. Vsevolod Stakhov vsevolod@FreeBSD.org 20 of 26
  • 31. Solvers and Pkg Pkg may pass the formed universe to an external CUDF solver: convert versions format request parse output Alternatively the internal SAT solver may be used: convert the universe to SAT problem formulate request ??? PROFIT Vsevolod Stakhov vsevolod@FreeBSD.org 21 of 26
  • 32. Perspectives Using pkg solver for ports management Better support of multiple repositories Test different solvers algorithms using CUDF New dependencies and conflicts format Provides and alternatives Vsevolod Stakhov vsevolod@FreeBSD.org 22 of 26
  • 33. New dependencies format libblah >= 1.0 + option1, +option2 libfoo! = 1.1 Can depend on normal packages and virtual packages (provides) Easy to define the concrete dependency versions Alternative dependencies P1 Depends P2 Vx > Vy Vz ! P3 Or Conflict Vsevolod Stakhov vsevolod@FreeBSD.org 23 of 26
  • 34. Alternatives Used to organize packages with the same functionality (e.g. web-browser) May be used to implement virtual dependencies (provides/requires) Alternatives Text Editor Depends Package Vsevolod Stakhov vsevolod@FreeBSD.org 24 of 26
  • 35. Existing issues to be solved prior to 1.3 A solver cannot find install candidates for non-automatic top level packages (those without reverse depends) Package upgrade is performed improperly (need to rename, install and unlink) Minor issues and crashes Vsevolod Stakhov vsevolod@FreeBSD.org 25 of 26