Bug 1398082

Summary: ReaR didn't recover ACL attribute of files
Product: Red Hat Enterprise Linux 7 Reporter: JongYoung Moon <jmoon>
Component: rearAssignee: Jakub Mazanek <jmazanek>
Status: CLOSED NOTABUG QA Contact: qe-baseos-daemons
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 7.2CC: gratien.dhaese, praiskup, tcerna
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-02-23 15:49:27 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:
Bug Depends On:    
Bug Blocks: 1400961    

Description JongYoung Moon 2016-11-24 04:46:29 UTC
- Description of problem:
Although applying the following backup options so that ACL could be backed up and recovered
for the certain files when backing filesystem up, ACL could not be applied after recovering.

- Version-Release number of selected component (if applicable):
RHEL 7.2
rear-1.17.2-1.el7.noarch


- How reproducible:
Always


- Steps to Reproduce:
01. Created VM
02. Installed RHEL 7.2
03. Configured local repository after mount ISO installation image.
04. Install rear package
   $ yum install rear

05. Configure /etc/reare/local.conf

OUTPUT=ISO
OUTPUT_URL=nfs://xxx.xxx.xxx.xxx/sswp_appshr/backup
BACKUP=NETFS
BACKUP_URL=nfs://xxx.xxx.xxx.xxx/sswp_appshr/backup
BACKUP_PROG=tar
BACKUP_PROG_OPTIONS="--anchored --acls --xattrs"
BACKUP_TYPE=incremental
FULLBACKUPDAY="Mon"
BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/media' '/var/tmp' '/var/crash' '/var/mqm' '/applog' '/oraclient' '/appsw' '/infsw' '/infha4' '/appcore' '/appbin' '/appwrk' '/inftmp' '/appshr' '/applog')


06. Run the following command.
    @ setfacl -m u:<user>:r /var/log/messages

07. Create backup
    $ rear -d -D mkbackup 

08. Confirm if backup is created.
    We confirmed if backup data and ISO image are created in local /backup directory and backup directory in NFS Server.

09. Perform recovery with rear ISO created.

10. Recover from rear ISO and the reboot.

11. Confirm if ACL is properly applied with the following command.
    $ getfacl /var/log/messages

12. You could see that ACL before backup is not applied.


- Actual results:
ACL changed is not applied after recovery via rear ISO.

- Expected results:
ACL changed should be applied after recovery via rear ISO.


- Additional info:
Here are the configuration and log file that we'd seen

/etc/rear/local.conf

OUTPUT=ISO
OUTPUT_URL=nfs://xxx.xxx.xxx.xxx/sswp_appshr/backup
BACKUP=NETFS
BACKUP_URL=nfs://xxx.xxx.xxx.xxx/sswp_appshr/backup
BACKUP_PROG=tar
BACKUP_PROG_OPTIONS="--anchored --acls --xattrs"
BACKUP_TYPE=incremental
FULLBACKUPDAY="Mon"
BACKUP_PROG_EXCLUDE=("${BACKUP_PROG_EXCLUDE[@]}" '/media' '/var/tmp' '/var/crash' '/var/mqm' '/applog' '/oraclient' '/appsw' '/infsw' '/infha4' '/appcore' '/appbin' '/appwrk' '/inftmp' '/appshr' '/applog')


We see the following "Warning" messages when checking log files regarding recover.

Warning: Cannot acl_from_text


2016-11-10 08:58:21 Including restore/NETFS/default/38_prepare_multiple_isos.sh
2016-11-10 08:58:21 Including restore/NETFS/default/40_restore_backup.sh
2016-11-10 08:58:21 Decrypting disabled
2016-11-10 08:58:21 Restoring tar archive '/tmp/rear.yRb6VE9IiDq3wUW/outputfs/skt-sswpbt04/2016-11-10-1743-I.tar.gz'
2016-11-10 08:58:21 dd if=/tmp/rear.yRb6VE9IiDq3wUW/outputfs/skt-sswpbt04/2016-11-10-1736-F.tar.gz | cat | tar --block-number --totals --verbose --anchored --acls --xattrs --gzip -C /mnt/local/ -x -f -
tar: var/log/messages: Warning: Cannot acl_from_text
10003278+1 records in
10003278+1 records out
5121678690 bytes (5.1 GB) copied, 65.728 s, 77.9 MB/s
Total bytes read: 11235604480 (11GiB, 164MiB/s)
2016-11-10 08:59:31 dd if=/tmp/rear.yRb6VE9IiDq3wUW/outputfs/skt-sswpbt04/2016-11-10-1743-I.tar.gz | cat | tar --block-number --totals --verbose --anchored --acls --xattrs --gzip -C /mnt/local/ -x -f -
tar: var/log/messages: Warning: Cannot acl_from_text
10003847+1 records in
10003847+1 records out
5121969805 bytes (5.1 GB) copied, 92.0977 s, 55.6 MB/s


We see this issue when checking if ACL is properly applied or not at the filesystem recovered as running "rear recover" after entering Recovery menu since booting with "Rear ISO" media.

Comment 2 Jakub Mazanek 2017-02-23 15:49:27 UTC
This is not a rear bug. It seems to be a bug in tar utility. If you believe this should be fixed, please file a bug to tar

example:

[root@unused-4-187 tmp]# setfacl -m u:jmazanek:r hello_file 
[root@unused-4-187 tmp]# getfacl hello_file 
# file: hello_file
# owner: jmazanek
# group: jmazanek
user::rw-
user:jmazanek:r--
group::rw-
mask::rw-
other::r--
[root@unused-4-187 tmp]# tar --acls -vczf hello.tar.gz hello_file 
hello_file
[root@unused-4-187 tmp]# tar -xvzf hello.tar.gz 
hello_file
[root@unused-4-187 tmp]# getfacl hello_file 
# file: hello_file
# owner: jmazanek
# group: jmazanek
user::rw-
group::rw-
other::r--

Comment 3 Pavel Raiskup 2017-02-28 14:22:25 UTC
(In reply to Jakub Mazanek from comment #2)
> [root@unused-4-187 tmp]# tar -xvzf hello.tar.gz 
> hello_file

Extended attributes are not extracted by default, at least not these days.
So to make it work, we need to use 'tar --acls -xf hello.tar.gz'.

Comment 4 Gratien D'haese 2017-03-01 11:53:26 UTC
See also the content of https://github.com/rear/rear/issues/1175 - I believe there are issues in tar itself with xattr and capabilities.