Skip to content

Photon RPM OSTree: 4 Querying for commit, file and package metadata

Danut Moraru edited this page Sep 4, 2015 · 12 revisions

There are several ostree and rpm-ostree commands that list file or package data based on either the Commit ID, or Refspec. If Refspec is passed as a parameter, it's the same as passing the most recent commit ID (head) for that branch.

4.1 Commit history

For a host that is freshly installed, there is only one commit in the history for the only branch.

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

This commit has no parent; if there was an older commit, it would have been listed too. We can get the same listing (either nicely formatted or raw variant data) by passing the Commit ID. Just the first several hex digits will suffice to identify the commit ID.

root@photon-host-def [ ~ ]# ostree log 2940
commit 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
Date:  2015-08-20 22:27:43 +0000
Version: 1.0_tp2_minimal
root@photon-host-def [ ~ ]# ostree log 2940 --raw
commit 2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8
({'version': <'1.0_tp2_minimal'>, 'rpmostree.inputhash': <'6c9049036212831780b60c8e23e2d17237621872d8f3a6987721173732c770c4'>}, 
@ay [], @a(say) [], '', '', uint64 1440109663, [byte 0x6e, 0xdb, 0x60,
 0xcd, 0x7b, 0x92, 0xdf, 0x92, 0x45, 0xec, 0x23, 0x69, 0x15, 0xe5, 0x74,
 0xb9, 0x28, 0xb4, 0x71, 0xd3, 0x3c, 0x5b, 0x74, 0xd9, 0x32, 0x6c, 0xda,
 0xeb, 0x8c, 0xe9, 0x8f, 0xff], [byte 0x44, 0x6a, 0x0e, 0xf1, 0x1b, 0x7c,
 0xc1, 0x67, 0xf3, 0xb6, 0x03, 0xe5, 0x85, 0xc7, 0xee, 0xee, 0xb6, 0x75,
 0xfa, 0xa4, 0x12, 0xd5, 0xec, 0x73, 0xf6, 0x29, 0x88, 0xeb, 0x0b, 0x6c, 0x54, 0x88])

4.2 Listing file mappings

This command lists the file relations between the original source Linux Photon filetree and the deployed filetree. The normal columns include file type type (regular file, directory, link), permissions in chmod octal format, userID, groupID, file size, file name.

root@photon-host-def [ ~ ]# ostree ls 2940   
d00755 0 0      0 /
l00777 0 0      0 /bin -> usr/bin
l00777 0 0      0 /home -> var/home
l00777 0 0      0 /lib -> usr/lib
l00777 0 0      0 /lib64 -> usr/lib
l00777 0 0      0 /media -> run/media
l00777 0 0      0 /mnt -> var/mnt
l00777 0 0      0 /opt -> var/opt
l00777 0 0      0 /ostree -> sysroot/ostree
l00777 0 0      0 /root -> var/roothome
l00777 0 0      0 /sbin -> usr/sbin
l00777 0 0      0 /srv -> var/srv
l00777 0 0      0 /tmp -> sysroot/tmp
d00755 0 0      0 /boot
d00755 0 0      0 /dev
d00755 0 0      0 /proc
d00755 0 0      0 /run
d00755 0 0      0 /sys
d00755 0 0      0 /sysroot
d00755 0 0      0 /usr
d00755 0 0      0 /var

Extra columns can be added like checksum (-C) and extended attributes (-X).

