1 stop solution for setfacl “Operation not supported” in Linux

Introduction

Setfacl error: We may come across this issue in a production environment while creating with the new file system. This can be resolved without rebooting the server let us see how to resolve the “Operation not supported” issue in RedHat Enterprise Linux 6 and variants like Centos 6, Oracle 6, Fedora and Scientific Linux servers.

Actual error

[root@rhel6 ~]# setfacl -m u:babin:rwx /data/backup/books_order.xml
setfacl: /data/backup/books_order.xml: Operation not supported

When we create a new file system these mount options will not come by default. Here we are trying to provide special permission on a file owned by other users than “root”.

Reproducing the error

First, check the existing file ownership using “getfacl”. And we found the owner of the file is “root” user.

# getfacl /data/backup/books_order.xml

[root@rhel6 ~]# getfacl /data/backup/books_order.xml
getfacl: Removing leading '/' from absolute path names
# file: data/backup/books_order.xml
# owner: root
# group: root
user::rw-
group::r--
other::r--

Now user “babin” need read, write, execute permission on a file “books_order.xml” which underlying in a newly created file system /data. When we try to run setfacl it throws “Operation not supported”.

In this case, we need to check the newly created filesystem as well. Because the newly created filesystem may not consist of the mount option.

# setfacl -m u:babin:rwx /data/backup/books_order.xml

[root@rhel6 ~]# setfacl -m u:babin:rwx /data/backup/books_order.xml
setfacl: /data/backup/books_order.xml:
Operation not supported
[root@rhel6 ~]

Let us check whether the newly created file system has the required defaults mount options.

# tune2fs -l /dev/mapper/vg_data01-lv_data01 | grep 'mount option'

[root@rhel6 ~]# tune2fs -l /dev/mapper/vg_data01-lv_data01 | grep 'mount option'
Default mount options: (none)
[root@rhel6 ~]

In the above output, we found the “acl” mount option not available by default.

Adding ACL mount option to filesystem

Let us add the “acl” mount option using “tune2fs” command and check the status once again. To add the acl option use “-o” (option) to add the required additional mount options.

# tune2fs -o acl /dev/mapper/vg_data01-lv_data01
# tune2fs -l /dev/mapper/vg_data01-lv_data01 | grep 'mount option'

Output for the above command.

[root@rhel6 ~]# tune2fs -o acl /dev/mapper/vg_data01-lv_data01
tune2fs 1.41.12 (17-May-2010)
[root@rhel6 ~]

[root@rhel6 ~]
[root@rhel6 ~# tune2fs -l /dev/mapper/vg_data01-lv_data01 | grep 'mount option'
Default mount options: acl
[root@rhel6 ~]

Adding ACL mount option to mount point

Now we have “acl” mount option in the newly created file system just we need to remount the file system and verify it. To mount the filesystem using “-o” option and specify the required values. During the next reboot, this will be in place without any manual interaction.

# mount -t ext4 -o remount,acl /dev/mapper/vg_data01-lv_data01 /data
# mount | grep 'data'

[root@rhel6 ~]# mount | grep 'data'
/dev/mapper/vg_data01-lv_data01 on /data type ext4 (rw,acl)
[root@rhel6 ~]

Now we won’t get the “Operation not supported” error on the newly created file system. Let’s apply for the special permission once again by running “setfacl” and by following verify using “getfacl” command.

Setting and verifying Special Permission

Set the ACL by running below command with option and argument.

# setfacl -m u:babin:rwx /data/backup/books_order.xml

To verify the above command run the getfacl without any options and argument as shown below.

# getfacl /data/backup/books_order.xml

[root@rhel6 ~]# getfacl /data/backup/books_order.xml
getfacl: Removing leading '/' from absolute path names
# file: data/backup/books_order.xml
# owner: root
# group: root
user::rw-
user:babin:rwx
group::r--
mask::rwx
other::r--

Persistent method using FSTAB entry

If we need to make this change persistent during reboots it good to have this entry in /etc/fstab. however, if we used tune2fs command in our earlier step then it can be ignored.

/dev/mapper/vg_data01-lv_data01 /data ext4 defaults,acl 0 0

In XFS file system by default ACL will be included, we cannot disable ACL in XFS file system at all.

That’s it, we have resolved the “Operation not supported” issue without rebooting any ongoing production environment.

Conclusion

The solution available for “Operation not supported” due to ACL can be resolved on the fly by following few of steps. Hope this helps you to resolve your issue. If you found this useful provide your comments. Subscribe to our newsletter and stay up-to-date with us.

One thought on “1 stop solution for setfacl “Operation not supported” in Linux

  1. Thanks Babin, that fixed my problem! One server out of 300+ with the issue, I was really scratching my head 🙂

Comments are closed.

Exit mobile version