Skip to content

Photon RPM OSTree: 5 Host updating operations

Danut Moraru edited this page Sep 17, 2015 · 23 revisions

5.1 Incremental upgrade

To check if there are any updates available, one would execute:

root@photon-host-def [ ~ ]# rpm-ostree upgrade
Updating from: photon:photon/tp2/x86_64/minimal


No upgrade available.

It's good idea to check periodically for updates. Let's assume that Photon OS releases later a version 1 for this branch that contains new packages: gawk, sudo and wget. To check if there are any new updates without actually applying them, we will pass the --check-diff flag, that would list the different packages as added, modified or deleted.

root@photon-host-def [ ~ ]# rpm-ostree upgrade --check-diff
Updating from: photon:photon/tp2/x86_64/minimal


+gawk-4.1.0-2.ph1tp2.x86_64
+sudo-1.8.11p1-4.ph1tp2.x86_64
+wget-1.15-1.ph1tp2.x86_64

We like what we see and now let's upgrade. This command will deploy a new bootable filetree. It's showing 'transferred in 0 seconds' because the actual commit has been downloaded (pulled) in the previous --check-diff command.

root@photon-host-def [ ~ ] rpm-ostree upgrade
Updating from: photon:photon/tp2/x86_64/minimal

110 metadata, 224 content objects fetched; 15285 KiB transferred in 0 seconds
Copying /etc changes: 5 modified, 0 removed, 16 added
[ 4704.138337] device-mapper: uevent: version 1.0.3
[ 4704.139276] device-mapper: ioctl: 4.30.0-ioctl (2014-12-22) initialised: dm-devel@redhat.com
Transaction complete; bootconfig swap: yes deployment count change: 1
Added:
  gawk-4.1.0-2.ph1tp2.x86_64
  sudo-1.8.11p1-4.ph1tp2.x86_64
  wget-1.15-1.ph1tp2.x86_64
Upgrade prepared for next boot; run "systemctl reboot" to start a reboot

We can look at the commit history, notice that the new commit has the original commit as parent.

root@photon-host-def [ ~ ]# ostree log photon/tp2/x86_64/minimal
commit 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817
Date:  2015-09-03 00:34:41 +0000
Version: 1.0_tp2_minimal.1


commit 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
Date:  2015-08-20 22:27:43 +0000
Version: 1.0_tp2_minimal

Notice that now we have a new reference, that corresponds to the newly deployed image.

root@photon-host-def [ ~ ]# ostree refs
ostree/0/1/0
ostree/0/1/1
photon:photon/tp2/x86_64/minimal 

Now let's reboot. Grub will list the new filetree as the first (default), bootable image.

Grub-boot-1-0

Once booted, this will be obvious. The star marks the default bootable image. Let's look again at the status:

root@photon-host-def [ ~ ]# rpm-ostree status
  TIMESTAMP (UTC)       VERSION             ID           OSNAME   REFSPEC                              
* 2015-09-03 00:34:41   1.0_tp2_minimal.1   82bca728ea   photon   photon:photon/tp2/x86_64/minimal     
  2015-08-20 22:27:43   1.0_tp2_minimal     2940e10c4d   photon   photon:photon/tp2/x86_64/minimal     
     

Let's print the current deployment directory:

root@photon-host-def [ ~ ]# ostree admin config-diff --print-current-dir
/ostree/deploy/photon/deploy/82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.0

A fresh upgrade for a new version will delete the older image and bring a new one, that will become the new default image.

5.2 Listing file differences

Now we can look at what files have been Added, Modified, Deleted due to the addition of those three packages and switching of the boot directories, by comparing the two commits.