root@photon-host-def [ ~ ]# ostree ls 2940 -C
d00755 0 0      0 6edb60cd7b92df9245ec236915e574b928b471d33c5b74d9326cdaeb8ce98fff 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /
l00777 0 0      0 389846c2702216e1367c8dfb68326a6b93ccf5703c89c93979052a9bf359608e /bin -> usr/bin
l00777 0 0      0 4344c10bf4931483f918496534f12ed9b50dc6a2cead35e3cd9dd898d6ac9414 /home -> var/home
l00777 0 0      0 f11902ca9d69a80df33918534a3e443251fd0aa7f94b76301e1f55e52aed29dd /lib -> usr/lib
l00777 0 0      0 f11902ca9d69a80df33918534a3e443251fd0aa7f94b76301e1f55e52aed29dd /lib64 -> usr/lib
l00777 0 0      0 75317a3df11447c470ffdd63dde045450ca97dfb2a97a0f3f6a21a5da66f737c /media -> run/media
l00777 0 0      0 97c55dbe24e8f3aecfd3f3e5b3f44646fccbb39799807d37a217e9c871da108b /mnt -> var/mnt
l00777 0 0      0 46b1abbd27a846a9257a8d8c9fc4b384ac0888bdb8ac0d6a2d5de72715bd5092 /opt -> var/opt
l00777 0 0      0 d37269e3f46023fd0275212473e07011894cdf4148cbf3fb5758a7e9471dad8e /ostree -> sysroot/ostree
l00777 0 0      0 6f800e74eed172661278d1e1f09e389a6504dcd3358618e1c1618f91f9d33601 /root -> var/roothome
l00777 0 0      0 e0bead7be9323b06bea05cb9b66eb151839989e3a4e5d1a93e09a36919e91818 /sbin -> usr/sbin
l00777 0 0      0 5d4250bba1ed300f793fa9769474351ee5cebd71e8339078af7ebfbe6256d9b5 /srv -> var/srv
l00777 0 0      0 364fbd62f91ca1e06eb7dbd50c93de8976f2cea633658e2dbe803ce6f7490c09 /tmp -> sysroot/tmp
d00755 0 0      0 86e9cc013d6e7d1e00d03908250279d494c9a1f994705f0a387314bb80619fe3 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /boot
d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /dev
d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /proc
d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /run
d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /sys
d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /sysroot
d00755 0 0      0 3046f73f9f60b6c2339e34aebec72a77f8a0c1bd313579e2259105331953e7f3 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /usr
d00755 0 0      0 6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d 446a0ef11b7cc167f3b603e585c7eeeeb675faa412d5ec73f62988eb0b6c5488 /var

By default only the top folders are listed, but -R will list recursively. Let's list all which related files.

root@photon-host-cus1 [ /ostree/repo ]# ostree ls photon/tp2/x86_64/minimal -R | grep which
-00755 0 0  27104 /usr/bin/which
-00644 0 0   2409 /usr/share/info/which.info.gz
-00644 0 0   1515 /usr/share/man/man1/which.1.gz

4.3 Listing packages

As expected, there is an rpm-ostree command that lists the packages for a commit or a branch, extracted from RPM database:

