Cannot save or delete files in a folder <Solved>

Booting, installing, newbie
Post Reply
Message
Author
User avatar
LNSmith
Posts: 126
Joined: Thu 28 Mar 2013, 14:24
Location: A little north fr. Sydney, AU

Cannot save or delete files in a folder <Solved>

#1 Post by LNSmith »

G'day clever-types:

In the file attached you see the content of a folder: inq-text. (The file is in the posting below)
The files in the folder are text files and (until a few minutes ago) I edited and saved some files (today: 14 June). Now, suddenly I can edit a file but I cannot save a file. See, as an example, inq_d04_98-0205-n.txt. Edited the file below, (- ie same name both w/out -n) I could not save my work.

I edited inq_d01 (- check the date: June 14 - today-) and saved that file.
I cannot delete inq_d06_a_blank_file.txt. I created that file in April - probably 'touched' it into existence. I can open it with Geany. It's an empty file. Also, note the size: 0 B. Again, that suggests and empty file.

Can any-one suggest what's going on here? What am I missing?

(Additional info).
I have a copy of this directory (along with others) on a thumb-drive.
I took that thumb to another PC (a lap-top) last week and edited some of the files in the directory on the thumb.
Then, this morning, I copied the 'freshly edited' files back onto the (conventional) drive you see in this snapshot. Can't say exactly which files - I used the terminal command 'find' to located anything I worked on last week - then 'copied' from the thumb to sda1 (the main rotating drive on my desktop).

I am logged in (at the moment) as 'root' (at least on the terminal).
When I open d06 - the blank file and try to save a small change I see the msg: Error saving file. Operation not permitted.
BUT! If I copy the _d06_a_blank_file.txt to /mnt/ram1/ and open-edit-save (the file, using Geany) THEN (miracle of miracles) I can save the changes back to the RAM drive.
Clearly I can solve the problem by creating a new directory, copying all the files and then deleting the previously (perfectly functional) working directory 'nq-text'.

Has Linux failed? Is the world ending? Say it ain't so, Huck! Say it ain't so!
Maybe my desktop has got the Kung-flu? I hear it is going around ...

Help received with appreciation.

Leslie (in NSW Australia).
Last edited by LNSmith on Mon 15 Jun 2020, 03:05, edited 2 times in total.

User avatar
LNSmith
Posts: 126
Joined: Thu 28 Mar 2013, 14:24
Location: A little north fr. Sydney, AU

Cannot save or delete files in a folder

#2 Post by LNSmith »

This file is part of the previous posting.
Initially it was too large to post, so I cut it down.
But you must down-load it to your PC.

Leslie
Attachments
ROX_nq_folder.jpg
(212.57 KiB) Downloaded 33 times

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#3 Post by Semme »

Yeah. P̶e̶r̶m̶i̶s̶s̶i̶o̶n̶s̶ ̶s̶h̶o̶u̶l̶d̶ ̶b̶e̶ ̶"̶[̶u̶r̶l̶=̶h̶t̶t̶p̶:̶/̶/̶w̶w̶w̶.̶f̶i̶l̶e̶p̶e̶r̶m̶i̶s̶s̶i̶o̶n̶s̶.̶c̶o̶m̶/̶f̶i̶l̶e̶-̶p̶e̶r̶m̶i̶s̶s̶i̶o̶n̶/̶7̶5̶5̶]̶r̶w̶x̶r̶-̶x̶r̶-̶x̶[̶/̶u̶r̶l̶]̶,̶"̶ ̶o̶r̶ ̶n̶u̶m̶e̶r̶i̶c̶a̶l̶l̶y̶ ̶7̶5̶5̶.

Permissions in your screenshot are OK -- 644 numerically.

When you say you took that thumb to another PC, was it another Linux box NOT running as root?
Last edited by Semme on Mon 15 Jun 2020, 01:13, edited 1 time in total.
>>> Living with the immediacy of death helps you sort out your priorities. It helps you live a life less trivial <<<