root@photon-host-def [ ~ ]# ostree diff 2940 82bc
M    /usr/etc/group-
M    /usr/etc/gshadow
M    /usr/etc/passwd-
M    /usr/etc/shadow
M    /usr/share/rpm/Basenames
M    /usr/share/rpm/Conflictname
M    /usr/share/rpm/Dirnames
M    /usr/share/rpm/Group
M    /usr/share/rpm/Installtid
M    /usr/share/rpm/Name
M    /usr/share/rpm/Obsoletename
M    /usr/share/rpm/Packages
M    /usr/share/rpm/Providename
M    /usr/share/rpm/Requirename
M    /usr/share/rpm/Sha1header
M    /usr/share/rpm/Sigmd5
M    /usr/share/rpm/Triggername
M    /usr/share/rpm-ostree/treefile.json
D    /boot/initramfs-4.0.9.img-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
D    /boot/vmlinuz-4.0.9-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
D    /usr/etc/gshadow-
D    /usr/etc/shadow-
D    /usr/lib/ostree-boot/initramfs-4.0.9.img-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
D    /usr/lib/ostree-boot/vmlinuz-4.0.9-49c11628bc4b702fcbf4a01abbb5249ddc845a81570a5616010f38b8967db197
A    /boot/initramfs-4.0.9.img-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
A    /boot/vmlinuz-4.0.9-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
A    /usr/bin/awk
A    /usr/bin/gawk
A    /usr/bin/gawk-4.1.0
A    /usr/bin/igawk
A    /usr/bin/sudo
A    /usr/bin/sudoedit
A    /usr/bin/sudoreplay
A    /usr/bin/wget
A    /usr/etc/pam.d/sudo
A    /usr/etc/group.rpmnew
A    /usr/etc/passwd.rpmnew
A    /usr/etc/sudoers
A    /usr/etc/wgetrc
A    /usr/etc/sudoers.d
A    /usr/include/gawkapi.h
A    /usr/include/sudo_plugin.h
A    /usr/lib/ostree-boot/initramfs-4.0.9.img-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
A    /usr/lib/ostree-boot/vmlinuz-4.0.9-334842d15b642e70fac149bd5bbb7dd48965a3aca9da6a42d289a267a142f32f
A    /usr/lib/gawk
A    /usr/lib/gawk/filefuncs.so
A    /usr/lib/gawk/fnmatch.so
A    /usr/lib/gawk/fork.so
A    /usr/lib/gawk/inplace.so
A    /usr/lib/gawk/ordchr.so
A    /usr/lib/gawk/readdir.so
A    /usr/lib/gawk/readfile.so
A    /usr/lib/gawk/revoutput.so
A    /usr/lib/gawk/revtwoway.so
A    /usr/lib/gawk/rwarray.so
A    /usr/lib/gawk/testext.so
A    /usr/lib/gawk/time.so
A    /usr/lib/sudo
A    /usr/lib/sudo/group_file.so
A    /usr/lib/sudo/libsudo_util.so
A    /usr/lib/sudo/libsudo_util.so.0
A    /usr/lib/sudo/libsudo_util.so.0.0.0
A    /usr/lib/sudo/sudo_noexec.so
A    /usr/lib/sudo/sudoers.so
A    /usr/lib/sudo/system_group.so
A    /usr/libexec/awk
A    /usr/libexec/awk/grcat
A    /usr/libexec/awk/pwcat
A    /usr/sbin/visudo
A    /usr/share/doc/gawk-4.1.0
A    /usr/share/doc/gawk-4.1.0/api-figure1.eps
A    /usr/share/doc/gawk-4.1.0/api-figure1.pdf
A    /usr/share/doc/gawk-4.1.0/api-figure2.eps
A    /usr/share/doc/gawk-4.1.0/api-figure2.pdf
A    /usr/share/doc/gawk-4.1.0/api-figure3.eps
A    /usr/share/doc/gawk-4.1.0/api-figure3.pdf
A    /usr/share/doc/gawk-4.1.0/awkforai.txt
A    /usr/share/doc/gawk-4.1.0/general-program.eps
A    /usr/share/doc/gawk-4.1.0/general-program.pdf
A    /usr/share/doc/gawk-4.1.0/lflashlight.eps
A    /usr/share/doc/gawk-4.1.0/lflashlight.pdf
A    /usr/share/doc/gawk-4.1.0/process-flow.eps
A    /usr/share/doc/gawk-4.1.0/process-flow.pdf
A    /usr/share/doc/gawk-4.1.0/rflashlight.eps
A    /usr/share/doc/gawk-4.1.0/rflashlight.pdf
A    /usr/share/doc/gawk-4.1.0/statist.eps
A    /usr/share/doc/gawk-4.1.0/statist.jpg
A    /usr/share/doc/gawk-4.1.0/statist.pdf
A    /usr/share/doc/sudo-1.8.11p1
A    /usr/share/doc/sudo-1.8.11p1/CONTRIBUTORS
A    /usr/share/doc/sudo-1.8.11p1/ChangeLog
A    /usr/share/doc/sudo-1.8.11p1/HISTORY
A    /usr/share/doc/sudo-1.8.11p1/LICENSE
A    /usr/share/doc/sudo-1.8.11p1/NEWS
A    /usr/share/doc/sudo-1.8.11p1/README
A    /usr/share/doc/sudo-1.8.11p1/TROUBLESHOOTING
A    /usr/share/doc/sudo-1.8.11p1/UPGRADE
A    /usr/share/doc/sudo-1.8.11p1/sample.pam
A    /usr/share/doc/sudo-1.8.11p1/sample.sudo.conf
A    /usr/share/doc/sudo-1.8.11p1/sample.sudoers
A    /usr/share/doc/sudo-1.8.11p1/sample.syslog.conf
A    /usr/share/locale/be/LC_MESSAGES/wget.mo
A    /usr/share/locale/bg/LC_MESSAGES/wget.mo
A    /usr/share/locale/ca/LC_MESSAGES/sudo.mo
A    /usr/share/locale/ca/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/ca/LC_MESSAGES/wget.mo
A    /usr/share/locale/cs/LC_MESSAGES/sudo.mo
A    /usr/share/locale/cs/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/cs/LC_MESSAGES/wget.mo
A    /usr/share/locale/da/LC_MESSAGES/gawk.mo
A    /usr/share/locale/da/LC_MESSAGES/sudo.mo
A    /usr/share/locale/da/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/da/LC_MESSAGES/wget.mo
A    /usr/share/locale/de/LC_MESSAGES/gawk.mo
A    /usr/share/locale/de/LC_MESSAGES/sudo.mo
A    /usr/share/locale/de/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/de/LC_MESSAGES/wget.mo
A    /usr/share/locale/el/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/el/LC_MESSAGES/wget.mo
A    /usr/share/locale/en_GB/LC_MESSAGES/wget.mo
A    /usr/share/locale/eo/LC_MESSAGES/sudo.mo
A    /usr/share/locale/eo/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/eo/LC_MESSAGES/wget.mo
A    /usr/share/locale/es/LC_MESSAGES/gawk.mo
A    /usr/share/locale/es/LC_MESSAGES/sudo.mo
A    /usr/share/locale/es/LC_MESSAGES/wget.mo
A    /usr/share/locale/et/LC_MESSAGES/wget.mo
A    /usr/share/locale/eu/LC_MESSAGES/sudo.mo
A    /usr/share/locale/eu/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/eu/LC_MESSAGES/wget.mo
A    /usr/share/locale/fi/LC_MESSAGES/gawk.mo
A    /usr/share/locale/fi/LC_MESSAGES/sudo.mo
A    /usr/share/locale/fi/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/fi/LC_MESSAGES/wget.mo
A    /usr/share/locale/fr/LC_MESSAGES/gawk.mo
A    /usr/share/locale/fr/LC_MESSAGES/sudo.mo
A    /usr/share/locale/fr/LC_MESSAGES/wget.mo
A    /usr/share/locale/ga/LC_MESSAGES/wget.mo
A    /usr/share/locale/gl/LC_MESSAGES/sudo.mo
A    /usr/share/locale/gl/LC_MESSAGES/wget.mo
A    /usr/share/locale/he/LC_MESSAGES/wget.mo
A    /usr/share/locale/hr/LC_MESSAGES/sudo.mo
A    /usr/share/locale/hr/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/hr/LC_MESSAGES/wget.mo
A    /usr/share/locale/hu/LC_MESSAGES/wget.mo
A    /usr/share/locale/id/LC_MESSAGES/wget.mo
A    /usr/share/locale/it/LC_MESSAGES/gawk.mo
A    /usr/share/locale/it/LC_MESSAGES/sudo.mo
A    /usr/share/locale/it/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/it/LC_MESSAGES/wget.mo
A    /usr/share/locale/ja/LC_MESSAGES/gawk.mo
A    /usr/share/locale/ja/LC_MESSAGES/sudo.mo
A    /usr/share/locale/ja/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/ja/LC_MESSAGES/wget.mo
A    /usr/share/locale/lt/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/lt/LC_MESSAGES/wget.mo
A    /usr/share/locale/ms/LC_MESSAGES/gawk.mo
A    /usr/share/locale/nb/LC_MESSAGES/sudo.mo
A    /usr/share/locale/nb/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/nb/LC_MESSAGES/wget.mo
A    /usr/share/locale/nl/LC_MESSAGES/gawk.mo
A    /usr/share/locale/nl/LC_MESSAGES/sudo.mo
A    /usr/share/locale/nl/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/nl/LC_MESSAGES/wget.mo
A    /usr/share/locale/pl/LC_MESSAGES/gawk.mo
A    /usr/share/locale/pl/LC_MESSAGES/sudo.mo
A    /usr/share/locale/pl/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/pl/LC_MESSAGES/wget.mo
A    /usr/share/locale/pt/LC_MESSAGES/wget.mo
A    /usr/share/locale/pt_BR/LC_MESSAGES/sudo.mo
A    /usr/share/locale/pt_BR/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/pt_BR/LC_MESSAGES/wget.mo
A    /usr/share/locale/ro/LC_MESSAGES/wget.mo
A    /usr/share/locale/ru/LC_MESSAGES/sudo.mo
A    /usr/share/locale/ru/LC_MESSAGES/wget.mo
A    /usr/share/locale/sk/LC_MESSAGES/wget.mo
A    /usr/share/locale/sl/LC_MESSAGES/sudo.mo
A    /usr/share/locale/sl/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/sl/LC_MESSAGES/wget.mo
A    /usr/share/locale/sr/LC_MESSAGES/sudo.mo
A    /usr/share/locale/sr/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/sr/LC_MESSAGES/wget.mo
A    /usr/share/locale/sv/LC_MESSAGES/gawk.mo
A    /usr/share/locale/sv/LC_MESSAGES/sudo.mo
A    /usr/share/locale/sv/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/sv/LC_MESSAGES/wget.mo
A    /usr/share/locale/tr/LC_MESSAGES/sudo.mo
A    /usr/share/locale/tr/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/tr/LC_MESSAGES/wget.mo
A    /usr/share/locale/uk/LC_MESSAGES/sudo.mo
A    /usr/share/locale/uk/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/uk/LC_MESSAGES/wget.mo
A    /usr/share/locale/vi/LC_MESSAGES/gawk.mo
A    /usr/share/locale/vi/LC_MESSAGES/sudo.mo
A    /usr/share/locale/vi/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/vi/LC_MESSAGES/wget.mo
A    /usr/share/locale/zh_CN/LC_MESSAGES/sudo.mo
A    /usr/share/locale/zh_CN/LC_MESSAGES/sudoers.mo
A    /usr/share/locale/zh_CN/LC_MESSAGES/wget.mo
A    /usr/share/locale/zh_TW/LC_MESSAGES/wget.mo
A    /usr/share/man/man1/gawk.1.gz
A    /usr/share/man/man1/igawk.1.gz
A    /usr/share/man/man1/wget.1.gz
A    /usr/share/man/man3/filefuncs.3am.gz
A    /usr/share/man/man3/fnmatch.3am.gz
A    /usr/share/man/man3/fork.3am.gz
A    /usr/share/man/man3/ordchr.3am.gz
A    /usr/share/man/man3/readdir.3am.gz
A    /usr/share/man/man3/readfile.3am.gz
A    /usr/share/man/man3/revoutput.3am.gz
A    /usr/share/man/man3/revtwoway.3am.gz
A    /usr/share/man/man3/rwarray.3am.gz
A    /usr/share/man/man3/time.3am.gz
A    /usr/share/man/man5/sudo.conf.5.gz
A    /usr/share/man/man5/sudoers.5.gz
A    /usr/share/man/man8/sudo.8.gz
A    /usr/share/man/man8/sudo_plugin.8.gz
A    /usr/share/man/man8/sudoedit.8.gz
A    /usr/share/man/man8/sudoreplay.8.gz
A    /usr/share/man/man8/visudo.8.gz
A    /usr/share/awk
A    /usr/share/awk/assert.awk
A    /usr/share/awk/bits2str.awk
A    /usr/share/awk/cliff_rand.awk
A    /usr/share/awk/ctime.awk
A    /usr/share/awk/ftrans.awk
A    /usr/share/awk/getopt.awk
A    /usr/share/awk/gettime.awk
A    /usr/share/awk/group.awk
A    /usr/share/awk/inplace.awk
A    /usr/share/awk/join.awk
A    /usr/share/awk/libintl.awk
A    /usr/share/awk/noassign.awk
A    /usr/share/awk/ord.awk
A    /usr/share/awk/passwd.awk
A    /usr/share/awk/quicksort.awk
A    /usr/share/awk/readable.awk
A    /usr/share/awk/rewind.awk
A    /usr/share/awk/round.awk
A    /usr/share/awk/strtonum.awk
A    /usr/share/awk/walkarray.awk
A    /usr/share/awk/zerofile.awk

