2012-01-15 13:14:40 -05:00
---
2015-04-10 16:17:45 -04:00
layout: doc
2015-10-13 23:31:03 -04:00
title: Qubes Builder
2015-10-28 18:14:40 -04:00
permalink: /doc/qubes-builder/
2015-10-11 03:04:59 -04:00
redirect_from:
2015-10-28 18:14:40 -04:00
- /en/doc/qubes-builder/
2015-10-11 03:04:59 -04:00
- /doc/QubesBuilder/
- /wiki/QubesBuilder/
2012-01-15 13:14:40 -05:00
---
2018-02-15 08:07:52 -05:00
**Note: The build system has been improved since this how-to was last updated. The [ISO building instructions ](/doc/qubes-r3-building/ ) contain more up-to-date information on how to use the build system.**
2017-04-27 13:03:43 -04:00
2012-01-15 13:14:40 -05:00
Building Qubes from scratch
===========================
2015-04-21 08:41:23 -04:00
We have a fully automated build system for Qubes, that downloads, builds and
packages all the Qubes components, and finally should spit out a ready-to-use
installation ISO.
2012-01-15 13:14:40 -05:00
2018-01-01 15:55:25 -05:00
In order to use it, one should use an rpm-based distro, like Fedora :), and should ensure the following packages are installed:
2012-01-15 13:14:40 -05:00
2017-02-04 22:15:44 -05:00
- sudo
2018-11-15 06:50:43 -05:00
- gnupg
2012-01-15 13:14:40 -05:00
- git
- createrepo
- rpm-build
- make
2013-03-04 16:25:37 -05:00
- wget
- rpmdevtools
2018-07-24 21:44:32 -04:00
- python2-sh
2015-08-10 19:49:31 -04:00
- dialog
- rpm-sign
2017-02-04 22:15:44 -05:00
- dpkg-dev
- debootstrap
- PyYAML
2018-10-22 09:17:45 -04:00
- devscripts
2018-09-20 09:17:05 -04:00
- perl-Digest-MD5
- perl-Digest-SHA
2012-01-15 13:14:40 -05:00
2017-06-23 08:33:38 -04:00
Usually one can install those packages by just issuing:
2012-01-15 13:14:40 -05:00
2018-11-15 06:50:43 -05:00
sudo dnf install gnupg git createrepo rpm-build make wget rpmdevtools python2-sh dialog rpm-sign dpkg-dev debootstrap PyYAML devscripts perl-Digest-MD5 perl-Digest-SHA
2012-01-15 13:14:40 -05:00
The build system creates build environments in chroots and so no other packages are needed on the host. All files created by the build system are contained within the qubes-builder directory. The full build requires some 25GB of free space, so keep that in mind when deciding where to place this directory.
2017-06-23 08:33:38 -04:00
The build system is configured via builder.conf file -- one should copy the provided default builder.conf, and modify it as needed, e.g.:
2012-02-06 05:22:41 -05:00
2015-10-07 16:33:16 -04:00
cp example-configs/qubes-os-master.conf builder.conf
# edit the builder.conf file and set the following variables:
NO_SIGN=1
2012-02-06 05:22:41 -05:00
2017-06-23 08:33:38 -04:00
One additional useful requirement is that 'sudo root' must work without any prompt, which is default on most distros (e.g. 'sudo bash' brings you the root shell without asking for any password). This is important as the builder needs to switch to root and then back to user several times during the build process.
2012-01-15 13:14:40 -05:00
2017-06-23 08:33:38 -04:00
Additionally, if building with signing enabled (NO\_SIGN is not set), one must adjust \~/.rpmmacro file so that it points to the GPG key used for package signing, e.g.:
2012-02-06 05:22:41 -05:00
2015-10-07 16:33:16 -04:00
%_signature gpg
%_gpg_path /home/user/.gnupg
%_gpg_name AC1BF9B3 # < -- Key ID used for signing
2012-02-06 05:22:41 -05:00
2017-06-23 08:33:38 -04:00
It is also recommended to use an empty passphrase for the private key used for signing. Contrary to a popular belief, this doesn't affect your key or sources security -- if somebody compromised your system, then the game is over anyway, whether you have used an additional passphrase for the key or not.
2012-02-06 05:22:41 -05:00
2012-01-15 13:14:40 -05:00
So, to build Qubes one would do:
2015-10-07 16:33:16 -04:00
# Import the Qubes master key
2015-10-15 08:01:53 -04:00
gpg --recv-keys 0xDDFA1A3E36879494
2015-10-07 16:33:16 -04:00
# Verify its fingerprint, set as 'trusted'.
# This is described here:
# https://www.qubes-os.org/doc/VerifyingSignatures
2015-10-15 08:01:53 -04:00
wget https://keys.qubes-os.org/keys/qubes-developers-keys.asc
2015-10-07 16:33:16 -04:00
gpg --import qubes-developers-keys.asc
git clone git://github.com/QubesOS/qubes-builder.git qubes-builder
cd qubes-builder
2015-10-15 08:01:53 -04:00
# Verify its integrity:
git tag -v `git describe`
2015-10-07 16:33:16 -04:00
cp example-configs/qubes-os-master.conf builder.conf
# edit the builder.conf file and set the following variables:
# NO_SIGN="1"
# Download all components:
make get-sources
# And now to build all Qubes rpms (this will take a few hours):
make qubes
# ... and then to build the ISO
make iso
2012-01-15 13:14:40 -05:00
And this should produce a shiny new ISO.
You can also build selected component separately. Eg. to compile only gui virtualization agent/daemon:
2015-04-21 08:41:23 -04:00
make gui-daemon
2012-01-15 13:14:40 -05:00
2017-06-23 08:33:38 -04:00
You can get a full list from make help. For advanced use and preparing sources
2015-10-28 18:14:40 -04:00
for use with [QubesBuilder ](/doc/qubes-builder/ ) take a look at [doc directory
2015-04-21 08:41:23 -04:00
in QubesBuilder](https://github.com/marmarek/qubes-builder/tree/master/doc) or
2015-10-28 18:14:40 -04:00
[QubesBuilderDetails ](/doc/qubes-builder-details/ ) page.
2012-08-15 14:37:37 -04:00
Making customized build
-----------------------
2012-08-21 13:09:15 -04:00
### Manual source modification
2012-08-15 14:37:37 -04:00
2012-08-21 13:09:15 -04:00
If you want to somehow modify sources, you can also do it, here are some basic steps:
2012-08-15 14:37:37 -04:00
2015-04-21 08:41:23 -04:00
1. Download qubes-builder as described above (if you want to use marmarek's branches, you should also download qubes-builder from his repo - replace 'QubesOS' with 'marmarek' in above git clone command)
2012-08-15 14:37:37 -04:00
2. Edit builder.conf (still the same as above), some useful additions:
2015-04-21 08:41:23 -04:00
- You can also set GIT\_PREFIX="marmarek/qubes-" to use my repo instead of "mainstream" - it contains newer (but less tested) versions
2012-08-15 14:37:37 -04:00
2015-10-07 16:33:16 -04:00
3. Download unmodified sources
2012-08-15 14:37:37 -04:00
2015-10-07 16:33:16 -04:00
make get-sources
2012-08-15 14:37:37 -04:00
2015-10-07 16:33:16 -04:00
4. **Make your modifications here**
2012-08-15 14:37:37 -04:00
2015-10-07 16:33:16 -04:00
5. Build the Qubes
2015-04-21 08:41:23 -04:00
`make qubes` actually is just meta target which build all required
components in correct order. List of components is configured in
builder.conf. You can also check the current value at the end of `make
help`, or using `make build-info` .
2012-08-15 14:37:37 -04:00
2015-10-07 16:33:16 -04:00
6. `get-sources` is already done, so continue with the next one. You can skip `sign-all` if you've disabled signing
make vmm-xen core-admin linux-kernel gui-daemon template desktop-linux-kde installer-qubes-os manager linux-dom0-updates
2012-08-15 14:37:37 -04:00
1. build iso installation image
2015-10-07 16:33:16 -04:00
make iso
2012-08-22 06:31:11 -04:00
2014-04-30 09:47:25 -04:00
Code verification keys management
2016-12-21 22:33:42 -05:00
---------------------------------
2014-04-30 09:47:25 -04:00
2015-10-28 18:14:40 -04:00
[QubesBuilder ](/doc/qubes-builder/ ) by default verifies signed tags on every downloaded code. Public keys used for that are stored in `keyrings/git` . By default Qubes developers' keys are imported automatically, but if you need some additional keys (for example your own), you can add them using:
2014-04-30 09:47:25 -04:00
2015-10-07 16:33:16 -04:00
GNUPGHOME=$PWD/keyrings/git gpg --import /path/to/key.asc
GNUPGHOME=$PWD/keyrings/git gpg --edit-key ID_OF_JUST_IMPORTED_KEY
# here use "trust" command to set key fully or ultimately trusted - only those keys are accepted by QubesBuilder
2014-04-30 09:47:25 -04:00
2014-05-02 14:37:45 -04:00
All Qubes developers' keys are signed by the Qubes Master Signing Key (which is set as ultimately trusted key), so are trusted automatically.
2014-04-30 09:47:25 -04:00
2014-05-02 14:37:45 -04:00
If you are the owner of Master key and want to revoke such signature, use the `revsig` gpg key edit command and update the key in qubes-developers-keys.asc - now the key will be no longer trusted (unless manually set as such).