LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2021, 11:28 AM   #1
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Rep: Reputation: Disabled
What makes a usb stick from Read write -> read only


I am having Endeavorous linux KDE "can't write configuration file" issue.
Hence doing some manual copy of data from from /home to a usb drive.
I created a folder on the usbstick on the problematic laptop and transferred some data over 1 time, then paste it to a desktop.
Plugged the same usbstick the 2nd time on the same problematic laptop, wanted to create another folder to do data transfer again.. but this time it said :
Code:
mkdir: cannot create directory 'folder': Read-only file system
Why did it changes mounting of my usbstick to read-only file system instead of normal Read-write file system ? What made the decision ?

I have to do :
Code:
sudo mount -o remount,rw '/run/media/user/usbstick'
so that it changes mounting to Read-write file system .
Only after this i can create a new folder in the usbstick.

My question is why it changes ? What causes it to change ? is this the same thing that causes my current issue "can't write configuration file" ?

Thanks
 
Old 05-24-2021, 11:52 AM   #2
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,147
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
What are you using to mount that usb device? Are you un-mounting it before you remove it? Does user have full mount permissions. Are you mounting as user or root? What kind of permissions does user have? Are you using an auto mounter?

Quote:
My question is why it changes ? What causes it to change ?
How do you have your box setup? Are you pulling it out without umounting it, sticking it in again and getting a new device node which is read only?
 
1 members found this post helpful.
Old 05-24-2021, 02:16 PM   #3
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,557

Rep: Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498Reputation: 2498
A common reason for that error is a corrupt filesystem which can sometimes be repaired. First thing we would need to know is what filesystem is on the usb drive. Also answering all the questions in post 2 will provide helpful information.

In your other thread, you indicate that you were having problems editing a configuration file with vi, When you edited it the first time, did you close the file properly?
 
2 members found this post helpful.
Old 05-24-2021, 04:08 PM   #4
jamison20000e
Senior Member
 
Registered: Nov 2005
Location: ...uncanny valley... infinity\1975; (randomly born:) Milwaukee, WI, US( + travel,) Earth&Mars (I wish,) END BORDER$!◣◢┌∩┐ Fe26-E,e...
Distribution: any GPL that work on freest-HW; has been KDE, CLI, Novena-SBC but open.. http://goo.gl/NqgqJx &c ;-)
Posts: 4,888
Blog Entries: 2

Rep: Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567Reputation: 1567
Code:
man chmod
 
Old 05-25-2021, 10:42 AM   #5
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Salix
Posts: 6,147

Rep: Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314Reputation: 2314
My practice here has always been to
1. start with a Linux format on the usb stick — less likely to cause trouble
2. if it goes read-only, use fsck
3. if it does it again, reformat
4. if it happens for the third time, dump it.
 
Old 05-25-2021, 12:42 PM   #6
sofasurfer
Member
 
Registered: Oct 2003
Posts: 252

Rep: Reputation: 20
Well, you learn something new every day. My mp3 player, when inserted into the pc, sometimes does not allow deletion of files or does not allow transfer of files. So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
 
Old 05-25-2021, 12:57 PM   #7
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,665
Blog Entries: 19

Rep: Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490Reputation: 4490
Quote:
Originally Posted by sofasurfer View Post
Well, you learn something new every day. My mp3 player, when inserted into the pc, sometimes does not allow deletion of files or does not allow transfer of files. So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
Yes, of course. The kernel saves up disk writes in its buffers to do when it's not particularly busy. If you don't unmount a plug-in device properly, it gets out of sync.

Last edited by hazel; 05-25-2021 at 12:59 PM.
 
Old 05-25-2021, 01:15 PM   #8
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,147
Blog Entries: 6

Rep: Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834Reputation: 1834
Quote:
So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
Depends on the file system how much trouble you'll have doing that.

Even on a windows machine, with a external ntfs volume, you are suppose to click on that icon in the taskbar, "remove drive safely", before you pull it out, or it'll do it's checkdisk the next time you stick it in. And windows can fix it's own file system just fine. On a linux machine you need to make sure it is unmounted before removing, or it won't mount again. And ntfs-tools probably won't help.

Not something that you should do on purpose but, you can pull a FAT or EXT4 drive out in the middle of a write and it won't hurt it, other than the file that you were copying will be corrupt. But you'll have a hung mount. You'll probably need to do a force umount. That is what mount and df are for.
 
Old 05-27-2021, 04:41 PM   #9
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
What are you using to mount that usb device? Are you un-mounting it before you remove it? Does user have full mount permissions. Are you mounting as user or root? What kind of permissions does user have? Are you using an auto mounter?