User avatar
LNSmith
Posts: 126
Joined: Thu 28 Mar 2013, 14:24
Location: A little north fr. Sydney, AU

Cannot save or detete files in a folder

#4 Post by LNSmith »

@Semme:
Tnx for ur info. This is what I tried:
#
# pwd
/mnt/sda1/Law/bNgo/transcript/text/nq-text
# ls -l inq_d04_*
-rw-r--r-- 1 root root 153846 Jun 14 13:14 inq_d04_98-0205-n.txt
-rw-r--r-- 1 root root 153826 Apr 1 03:53 inq_d04_98-0205.txt
# # You see the files & attributes/permissions
# # Now I use chmod. My application to do that will be denied.
# chmod a=rwx inq_d04_98-0205.txt # using example fr. web about chmod.
chmod: changing permissions of 'inq_d04_98-0205.txt': Operation not permitted
# # oh! NOT allowed!!
# chmod 0777 inq_d04_98-0205.txt # using example fr. web about chmod.
chmod: changing permissions of 'inq_d04_98-0205.txt': Operation not permitted
#
OK, you see what happened using bash. I'm in the correct dictionary. I am admin/root. You can see the syntax of the command I used - I think it is ok because it told me, 'not permitted' rather than 'cmnd does not exist'.

Clearly I don't understand file attributes and/or ownershop, such as admin/group/owner and chmod. WHERE CAN I DISCOVER WHAT I DON'T KNOW? (I certainly understand the concept - admin/group/individual at a general level).

Tnx for ur help

Leslie (sometimes known as root/admin).

PS I did NOT mess with chmod or any other command that I can think of before this situation arose. find: yes, but only to locate files. Nothing like an exec function (so far as I can imagine). Ditto for grep (yes - a lot of grepping) and maybe sed - but nothing that might affect a file's attributes/permissions.

PPS I'm certainly a beginner with Linux, but I've written in assembler (so understand the 'internals' of a uP).

Once I read every line of source (in assembler) for a small OS that was Linux like. My point: A general hint about the problem is all I need. I can find my way thru the forest w/out detail ... eventually.

Oh, one final thing. In the OS I mentioned (it was called PTDOS - small but elegant) every file had the 'normal' set of attributes. KRWIANX. Kill/read/write/info/attribute/name/extend. "A" = 'attribute protect'. Once set everything for that file was LOCKED. Only the core of the OS had the 'A' bit set and it could only be changed during assembly or by 'bit' stuffing the file on the disk. Does such an attribute/permission exist for Linux, and if so where? How could I have 'diddled such a bit (if it existed)?

Again, tnx for ur help.

User avatar
Semme
Posts: 8399
Joined: Sun 07 Aug 2011, 20:07
Location: World_Hub

#5 Post by Semme »

Leslie, go into the directory where these text files are and rt-clk;

Select >> Select All;

Place your cursor on any of the highlighted files and rt-clk again;

# items >> Permissions

If the window that opens is low, left-clk/hold the title bar and drag it up.

Now hit the "Command" drop-down, select "Give owner read+write" then hit Quiet.

Open one, make any single change and try to save.

If this doesn't work, rt-clk a blank area in this same directory and;

Window >> Terminal Here.

Go back to your original listing with: chmod -R 644 *

Then do: chattr -i *

And again go through the motions.

Let's see what gives here..

==

Your stick is what, FAT32?

If we can't straighten this out on Linux you may need to do it with REATR (change file protection attributes) back on this PTDOS unit.
I took that thumb to another PC (a lap-top) last week and edited some of the files in the directory on the thumb.
Then, this morning, I copied the 'freshly edited' files back onto the (conventional) drive you see in this snapshot.
This above is no doubt the key to your dilemma.

Hmm, differences in byte-code? Instruction?

There's gotta be a Unix spin on this...

User avatar
LNSmith
Posts: 126
Joined: Thu 28 Mar 2013, 14:24
Location: A little north fr. Sydney, AU

Cannot save or delete files in a folder

#6 Post by LNSmith »

@Semme