5.3 Listing package differences

We can also look at package differences, as you expect, using the right tool for the job.

root@photon-host-def [ ~ ]# rpm-ostree db diff 2940 82bc    
ostree diff commit old: 2940 (2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8)
ostree diff commit new: 82bc (82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817)
Added:
 gawk-4.1.0-2.ph1tp2.x86_64
 sudo-1.8.11p1-4.ph1tp2.x86_64
 wget-1.15-1.ph1tp2.x86_64

5.4 Rollback

If we want to go back to the previous image, we can rollback. The order of the images will be changed, so the old filetree will become the default bootable image. If -r option is passed, the rollback will continue with a reboot.

root@photon-host-def [ ~ ]# rpm-ostree rollback
Moving '2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0' to be first deployment
Transaction complete; bootconfig swap: yes deployment count change: 0
Removed:
  gawk-4.1.0-2.ph1tp2.x86_64
  sudo-1.8.11p1-4.ph1tp2.x86_64
  wget-1.15-1.ph1tp2.x86_64
Successfully reset deployment order; run "systemctl reboot" to start a reboot

In fact, we can repeat the rollback operation as many times as we want before reboot. On each execution, it's going to change the order. It will not delete any image.
However, an upgrade will keep the current default image and will eliminate the other image, whichever that is. So if Photon installation rolled back to an older build, an upgrade will keep that, eliminate the newer version and will replace it with an even newer version at the next upgrade.

