Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resolv.conf failing to delete due to file attributes #2482

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

seanlionelbarrett
Copy link

Hi,

When I was installing Mail-in-a-Box, the installation process was interrupted because the script failed to delete /etc/resolv.conf. The specific error message I recieved was rm: cannot remove '/etc/resolv.conf': Operation not permitted. I found out that the reason the script was unable to delete the file was because it had the immutable file attribute set. If the attribute is not set, the script can delete the file and continue as usual. Deletion of the file also fails if the file has the append only file attribute. I make this pull request to suggest modifying the script to make it to remove the attributes automatically before deleting the file so the user does not have to troubleshoot and fix it manually. Thank you.

Regards,
Sean

@JoshData
Copy link
Member

Do you know why these attributes were set? In 10 years it's the first time I've heard of something like that.

@seanlionelbarrett
Copy link
Author

This issue happened on a VPS from Netcup but I didn't see it on servers from other VPS hosts. I think some VPS hosts just make the file immutable by default. Outside of MiaB, you can find other people who had this attribute on their resolv.conf file. (Link 1) (Link 2) (Link 3) (Link 4)

Copy link
Contributor

@dms00 dms00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a command I've had much opportunity to use over the years, so I played around with it on my Ubuntu system with ext4 for a while, and it seems to be okay.
My only concern would be that there's a filesystem out there (other than ext) that won't like this or that some provider's Ubuntu distro lacks the command, but I'll readily admit these concerns are likely not valid.

@myfirstnameispaul
Copy link
Contributor

I think it is reasonable to assume that the system will run ext4 and to even state it as a requirement (cue Btrfs users).

However, filesystem could it be determined by checking fstab and possibly even mount options for ext4? I have no idea if there is a mount option for ext4 that could disable this and I have to admit I don't know where I would find (or not find) the mount option that might affect this.

@seanlionelbarrett
Copy link
Author

This Wikipedia article suggests that extended file attributes are supported across many different file systems. If it's necessary, I could add a check to see if the file system in use supports extended file attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants