Chattr +i not working

I want to make a file immutable. So, I installed the chattr package.

root@MrGhosh:/home/public# chattr +i /home/public/.profile
chattr: Not a tty while reading flags on /home/public/.profile

But I am getting an error: chattr: Not a tty while reading flags. I found a similar ticket at dd-wrt. (https://svn.dd-wrt.com//ticket/3890) posted 4 years ago with no reply.

Is this because of the filesystem? What filesystem does OpenWRT use? I have read that chattr doesn't support all file systems.

I am using GL-inet AR150 firmware which is built on top of OpenWRT 18. Except for some extra vendor specific packages, it is same as OpenWRT.

With -T you can easily see the filesystems you're dealing with:

root@lede:~# df -hT
Filesystem           Type            Size      Used Available Use% Mounted on
/dev/root            squashfs        5.8M      5.8M         0 100% /rom
tmpfs                tmpfs          60.6M      1.0M     59.6M   2% /tmp
/dev/mtdblock8       jffs2           8.3M    400.0K      7.9M   5% /overlay
overlayfs:/overlay   overlay         8.3M    400.0K      7.9M   5% /
tmpfs                tmpfs         512.0K         0    512.0K   0% /dev
1 Like

Thank you @Borromini Here is the output. Do you have any idea why chattr is showing that error?

root@MrGhosh:/bin# df -hT
Filesystem           Type            Size      Used Available Use% Mounted on
/dev/root            squashfs        9.0M      9.0M         0 100% /rom
tmpfs                tmpfs          29.3M      1.4M     27.9M   5% /tmp
/dev/mtdblock5       jffs2           5.3M      1.6M      3.7M  31% /overlay
overlayfs:/overlay   overlay         5.3M      1.6M      3.7M  31% /
tmpfs                tmpfs         512.0K         0    512.0K   0% /dev
root@MrGhosh:/bin#

Well, it's probably the hunch you had yourself - google jffs2 and chattr together and see what pops up.

1 Like

I needed also for 15.05.1 but i could not even find a package?!

So i put microsd card to Ubuntu and changed it - works!

It seems that chattr does not support JFFS2. From wikipedia (https://en.wikipedia.org/wiki/Chattr#File_system_support):

The attributes chattr and lsattr manipulate were originally specific to the Second Extended Filesystem family (ext2, ext3, ext4), and are available as part of the e2fsprogspackage.
However, the functionality has since been extended, fully or partially, to many other systems, including XFS, ReiserFS, JFS and OCFS2. The btrfs file system includes the attribute functionality, including C which turns off the copy-on-write built in feature of btrfs due to slower performance associated with CoW.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.