grub-boot-0-1
The boot order moved back to original:

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     
  2015-09-03 00:34:41   1.0_tp2_minimal.1   82bca728ea   photon   photon:photon/tp2/x86_64/minimal   

The current bootable image path moved also back to the original value:

root@photon-host-def [ ~ ]# ostree admin config-diff --print-current-dir
/ostree/deploy/photon/deploy/2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0 

5.5 Deleting a deployed filetree

It is possible however to delete a deployed tree. The only supported index is 1. (If multiple bootable images will be supported in the future, a larger than one, zero-based index of the image to delete will be supported).
You cannot delete the default bootable filetree, so passing 0 will result in an error.

root@photon-host-def [ ~ ]# ostree admin undeploy -v 1
OT: Using bootloader: OstreeBootloaderGrub2
Transaction complete; bootconfig swap: yes deployment count change: -1
Deleted deployment 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.0
root@photon-host-cus1 [ ~ ]# ostree admin undeploy -v 0
error: Cannot undeploy currently booted deployment 0

Now, we can see that the newer image is gone, the deployment directory for commit 82bc has been removed.

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 
root@photon-host-cus1 [ ~ ]# ls /ostree/deploy/photon/deploy/                                        
2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0
2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0.origin   

However the commit is still there in the OSTree repo.

