Bug 2134629

Summary: backport support for embedded container whiteouts
Product: Red Hat Enterprise Linux 8 Reporter: Colin Walters <walters>
Component: ostreeAssignee: Colin Walters <walters>
Status: CLOSED ERRATA QA Contact: HuijingHei <hhei>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.7CC: aaradhak, hhei
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ostree-2022.2-6.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-05-16 08:26:47 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Colin Walters 2022-10-13 19:45:45 UTC
Backport https://github.com/ostreedev/ostree/pull/2717 for Microshift enablement.

Comment 1 HuijingHei 2022-10-17 13:21:21 UTC
Test with ostree-2022.2-6.el8.x86_64, the result is the same as https://github.com/ostreedev/ostree/issues/2712, not sure my steps are correct, could you help to confirm? Thanks!

[core@cosa-devsh ~]$ rpm -q ostree
ostree-2022.2-6.el8.x86_64

[core@cosa-devsh ~]$ rm -rf rootfs test
[core@cosa-devsh ~]$ ostree --repo=./test init --mode=bare-user
[core@cosa-devsh ~]$ mkdir rootfs
[core@cosa-devsh ~]$ mknod -m 0 rootfs/whiteout c 0 0
[core@cosa-devsh ~]$ ostree commit --repo=./test ./rootfs --branch test/stable/x86_64
error: Not a regular file or symlink: whiteout

Comment 2 HuijingHei 2022-10-18 14:30:42 UTC
Look more about https://github.com/ostreedev/ostree/pull/2717, do the testing like following, any suggestions are appreciated, thanks!

1) Upgrade ostree to fixed version
$ sudo rpm-ostree override replace ostree-2022.2-6.el8.x86_64.rpm ostree-grub2-2022.2-6.el8.x86_64.rpm ostree-libs-2022.2-6.el8.x86_64.rpm

$ sudo rpm-ostree ex apply-live --allow-replacement
$ rpm -q ostree
ostree-2022.2-6.el8.x86_64


2) Prepare repo with whiteout files
$rm -rf *
$mkdir -p test/usr/container/layers/abcd

$touch test/usr/container/layers/abcd/.ostree-wh.whiteout
$chmod 400 test/usr/container/layers/abcd/.ostree-wh.whiteout

$touch test/usr/container/layers/abcd/.ostree-wh.whiteout2
$chmod 777 test/usr/container/layers/abcd/.ostree-wh.whiteout2

$ostree --repo=test-repo init --mode=archive
$ostree --repo=test-repo commit --branch=foo test


3) Run checkout with `--process-passthrough-whiteouts` option and check whiteout files are character device with 0/0 device number
[core@cosa-devsh ~]$ ostree --repo=test-repo checkout --process-passthrough-whiteouts foo checkout-repo/
[core@cosa-devsh ~]$ ls checkout-repo/usr/container/layers/abcd/ -alh
total 0
drwxrwxr-x. 2 core core   39 Jan  1  1970 .
drwxrwxr-x. 3 core core   18 Jan  1  1970 ..
cr--------. 1 core core 0, 0 Oct 18 14:23 whiteout
crwxrwxrwx. 1 core core 0, 0 Oct 18 14:23 whiteout2

Comment 3 Colin Walters 2022-10-18 15:12:38 UTC
Yep, this looks right to me!

Comment 4 HuijingHei 2022-10-19 08:54:17 UTC
Thanks Colin for the confirmation about Comment 2. One silly question, what about Comment 1?

Comment 5 Colin Walters 2022-10-19 13:49:17 UTC
> [core@cosa-devsh ~]$ ostree commit --repo=./test ./rootfs --branch test/stable/x86_64
> error: Not a regular file or symlink: whiteout

Yeah, we for now kind of decided to punt on having "ostree commit" do the right thing automatically here.
So the logic for this lives in rpm-ostree today (but it can live elsewhere too).

Comment 6 HuijingHei 2022-10-19 13:59:32 UTC
Get it, thanks Colin for the confirmation. Set Verified to Tested

Comment 9 HuijingHei 2022-10-25 06:41:59 UTC
Verify passed with ostree-2022.2-6.el8.x86_64

[core@cosa-devsh ~]$ rpm -q ostree
ostree-2022.2-5.el8.x86_64
[core@cosa-devsh ~]$ sudo rpm-ostree override replace ostree-2022.2-6.el8.x86_64.rpm ostree-grub2-2022.2-6.el8.x86_64.rpm ostree-libs-2022.2-6.el8.x86_64.rpm
...
Checking out tree 6420705... done
No enabled rpm-md repositories.
Importing rpm-md... done
Resolving dependencies... done
Applying 3 overrides
Processing packages... done
Running pre scripts... done
Running post scripts... done
Running posttrans scripts... done
Writing rpmdb... done
Writing OSTree commit... done
Staging deployment... done
Upgraded:
  ostree 2022.2-5.el8 -> 2022.2-6.el8
  ostree-grub2 2022.2-5.el8 -> 2022.2-6.el8
  ostree-libs 2022.2-5.el8 -> 2022.2-6.el8
Use "rpm-ostree override reset" to undo overrides
Run "systemctl reboot" to start a reboot
[core@cosa-devsh ~]$ sudo rpm-ostree ex apply-live --allow-replacement
NOTICE: Experimental commands are subject to change.
Computing /etc diff to preserve... done
Updating /usr... done
Updating /etc... done
Running systemd-tmpfiles for /run and /var... done
Upgraded:
  ostree 2022.2-5.el8 -> 2022.2-6.el8
  ostree-grub2 2022.2-5.el8 -> 2022.2-6.el8
  ostree-libs 2022.2-5.el8 -> 2022.2-6.el8
Successfully updated running filesystem tree; some services may need to be restarted.
[core@cosa-devsh ~]$ rpm -q ostree
ostree-2022.2-6.el8.x86_64
[core@cosa-devsh ~]$ mkdir -p test/usr/container/layers/abcd
[core@cosa-devsh ~]$ touch test/usr/container/layers/abcd/.ostree-wh.whiteout
[core@cosa-devsh ~]$ chmod 400 test/usr/container/layers/abcd/.ostree-wh.whiteout
[core@cosa-devsh ~]$ touch test/usr/container/layers/abcd/.ostree-wh.whiteout2
[core@cosa-devsh ~]$ chmod 777 test/usr/container/layers/abcd/.ostree-wh.whiteout2
[core@cosa-devsh ~]$ ostree --repo=test-repo init --mode=archive
[core@cosa-devsh ~]$ ostree --repo=test-repo commit --branch=foo test
4bf43bcc0137d5eb7a9fcd19c4992828762f48a6ce4be0082c8e950162c03f03
[core@cosa-devsh ~]$ ostree --repo=test-repo checkout --process-passthrough-whiteouts foo checkout-repo/
[core@cosa-devsh ~]$ ls checkout-repo/usr/container/layers/abcd/ -alh
total 0
drwxrwxr-x. 2 core core   39 Jan  1  1970 .
drwxrwxr-x. 3 core core   18 Jan  1  1970 ..
cr--------. 1 core core 0, 0 Oct 25 06:39 whiteout
crwxrwxrwx. 1 core core 0, 0 Oct 25 06:39 whiteout2

Comment 12 errata-xmlrpc 2023-05-16 08:26:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (ostree bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:2774