root@photon-host-def [ ~ ]# rpm-ostree db list photon/tp2/x86_64/minimal
ostree commit: photon/tp2/x86_64/minimal (2940e10c4d90ce6da572cbaeeff7b511cab4a64c280bd5969333dd2fca57cfa8)
 Linux-PAM-1.1.8-2.ph1tp2.x86_64
 attr-2.4.47-1.ph1tp2.x86_64
 autogen-5.18.5-1.ph1tp2.x86_64
 bash-4.3-4.ph1tp2.x86_64
 bc-1.06.95-2.ph1tp2.x86_64
 binutils-2.25-1.ph1tp2.x86_64
 bridge-utils-1.5-1.ph1tp2.x86_64
 bzip2-1.0.6-3.ph1tp2.x86_64
 ca-certificates-20130524-1.ph1tp2.x86_64
 coreutils-8.22-1.ph1tp2.x86_64
 cpio-2.11-2.ph1tp2.x86_64
 cracklib-2.9.2-2.ph1tp2.x86_64
 cracklib-dicts-2.9.2-2.ph1tp2.x86_64
 curl-7.43.0-1.ph1tp2.x86_64
 db-5.3.28-1.ph1tp2.x86_64
 dbus-1.8.8-3.ph1tp2.x86_64
 device-mapper-2.02.116-1.ph1tp2.x86_64
 device-mapper-libs-2.02.116-1.ph1tp2.x86_64
 docker-1.8.1-1.ph1tp2.x86_64
 dracut-041-1.ph1tp2.x86_64
 dracut-tools-041-1.ph1tp2.x86_64
 e2fsprogs-1.42.9-2.ph1tp2.x86_64
 e2fsprogs-devel-1.42.9-2.ph1tp2.x86_64
 elfutils-libelf-0.158-3.ph1tp2.x86_64
 expat-2.1.0-1.ph1tp2.x86_64
 file-5.22-1.ph1tp2.x86_64
 filesystem-7.5-8.ph1tp2.x86_64
 findutils-4.4.2-1.ph1tp2.x86_64
 flex-2.5.38-2.ph1tp2.x86_64
 gc-7.4.2-1.ph1tp2.x86_64
 gdbm-1.11-1.ph1tp2.x86_64
 glib-2.45.4-1.ph1tp2.x86_64
 glib-networking-2.45.1-1.ph1tp2.x86_64
 glibc-2.21-5.ph1tp2.x86_64
 gmp-5.1.3-1.ph1tp2.x86_64
 gnutls-3.4.2-1.ph1tp2.x86_64
 gobject-introspection-1.43.3-2.ph1tp2.x86_64
 gpgme-1.5.3-2.ph1tp2.x86_64
 grep-2.21-1.ph1tp2.x86_64
 grub2-2.02-2.ph1tp2.x86_64
 guile-2.0.11-1.ph1tp2.x86_64
 gzip-1.6-1.ph1tp2.x86_64
 hawkey-2014.1-3.ph1tp2.x86_64
 hawkey-devel-2014.1-3.ph1tp2.x86_64
 iana-etc-2.30-1.ph1tp2.noarch
 inetutils-1.9.2-2.ph1tp2.x86_64
 iproute2-3.12.0-1.ph1tp2.x86_64
 iptables-1.4.21-2.ph1tp2.x86_64
 json-glib-1.0.2-3.ph1tp2.x86_64
 kmod-16-1.ph1tp2.x86_64
 krb5-1.12.2-1.ph1tp2.x86_64
 libarchive-3.1.2-3.ph1tp2.x86_64
 libarchive-devel-3.1.2-3.ph1tp2.x86_64
 libassuan-2.2.0-2.ph1tp2.x86_64
 libcap-2.24-1.ph1tp2.x86_64
 libffi-3.1-1.ph1tp2.x86_64
 libgcc-4.8.2-4.ph1tp2.x86_64
 libgomp-4.8.2-4.ph1tp2.x86_64
 libgpg-error-1.17-1.ph1tp2.x86_64
 libgsystem-2015.1-1.ph1tp2.x86_64
 libhif-0.2.0-1.ph1tp2.x86_64
 libltdl-2.4.2-1.ph1tp2.x86_64
 librepo-1.7.15-1.ph1tp2.x86_64
 librepo-devel-1.7.15-1.ph1tp2.x86_64
 libselinux-2.4-1.ph1tp2.x86_64
 libsepol-2.4-1.ph1tp2.x86_64
 libsolv-0.6.6-2.ph1tp2.x86_64
 libsoup-2.50.0-3.ph1tp2.x86_64
 libsoup-devel-2.50.0-3.ph1tp2.x86_64
 libstdc++-4.8.2-4.ph1tp2.x86_64
 libtasn1-4.5-1.ph1tp2.x86_64
 libtool-2.4.2-1.ph1tp2.x86_64
 libunistring-0.9.5-1.ph1tp2.x86_64
 libxml2-2.9.1-3.ph1tp2.x86_64
 libxml2-devel-2.9.1-3.ph1tp2.x86_64
 linux-4.0.9-3.ph1tp2.x86_64
 lua-5.2.3-1.ph1tp2.x86_64
 m4-1.4.17-1.ph1tp2.x86_64
 mkinitcpio-18-2.ph1tp2.x86_64
 mpfr-3.1.2-1.ph1tp2.x86_64
 ncurses-5.9-2.ph1tp2.x86_64
 nettle-3.1.1-1.ph1tp2.x86_64
 nspr-4.10.8-1.ph1tp2.x86_64
 nss-3.19-2.ph1tp2.x86_64
 nss-altfiles-2.19.1-1.ph1tp2.x86_64
 openssh-6.6p1-3.ph1tp2.x86_64
 openssl-1.0.2d-2.ph1tp2.x86_64
 openssl-devel-1.0.2d-2.ph1tp2.x86_64
 ostree-2015.7-2.ph1tp2.x86_64
 pcre-8.36-1.ph1tp2.x86_64
 perl-5.18.2-2.ph1tp2.x86_64
 perl-DBD-SQLite-1.46-1.ph1tp2.x86_64
 perl-DBI-1.633-1.ph1tp2.x86_64
 perl-DBIx-Simple-1.35-1.ph1tp2.noarch
 photon-release-1.2-1.ph1tp2.noarch
 pkg-config-0.28-1.ph1tp2.x86_64
 popt-1.16-1.ph1tp2.x86_64
 procps-ng-3.3.9-2.ph1tp2.x86_64
 python2-2.7.9-3.ph1tp2.x86_64
 readline-6.3-3.ph1tp2.x86_64
 rpm-4.11.2-6.ph1tp2.x86_64
 rpm-devel-4.11.2-6.ph1tp2.x86_64
 rpm-ostree-2015.7-1.ph1tp2.x86_64
 sed-4.2.2-1.ph1tp2.x86_64
 shadow-4.1.5.1-4.ph1tp2.x86_64
 sqlite-autoconf-3080301-1.ph1tp2.x86_64
 systemd-216-8.ph1tp2.x86_64
 tcsh-6.18.01-1.ph1tp2.x86_64
 tdnf-1.0.2-1.ph1tp2.x86_64
 util-linux-2.24.1-2.ph1tp2.x86_64
 vim-7.4-4.ph1tp2.x86_64
 which-2.20-1.ph1tp2.x86_64
 xz-5.0.5-2.ph1tp2.x86_64
 zlib-1.2.8-2.ph1tp2.x86_64