Here is my report after following your instruction. (btw I understand EVERY detail of your method and I tried some variation of this before)
When I did what you suggested I saw a msg (box)
Changing permissions of '/mnt/sda1/Law/bNgo/transcript/text/nq-text/verbal-P.Dao_inq.txt'
Changing permissions of '/mnt/sda1/Law/bNgo/transcript/text/nq-text/ztest_fil.txt'
ERROR: Operation not permitted

Done
There were 27 errors.
-> of course this is the report for only one operation. There were 27 in all. I didn't copy ALL the error messages.

AGAIN: I went on follow the next step. - I opened one file (*d05*) and added a space. Ascii char '0x20'. Vy clever eh? But I could not save the file. I did this using geany and I don't need to show the precise error message. I know you can see it in your own mind.

NEXT: (Using ROX I located the directory)
(- I opened the terminal window. I think I could do get the same result by clicking on the terminal emulator icon and using cd /mnt/sda1/Law/bNgo .... etc) But I'm on bash/command-line-interpreter. And I do this ...
# who am i
bash: who: command not found
# whoami #that's better!
root
# pwd
/mnt/sda1/Law/bNgo/transcript/text/nq-text
# chmod -R 644 *
chmod: changing permissions of 'inq_d02_98-0203.txt': Operation not permitted
chmod: changing permissions of 'inq_d03_98-0204.txt': Operation not permitted
chmod: changing permissions of 'inq_d04_98-0205.txt': Operation not permitted
chmod: changing permissions of 'inq_d05_98-0206.txt': Operation not permitted
So - you see I'm the owner. You can see my working directory. You can see the chmod command - and what bash returns. You see say 3/4/5 (and so on). Just the first few operations on files in the folder 'nq-text'.

MORE INFO
uploaded two snap-shots of the folder above (i.e. one level up the tree = parent) and (part of) the folder content itself. In particular you see the file for inq_d05_*.txt) This is the file that I could not save. You can see I "saved as". I added -n to the name and bingo! Everything is good. So - I edited 'd05' but could not save my work. Or more precisely only by using 'save as'. And (of course) you can see that the time/date is consistent with my description.

Maybe I will solve my problem differently. I can open/edit any file in that directory. I can 'save as' - all OK. So I will do the work, and copy (mv) the edited files to a new directory and try to delete the old. (Except I don't think bash will allow that.)

But - this is my goal - I want to use/understand bash. The chmod command is NOT difficult in concept or syntax. I want to understand WHAT IS GOING ON. This is an intellectual problem. I WANT TO UNDERSTAND.

All the best

Leslie

More info: I'm using uPupBB32. On one machine (desktop box) the OS is on a thumb. Cannot remember installation detail. I have done a LOT of work on the desktop box. Copied a large part of the tree to a thumb drive. Worked on the thumb on a laptop where the OS is uPupBB32 but installed as an ISO-9660 (read only) on a small thumb drive.

Then I returned the working thumb (not used to boot - not the iso-9660 thumb) to the desktop box and (mv'd) some files and dragged and dropped others back onto sda1. This is the disk drive where the working files are found and have been there for a LONG time. It was after this operation that I lost the ability to open/edit/save any of the files in the folder called nq-text. Last week, using the laptop/thumb I opened/edited/saved those files. I suspect the desk-top has some strange idea that it must protect me from myself. To do that (I suspect) it has given some write protection to the files. That's my working hypothesis.

All the best
Attachments
text_folder(1).jpg
(128.39 KiB) Downloaded 15 times
Inquest_folder-(part).jpg
(134.53 KiB) Downloaded 15 times

User avatar
LNSmith
Posts: 126
Joined: Thu 28 Mar 2013, 14:24
Location: A little north fr. Sydney, AU

Cannot save or delete files in a folder

#7 Post by LNSmith »

@semme

I forgot this:
# chattr -i *
After I ran that command: operation is back to normal.
i opened/edited/saved 'day 08'. EXCELLENT

Now I must read about these instructions and understand what was done.
One thousand thanks!
Leslie

Post Reply