-
Notifications
You must be signed in to change notification settings - Fork 700
Photon RPM OStree: 3 Concepts in action
Now that we have a fresh installed host (either as default or custom), I can explain better the OStree concepts and see them in action.
###3.1 Querying the deployed filetrees
The first thing to do is to run a command that tells us what is installed on the machine and when. Since it's a fresh install from the CD, there is only one bootable filetree image deployed.
root@photon-host-def [ ~ ]# rpm-ostree status
TIMESTAMP (UTC) VERSION ID OSNAME REFSPEC
* 2015-08-20 22:27:43 1.0_tp2_minimal 2940e10c4d photon photon:photon/tp2/x86_64/minimal
###3.2 Bootable filetree version 1.0_tp2_minimal is not the Linux Photon OS release version, nor daily build, but rather a human readable, self-incrementing version associated with every commit that brings file/package updates. Think of this as version 0. The following versions are going to be 1.0_tp2_minimal.1, 1.0_tp2_minimal.2, 1.0_tp2_minimal.3 and so on.
###3.3 Commit ID The ID listed is actually the first 5 bytes of the commit hash. If you want to see the entire 32 bytes hex number, just add the 'pretty' formatting option. The .0 at the end means that this is the default bootable deployment. This will change to 1 when another deployment will take its place as the default.
root@photon-host-def [ ~ ]# rpm-ostree status -p
============================================================
* DEFAULT ON BOOT
----------------------------------------
version 1.0_tp2_minimal
timestamp 2015-08-20 22:27:43
id 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0
osname photon
refspec photon:photon/tp2/x86_64/minimal
============================================================
The OS Name identifies the operating system installed. All bootable filetrees for the same OS will share the /var directory, in other words applications installed in one booted image into this directory will be available in all other images.
If a new set of images are created for a different OS, they will receive a fresh copy of /var that is not shared with the previous OS images. In other words, if a machine is dual boot for different operating systems, they will not share each other's /var content, however they will still merge 3-way /etc.
The Refspec is a branch inside the repo, expressed in a hierarchical way. In this case, it's the default branch that will receive package updates for the Photon OS 1.0 TP2 Minimal installation profile on Intel platforms. There could be other branches in the future, for example photon/tp2/x86_64/full that will match the Full installation profile (full set of packages installed).
Think of Refspec as the head of the minimal branch (just like in git) at the origin repo. On the replicated, local repo at the host, minimal is a file that contains the latest commit ID known for that branch.
root@photon-host-def [ ~ ]# cat /ostree/repo/refs/remotes/photon/
photon/tp2/x86_64/minimal
2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
The photon: prefix in the Refspec listed by rpm-ostree status corresponds to the first photon directory in the local remotes path and is actually the name given to the remote that the host is connected to, which points to an http or https URL. We'll talk about remotes later, but for now think of it as a namespace qualifier. The second photon is part of the Refspec path itself.
We've used so far rpm-ostree. The same information can be obtained running an ostree command:
root@photon-host-def [ ~ ]# ostree admin status
* photon 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0
Version: 1.0_tp2_minimal
origin refspec: photon:photon/tp2/x86_64/minimal
But where is this information stored? As you may have guessed, the local repo stores the heads of the deployed trees - the most recent commitment ID, just like Git does:
root@photon-host-def [ ~ ]# cat /ostree/repo/refs/heads/ostree/0/1/0
2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
This also where this command that lists the references (local heads and remotes) takes its data:
root@photon-host-def [ ~ ]# ostree refs
ostree/0/1/0
photon:photon/tp2/x86_64/minimal
Based on that, it could find the root of the deployment that it boots from. The actual filetree is deployed right here:
root@photon-host-def [ ~ ]# ls -l /ostree/deploy/photon/deploy/2940e10c4d
90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0
total 36
lrwxrwxrwx 1 root root 7 Aug 28 20:21 bin -> usr/bin
drwxr-xr-x 4 root root 4096 Jan 1 1970 boot
drwxr-xr-x 2 root root 4096 Jan 1 1970 dev
drwxr-xr-x 34 root root 4096 Aug 28 20:28 etc
lrwxrwxrwx 1 root root 8 Aug 28 20:21 home -> var/home
lrwxrwxrwx 1 root root 7 Aug 28 20:21 lib -> usr/lib
lrwxrwxrwx 1 root root 7 Aug 28 20:21 lib64 -> usr/lib
lrwxrwxrwx 1 root root 9 Aug 28 20:21 media -> run/media
lrwxrwxrwx 1 root root 7 Aug 28 20:21 mnt -> var/mnt
lrwxrwxrwx 1 root root 7 Aug 28 20:21 opt -> var/opt
lrwxrwxrwx 1 root root 14 Aug 28 20:21 ostree -> sysroot/ostree
drwxr-xr-x 2 root root 4096 Jan 1 1970 proc
lrwxrwxrwx 1 root root 12 Aug 28 20:21 root -> var/roothome
drwxr-xr-x 2 root root 4096 Jan 1 1970 run
lrwxrwxrwx 1 root root 8 Aug 28 20:21 sbin -> usr/sbin
lrwxrwxrwx 1 root root 7 Aug 28 20:21 srv -> var/srv
drwxr-xr-x 2 root root 4096 Jan 1 1970 sys
drwxr-xr-x 2 root root 4096 Jan 1 1970 sysroot
lrwxrwxrwx 1 root root 11 Aug 28 20:21 tmp -> sysroot/tmp
drwxr-xr-x 10 root root 4096 Jan 1 1970 usr
drwxr-xr-x 7 root root 4096 Aug 28 20:21 var
So how is a deployment linked to a specific branch, originating from a remote repo? Well, there is a file next to the deployed filetree root directory with the same name and .origin suffix, that contains exactly this info:
root@photon-host-def [ ~ ]# cat /ostree/deploy/photon/deploy/2940e10c4d
90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0.origin
[origin]
refspec=photon:photon/tp2/x86_64/minimal
Fast forwarding a bit, if there is a new deployment due to an upgrade or rebase, this new filetree will be added:
(todo: add content)
The photon directory in the path is the actual OSname. Multiple deployments of same OS will share a writable /var folder.
root@photon-host-def [ ~ ]# ls -l /ostree/deploy/photon/var
total 52
drwxr-xr-x 5 root root 4096 Aug 28 20:28 cache
drwxr-xr-x 2 root root 4096 Aug 28 20:28 home
drwxr-xr-x 12 root root 4096 Aug 28 20:28 lib
drwxr-xr-x 2 root root 4096 Aug 28 20:28 local
lrwxrwxrwx 1 root root 11 Aug 28 20:21 lock -> ../run/lock
drwxr-xr-x 2 root root 4096 Aug 28 20:28 log
drwxr-xr-x 2 root root 4096 Aug 28 20:28 mail
drwxr-xr-x 2 root root 4096 Aug 28 20:28 mnt
drwxr-xr-x 2 root root 4096 Aug 28 20:28 opt
drwx------ 2 root root 4096 Aug 29 18:16 roothome
lrwxrwxrwx 1 root root 6 Aug 28 20:21 run -> ../run
drwxr-xr-x 2 root root 4096 Aug 28 20:28 spool
drwxr-xr-x 2 root root 4096 Aug 28 20:28 srv
drwxrwxrwt 2 root root 4096 Aug 28 20:21 tmp
drwxr-xr-x 11 root root 4096 Aug 28 20:28 usrlocal
To diff the current /etc configuration versus default /etc, this command will show the Modified, Added and Deleted files:
root@photon-host-def [ ~ ]# ostree admin config-diff
M mtab
M ssh/sshd_config
M fstab
M hosts
M shadow
A ssh/ssh_host_key
A ssh/ssh_host_key.pub
A ssh/ssh_host_rsa_key
A ssh/ssh_host_rsa_key.pub
A ssh/ssh_host_dsa_key
A ssh/ssh_host_dsa_key.pub
A ssh/ssh_host_ecdsa_key
A ssh/ssh_host_ecdsa_key.pub
A ssh/ssh_host_ed25519_key
A ssh/ssh_host_ed25519_key.pub
A ssh/sshd.pid
A udev/hwdb.bin
A resolv.conf
A hostname
A localtime
A .updated
- Home
- Download Photon OS
- User Documentation
- FAQ
- Security Advisories
- Related Information