root@photon-host-def [ ~ ]# ostree log 82bc                 
commit 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817
Date:  2015-09-03 00:34:41 +0000
Version: 1.0_tp2_minimal.1


commit 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
Date:  2015-08-20 22:27:43 +0000
Version: 1.0_tp2_minimal

But there is nothing to rollback to.

root@photon-host-def [ ~ ]# rpm-ostree rollback
error: Found 1 deployments, at least 2 required for rollback

If we were to upgrade again, it would bring these packages back, but let's just check the differeneces.

root@photon-host-def [ ~ ]# rpm-ostree upgrade --check-diff
Updating from: photon:photon/tp2/x86_64/minimal


+gawk-4.1.0-2.ph1tp2.x86_64
+sudo-1.8.11p1-4.ph1tp2.x86_64
+wget-1.15-1.ph1tp2.x86_64

5.6 Version skipping upgrade

Let's assume that after a while, WMware releases version 2 that removes sudo and adds bison and tar. Now, an upgrade will skip version 1 and go directly to 2. Let's first look at what packages are pulled (notice sudo missing, as expected), then upgrade with reboot option.

root@photon-host-def [ ~ ]# rpm-ostree upgrade --check-diff
Updating from: photon:photon/tp2/x86_64/minimal

7 metadata, 13 content objects fetched; 1287 KiB transferred in 0 seconds
+bison-3.0.2-2.ph1tp2.x86_64
+gawk-4.1.0-2.ph1tp2.x86_64
+tar-1.27.1-1.ph1tp2.x86_64
+wget-1.15-1.ph1tp2.x86_64

root@photon-host-def [ ~ ]# rpm-ostree upgrade -r          
Updating from: photon:photon/tp2/x86_64/minimal

107 metadata, 512 content objects fetched; 13064 KiB transferred in 1 seconds
Copying /etc changes: 5 modified, 0 removed, 16 added
Transaction complete; bootconfig swap: yes deployment count change: 1
Freed objects: 19.3 MB

After reboot, let's check the booting filetrees, the current dir for the current filetree and look at commit differences:

root@photon-host-def [ ~ ]# rpm-ostree status 
  TIMESTAMP (UTC)         VERSION               ID             OSNAME     REFSPEC                              
* 2015-09-04 00:36:37     1.0_tp2_minimal.2     092e21d292     photon     photon:photon/tp2/x86_64/minimal
  2015-08-20 22:27:43     1.0_tp2_minimal       2940e10c4d     photon     photon:photon/tp2/x86_64/minimal

root@photon-host-cus1 [ ~ ]# ostree admin config-diff --print-current-dir
/ostree/deploy/photon/deploy/092e21d2928090d507ce711d482e4402e310b5a7f46532c5e24e0789590d0373.0

root@photon-host-cus1 [ ~ ]# rpm-ostree db diff  2940 092e
ostree diff commit old: 2940 (2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8)
ostree diff commit new: 092e (092e21d2928090d507ce711d482e4402e310b5a7f46532c5e24e0789590d0373)
Added:
 bison-3.0.2-2.ph1tp2.x86_64
 gawk-4.1.0-2.ph1tp2.x86_64
 tar-1.27.1-1.ph1tp2.x86_64
 wget-1.15-1.ph1tp2.x86_64

root@photon-host-cus1 [ ~ ]# rpm-ostree db diff  82bc 092e
error: Refspec '82bc' not found

Interesting fact: The metadata for commit 82bc has been removed from the local repo!

5.7 Tracking parent commits

OSTree will display limited commit history - maximum 2 levels, so if you want to traverse the history even though it may not find a commitment by its ID, you can refer to its parent using '^' suffix, grandfather via '^^' and so on. We know that 82bc is the parent of 092e:

root@photon-host-def [ ~ ]# rpm-ostree db diff  092e^ 092e
error: No such metadata object 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.commit
error: Refspec '82cb' not found
root@photon-host-def [ ~ ]# rpm-ostree db diff  092e^^ 092e
error: No such metadata object 82bca728eadb7292d568404484ad6889c3f6303600ca8c743a4336e0a10b3817.commit

So commit 092e knows who its parent is, but its metadata is no longer in the local repo, so it cannot traverse further to its parent to find an existing grandfather.

5.8 Resetting a branch to a previous commit

We can reset the head of a branch in a local repo to a previous commit, for example corresponding to version 0 (1.0_tp2_minimal).

root@photon-host-def [ ~ ]# ostree reset photon:photon/tp2/x86_64/minimal 2940

Now if wee look again at the branch commit history, the head is at version 0.

root@photon-host-def [ ~ ]# ostree log photon/tp2/x86_64/minimal
commit 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
Date:  2015-08-20 22:27:43 +0000
Version: 1.0_tp2_minimal

5.9 Switching to a different repo

Back to main page | Previous page | Next page >

Clone this wiki locally