root user cannot write on file

PIPPOBAUDO

New Member
Joined
Mar 22, 2020
Messages
4
Reaction score
2
Credits
0
Hi,

I was trying to edit the following file as root:

/sys/module/pcie_aspm/parameters/policy

As in the title I cannot write on this file even though I am logged as root.

Permissions on this file are set rwx for owner, group, and others (chmod 777)

Do you know how I can write the file?

Thanks for you time
 


Vrai

Well-Known Member
Joined
Mar 16, 2019
Messages
1,059
Reaction score
996
Credits
4,055
1.) Who is the actual 'owner' of the file.
2.) Perhaps the file cannot be edited while it is in use?
 

jhasaurav

New Member
Joined
Mar 23, 2020
Messages
1
Reaction score
0
Credits
0
Hi,

I was trying to edit the following file as root:

/sys/module/pcie_aspm/parameters/policy

As in the title I cannot write on this file even though I am logged as root.

Permissions on this file are set rwx for owner, group, and others (chmod 777)

Do you know how I can write the file?

Thanks for you time


there is a chatter commands which prevent root to edit or modify or delete any file from the system.

try removing chatter by shooting the below command

#chatter -a filename
or
#chatter -i filename
 
OP
P

PIPPOBAUDO

New Member
Joined
Mar 22, 2020
Messages
4
Reaction score
2
Credits
0
First off thanks everybody for helping me.

1.) Who is the actual 'owner' of the file.
2.) Perhaps the file cannot be edited while it is in use?

root is the owner of the file, group owner is root too
the disk where the file is located is formatted as xfs and is a lvm logical volume


there is a chatter commands which prevent root to edit or modify or delete any file from the system.

try removing chatter by shooting the below command

#chatter -a filename
or
#chatter -i filename

for the chatter command doesn't work, i mean exactly i typed:

(I underline that I typed chattr and not chatter because the last one returned something like "chatter program not found" )

chattr -a
chattr -i

both returning: "inappropriate ioctl for device"
 

Vrai

Well-Known Member
Joined
Mar 16, 2019
Messages
1,059
Reaction score
996
Credits
4,055
root is the owner of the file, group owner is root too
Have you perchance checked the "permissions" of the file?
I know "root" should have all powerful access but can a file have permissions such that root can read and execute but not write?
Maybe a waste of time - but easy enough to check.
Sometimes (most times) troubleshooting is a process of elimination.
 
OP
P

PIPPOBAUDO

New Member
Joined
Mar 22, 2020
Messages
4
Reaction score
2
Credits
0
Have you perchance checked the "permissions" of the file?
I know "root" should have all powerful access but can a file have permissions such that root can read and execute but not write?
Maybe a waste of time - but easy enough to check.
Sometimes (most times) troubleshooting is a process of elimination.
I did by typing:
ls -latr /sys/module/pcie_aspm/parameters/policy

both user owner and group owner were root, and even by issue chmod 777 [file], I still can't write onto the file

Me too I thought root had all the power, probably it is, but not in this kind of situation we're trying to figure out.

As jhasaurav suggested I had issued the chattr command but it gave me error (inappropriate ioctl for device )
 

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,446
Reaction score
1,051
Credits
8,926
Just curious, how are you trying to edit this file?

Sometimes vim, vi, nano or emacs won't work.
but usually this does.

echo "some parameter=some value" >> /sys/module/pcie_aspm/parameters/some_file
 
OP
P

PIPPOBAUDO

New Member
Joined
Mar 22, 2020
Messages
4
Reaction score
2
Credits
0
Just curious, how are you trying to edit this file?

Sometimes vim, vi, nano or emacs won't work.
but usually this does.

echo "some parameter=some value" >> /sys/module/pcie_aspm/parameters/some_file

I did both > and >>

It returns:
echo: writing error: operation not allowed
 
Last edited:

LTXex

New Member
Joined
Jun 4, 2020
Messages
2
Reaction score
0
Credits
15
maybe system doesn't support pcie aspm.
try
dmesg | grep -i aspm
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation


Top