Can't echo to file even as root.

Issues related to hardware problems
Post Reply
malapradej
Posts: 4
Joined: 2018/06/18 10:43:36

Can't echo to file even as root.

Post by malapradej » 2018/06/20 08:36:41

I am trying to echo the following to a file as root.

Code: Select all

# echo 1 > /sys/bus/thunderbolt/devices/0-1/authorized
with error

Code: Select all

bash: echo: write error: Invalid argument
using

Code: Select all

ls -l /sys/bus/thunderbolt/devices/0-1/authorized 
permissions are set as:

Code: Select all

-rw-rw-r--. 1 root root 4096 Jun 20 09:21 /sys/bus/thunderbolt/devices/0-1/authorized

lightman47
Posts: 1521
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Can't echo to file even as root.

Post by lightman47 » 2018/06/22 18:30:06

I was about to suggest {on the other forum before it disappeared} that perhaps the file was marked 'immutable'.?.? Generally, you don't want to screw with those, but I once had to myself.

The command 'chattr' may be of help.

JohnK2020
Posts: 19
Joined: 2018/06/27 12:08:17

Re: Can't echo to file even as root.

Post by JohnK2020 » 2018/06/28 15:46:51

As far as I know, echo into file is:

Code: Select all

echo '1' >> /home/dudu/file

lightman47
Posts: 1521
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Can't echo to file even as root.

Post by lightman47 » 2018/06/28 16:42:29

I was suggesting chattr to check on the file/directory attributes (to see if was marked immutable), thus preventing your attempts to write to it

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Can't echo to file even as root.

Post by TrevorH » 2018/06/28 16:49:22

Anything under /sys is part of the kernel and isn't a real file. If you can't echo into it, it's because the kernel doesn't let you.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

lightman47
Posts: 1521
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Can't echo to file even as root.

Post by lightman47 » 2018/06/28 16:56:54

{smacking my head on wall}

I _knew_ that a while back but forgot it was one of those 'dynamic' directories!! Grr. Thanks.

Post Reply