4.4 Querying for package details

We are able to use the query option of rpm to make sure the newly added packages have been installed properly. The files list should match the previous file mappings. Let's check package which.

root@photon-host-def [ ~ ]# rpm -q which                     
which-2.20-1.ph1tp2.x86_64

root@photon-host-def [ ~ ]# rpm -qi which
Name        : which
Version     : 2.20
Release     : 1.ph1tp2
Architecture: x86_64
Install Date: Fri Sep  4 00:35:04 2015
Group       : Development/Tools
Size        : 31652
License     : GPLv3+
Signature   : RSA/SHA1, Fri Aug 21 02:31:26 2015, Key ID c0b5e0ab66fd4949
Source RPM  : which-2.20-1.ph1tp2.src.rpm
Build Date  : Thu Aug 20 19:05:45 2015
Build Host  : discus-test
Relocations : (not relocatable)
Vendor      : VMware, Inc.
URL         : http://savannah.gnu.org/projects/which
Summary     : Program shows full path of (shell) commands
Description :
Program for showing the full the path of (shell) commands.

root@photon-host-def [ ~ ]# rpm -q --filesbypkg which  
which                     /usr/bin/which
which                     /usr/share/info/dir
which                     /usr/share/info/which.info.gz
which                     /usr/share/man/man1/which.1.gz

The RPM database however is not writable any longer. The idea is that installing packages should be done via server tree composition and pull via rpm-ostree commit and deploy at host. Installing with tdnf will return an error.

root@photon-host-def [ ~ ]# tdnf install --nogpgcheck openjdk
Installing:
 openjdk	x86_64	1.8.0.51-1.ph1tp2
Is this ok [y/N]:y
Downloading 75351077.00 of 75351077.00
Testing transaction
Running transaction
Error(-1) : Unknown error -1601

Back to main page | Previous page | Next page >

Clone this wiki locally