What's new

File corruption turns file to read only cannot delete

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

skeal

Part of the Furniture
I have 2 files in my root folder that are messed up and won't open. One is /opt and the other is /media without these files working I can't install anything. How do I format my root directory and rewrite? How do I remove these unremovable files? I was manually configuring dnscrypt to launch a second instance so I could have two dns servers. Help please! I am over my head I think.

Edit: will recovery mode work?
Edit: I have tried factory restore and uploading new firmware still these files cannot be opened.
 
Last edited:
/opt and /media are symbolic links to /tmp/opt and /tmp/media. By default the target directories don't exist for those two links. That is normal for the router.
 
/opt and /media are symbolic links to /tmp/opt and /tmp/media. By default the target directories don't exist for those two links. That is normal for the router.

I cannot see these files as folders they are now listed as an unrecognized file type. I cannot via command line in an ssh session find these files or use them in the way I had them before this happened. I use winscp and I can see the files but they are not represented as a folder or link.
 
Show us what you are seeing.

Untitled.png
 
If you're seeing exactly that same as in my screenshot then there is no problem. That is normal. You can't modify any files/folders in the root directory because they exist in ROM and are therefore read-only. That is why there are symbolic links to /tmp which is modifiable because it resides in RAM.
 
All the files in root are mounted read-only (they are part of the firmware). You most likely corrupted the link target of /tmp/opt (which is another link to your entware install) or your entware install itself.

What's the output of

ll /tmp/opt (that's two small letter L)
 
If the files are still open, it's going to be hard to delete them...

SSH/Telnet into the router and do the following command, and see if the files show up in the response - lsof
 
If you're seeing exactly that same as in my screenshot then there is no problem. That is normal. You can't modify any files/folders in the root directory because they exist in ROM and are therefore read-only. That is why there are symbolic links to /tmp which is modifiable because it resides in RAM.

OK I'll get back to you if I have any trouble I'm updating right now to merlins 380.65_2. Then I'll try installing absolution and dnscrypt again. Thank you for your quick reply and help.
 
All the files in root are mounted read-only (they are part of the firmware). You most likely corrupted the link target of /tmp/opt (which is another link to your entware install) or your entware install itself.

What's the output of

ll /tmp/opt (that's two small letter L)

If the files are still open, it's going to be hard to delete them...

SSH/Telnet into the router and do the following command, and see if the files show up in the response - lsof

Results

ASUSWRT-Merlin RT-AC68U 380.65-2 Fri Mar 10 05:29:50 UTC 2017
Quincy@RT-AC68U-B790:/tmp/home/root# ll /tmp/opt
ls: /tmp/opt: No such file or directory
Quincy@RT-AC68U-B790:/tmp/home/root# lsof
-sh: lsof: not found
Quincy@RT-AC68U-B790:/tmp/home/root# - lsof
-sh: -: not found
 
All the files in root are mounted read-only (they are part of the firmware). You most likely corrupted the link target of /tmp/opt (which is another link to your entware install) or your entware install itself.

What's the output of

ll /tmp/opt (that's two small letter L)

Results

Quincy@RT-AC68U-B790:/tmp/home/root# ll /tmp/opt
ls: /tmp/opt: No such file or directory
Quincy@RT-AC68U-B790:/tmp/home/root#
 
Quincy@RT-AC68U-B790:/tmp/home/root# ll /tmp/opt
ls: /tmp/opt: No such file or directory
The answer....you deleted the link to your entware install.....

Here's what it should look like (pointing to your install location of course)
Code:
lrwxrwxrwx    1 admin    root            23 Dec 31  2010 /tmp/opt -> /tmp/mnt/extsys/entware/

You can try and recreate the proper link in /tmp, or since you may have also deleted part of entware, probably best to start from a clean slate, including a fresh entware install.
 
The answer....you deleted the link to your entware install.....

Here's what it should look like (pointing to your install location of course)
Code:
lrwxrwxrwx    1 admin    root            23 Dec 31  2010 /tmp/opt -> /tmp/mnt/extsys/entware/

You can try and recreate the proper link in /tmp, or since you may have also deleted part of entware, probably best to start from a clean slate, including a fresh entware install.

Installed entware that fixed /tmp.
Now I have that /media to take care of any ideas?
 
Doesn't hurt anything......nothing to do (and nothing you can do).

Thank you sir!! You helped me lots!
I'm ok with nothing I can do.....lol.
 
Thank you sir!! You helped me lots!
I'm ok with nothing I can do.....lol.
LOL :D
Just to complete the thread. I imagine there is some addon package, somewhere, that looks for a media directory in root.....so the firmware provides one with a link to a writeable location. Just like it does for /opt to facilitate the installation of entware/optware.
 
I didn't know that....thanks for the info.

Happens... I've been caught by that a couple of times...

/foo isn't a good place to be ;)

/media is getting to be common place, even for devices that are mounted in /mnt - so this gets a bit odd...

And let's not mention the /usr merge ;)

For those - the /usr merge, and reasons why - it's complicated... but there's a lot of history there that goes all the way back to Ancient Unix... and a lot of work to unwind that - because the *nix community tends to leave things alone...
 

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top