How do you have your box setup? Are you pulling it out without umounting it, sticking it in again and getting a new device node which is read only?
I plugged the usb stick in, it auto mounted (default). I don't need to mount it.
I do not unmount usb stick, just when it is no doing data transfer, just unplug it. I always do that, never a problem before. I also do that to my manjaro kde desktop, no problem what so ever.
 
Old 05-27-2021, 04:43 PM   #10
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by yancek View Post
A common reason for that error is a corrupt filesystem which can sometimes be repaired. First thing we would need to know is what filesystem is on the usb drive. Also answering all the questions in post 2 will provide helpful information.

In your other thread, you indicate that you were having problems editing a configuration file with vi, When you edited it the first time, did you close the file properly?
Yes, i always close vim properly (for the sake of my data ). That computer is seriously wrong.. somewhat..
The filesystem on the usb drive that i asked in this thread is actually liveusb from Endeavorous. I was borrowing the space to do 1 file transfer from problematic Endeavourous laptop to manjaro desktop. Never a problem on Manjaro.. but on the laptop with Endeavorous os.. the problem occurs.
 
Old 05-27-2021, 04:45 PM   #11
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by DavidMcCann View Post
My practice here has always been to
1. start with a Linux format on the usb stick — less likely to cause trouble
2. if it goes read-only, use fsck
3. if it does it again, reformat
4. if it happens for the third time, dump it.
I see, that would indicates usbstick got issue.. but my usbstick is fine on manjaro Desktop.. it only occurs on endeavorous laptop.
 
Old 05-27-2021, 04:47 PM   #12
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sofasurfer View Post
Well, you learn something new every day. My mp3 player, when inserted into the pc, sometimes does not allow deletion of files or does not allow transfer of files. So are you saying the reason is because I always just yank it out when I'm done with it? I need to unmount it first or use the eject/remove button?
I don't think you need to unmount it before unplug, if this is a must than there is no proud of saying linux is better than window os. I unplug straight away from manjaro desktop, no problem what so ever.. just make sure you stop doing data transfer for a short while, at least.
 
Old 05-27-2021, 04:53 PM   #13
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by teckk View Post
Depends on the file system how much trouble you'll have doing that.

Even on a windows machine, with a external ntfs volume, you are suppose to click on that icon in the taskbar, "remove drive safely", before you pull it out, or it'll do it's checkdisk the next time you stick it in. And windows can fix it's own file system just fine. On a linux machine you need to make sure it is unmounted before removing, or it won't mount again. And ntfs-tools probably won't help.

Not something that you should do on purpose but, you can pull a FAT or EXT4 drive out in the middle of a write and it won't hurt it, other than the file that you were copying will be corrupt. But you'll have a hung mount. You'll probably need to do a force umount. That is what mount and df are for.
Oh really ? I have always unplug usb stick while not writing. never problem before.. it still mount each time. I tried many time on the same usb stick, it mounts fine.. ya.. eject before unplug is always the best practice.
 
Old 05-27-2021, 10:30 PM   #14
computersavvy
Senior Member
 
Registered: Aug 2016
Posts: 3,345

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by andrewysk View Post
I plugged the usb stick in, it auto mounted (default). I don't need to mount it.
I do not unmount usb stick, just when it is no doing data transfer, just unplug it. I always do that, never a problem before. I also do that to my manjaro kde desktop, no problem what so ever.
With the current level of USB drive handling, IF the drive is synced and not actively involved in writing data you can usually unplug it without actively dismounting it and systemd will handle that for you. If there is activity on the drive, or even if you have the file manager with a folder open on that device and you unplug it problems can occur. That is why the file manager has an icon to dismount those devices before you remove then. Better to take action and prevent problems than to try and repair what gets barfed up.

And you said the problem occurs on the endeavorous laptop. That is a different OS than the manjaro desktop so you have to expect the software may not be the same and it apparently does not handle unplugging a USB without dismounting it the same way.

Learn the differences and practice what works on the most restrictive one always; so you don't forget and cause yourself problems.

Last edited by computersavvy; 05-27-2021 at 10:36 PM.
 
Old 05-27-2021, 10:48 PM   #15
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
This is strangely similar to this:
https://www.linuxquestions.org/quest...514/page2.html
I wonder if the "hard drive" in that other thread is really the same USB stick?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to enable a Hard Disk to read/write to a USB device but disable the USB device to read/write to the hard disk without user permission? ce309 Linux - General 33 05-22-2019 04:30 PM
Mounting a bootable USB stick makes the stick non-bootable PeterSteele Red Hat 6 03-15-2013 01:44 PM
can not write to usb stick, only read Vensan Linux - Hardware 3 02-28-2007 06:54 PM
Can't WRITE to USB stick, Mount OK NO WRITE! ClericPreston Linux - Newbie 4 12-04-2004 10:43 AM
Open office read only, K-write read/write mode lwtvh Linux - Newbie 1 07-19-2003 11:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration