-
Notifications
You must be signed in to change notification settings - Fork 700
Photon RPM OSTree: 5 Host updating operations
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 has a release version 1 for this branch that contains new packages:
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.
We like what we see and now let's upgrade. This command will apply the commit and deploy a new bootable filetree.
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 new 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.
Once booted, this will be obvious. The star marks the default bootable image. Let's look again at the status:
root@photon-host-cus1 [ ~ ]# 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-cus1 [ ~ ]# 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.
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
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
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 is now 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
root@photon-host-def [ ~ ]# 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.
The boot order moved back to original:
root@photon-host-cus1 [ ~ ]# 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-cus1 [ ~ ]# ostree admin config-diff --print-current-dir
/ostree/deploy/photon/deploy/2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8.0
It is possible however to delete a deployed tree. The only supported index is 1. You cannot delete the default bootable filetree, so passing 0 will result in an error.
root@photon-host-cus1 [ ~ ]# 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-cus1 [ ~ ]# 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-cus1 [ ~ ]# 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-cus1 [ ~ ]# rpm-ostree rollback
error: Found 1 deployments, at least 2 required for rollback
- Home
- Download Photon OS
- User Documentation
- FAQ
- Security Advisories
- Related Information