deleting files with read only permission

Discussion in 'Acer Aspire One' started by Mash, Aug 17, 2008.

  1. Mash

    Mash

    Joined:
    Aug 13, 2008
    Messages:
    10
    Likes Received:
    0
    Hi,
    I am new to linux.
    I managed to install the programs I like. (thunderbird vlc etc) and I searched the forum on my problem but i could not find anything.

    My only problem is: that after I upgraded my internal memory using the storage expansion (8GB SD)and put some video files and mp3 files from my external hdd on my One. I removed the expansion storage by mistake and when i put it back they dont show. So i figured from the small diagram that appears when you click on expand my storage that either I should put the disk in the 5in1 slot and an other sd disk in storage expansion but this is not an option because I only have one sd card. now if i would delete the files on my sd I could expend the storage again. But how to format? deleting the files seemed the best option so I tried to delete a file and I get an error message that i do not have the permission to delete read only files.

    I tried in the terminal using the "rm" command but this is my answer:
    [root@localhost Videos]# rm Species....1717alan..avi
    rm: cannot remove `Species....1717alan..avi': Read-only file system.

    so that does not work.
    I would be very happy if someone could help me.
    Mash
     
    Mash, Aug 17, 2008
    #1
  2. Mash

    Ace_Rimmer

    Joined:
    Aug 16, 2008
    Messages:
    103
    Likes Received:
    0
    Mash --

    Give this a try -- press Alt - F2 and in the box enter the following:

    sudo thunar

    DON'T check "run in terminal."

    Now you will have the file manager, but with root (superuser) privileges, and you can delete anything you want.

    BE VERY CAREFUL BECAUSE YOU ARE NOW USING A "WEAPON OF MASS DESTRUCTION"! You can delete anything you want, but you can also delete anything you don't want to delete, too.

    Please let us know if you need more help beyond this.
     
    Ace_Rimmer, Aug 17, 2008
    #2
  3. Mash

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    That error is saying the file system is read-only, not the file. Some SD cards have a write-protect tab and if this is enabled the file-system will only be mounted read-only, so first check to see if you haven't accidentally enabled the write-protect tab. One of my SD cards has a loose tab which keep getting switched whenever I put it into a slot, so I had to tape it in place, I'm just mentioning it in case it is happening to you.
     
    retsaw, Aug 18, 2008
    #3
  4. Mash

    georgeB

    Joined:
    Aug 17, 2008
    Messages:
    28
    Likes Received:
    0
    Ace_rimmer: Thanks for the "sudo thunar" command. It just me out greatly! gB-)
     
    georgeB, Aug 18, 2008
    #4
  5. Mash

    Mash

    Joined:
    Aug 13, 2008
    Messages:
    10
    Likes Received:
    0
    thank you for your advice.
    I tried sudo thunar. It worked on the build in disk. But not on my sd card. After that I tried the switch, which keeps in place any way i turn it.
    So I figured it must be something else. I looked at the permissions, on my sd disk show and they show owner root with read only access. Is there any way to format an sd card in linpus?

    thanks again
    Mash
     
    Mash, Aug 18, 2008
    #5
  6. Mash

    Ace_Rimmer

    Joined:
    Aug 16, 2008
    Messages:
    103
    Likes Received:
    0
    Hmmm....

    I'm hoping one of the more experienced folks can jump in and help with this.

    mkfs can be used to format a drive, but I really don't have much experience with it.

    chmod can be used to change permissions. I'm afraid I'm not experienced enough that I could advise you safely at this point.

    Anyone else have any ideas?
     
    Ace_Rimmer, Aug 18, 2008
    #6
  7. Mash

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    Have you tried the card in another computer?

    Another thing you could try is running a filesystem check and repair of the sd card. I presume the card is formatted with the FAT filesystem, if that is the case you will first have to install dosfstools, "sudo yum install dosfstools", then once you have done that, with the SD card unmounted but still in the slot run "sudo dosfsck -af /dev/mmcblk0p1" and that should repair any errors in the filesystem, but be warned this command may make changes and you could potentially lose any data that is on the card, I mean you probably won't but I'm not going to guarantee that so make sure you have copies of anything important on the card.

    If you don't have any luck with that, next maybe we should see how the card is being mounted. When the card is mounted, type in the following commands and post the output here: "mount" and in case mount is giving the wrong information "cat /proc/mounts"

    Another command I'd like you to run immediately after inserting the card is "dmesg | tail"
     
    retsaw, Aug 19, 2008
    #7
  8. Mash

    Mash

    Joined:
    Aug 13, 2008
    Messages:
    10
    Likes Received:
    0
    Thank you for your replies Ace_rimmer and retsaw.
    Yesterday I tried to use the card on my university computer but there in windowsXP the explorer did not respond and I didn't have the permissions to format drives.

    So back home I tried the instructions from Retsaw. I had no luck with the dosf tool.
    so here it comes the data from the mount command:

    [user@localhost disk]$ mount
    /dev/sda1 on / type ext2 (rw)
    none on /dev/pts type devpts (rw,gid=5,mode=620)
    none on /dev/shm type tmpfs (rw)
    none on /sys type sysfs (rw)
    none on /mnt/home type aufs (rw,si=d6bf51c0,xino=/home/user/.aufs.xino,create=mfs,dirs=/home/user=rw)
    /dev/mmcblk3p1 on /media/disk type vfat (ro,nosuid,nodev,uhelper=hal,utf8,shortname=winnt,uid=500)
    [user@localhost disk]$
    [user@localhost disk]$ cat /proc/mounts
    rootfs / rootfs rw 0 0
    /dev/root.old /initrd ext2 rw 0 0
    /dev/root / ext2 rw,noatime 0 0
    proc /proc proc rw 0 0
    tmpfs /dev tmpfs rw 0 0
    tmpfs /tmp tmpfs rw 0 0
    none /dev/pts devpts rw 0 0
    none /dev/shm tmpfs rw 0 0
    none /sys sysfs rw 0 0
    none /mnt/home aufs rw,si=d6bf51c0,xino=/home/user/.aufs.xino,create=mfs,dirs=/home/user=rw 0 0
    /dev/mmcblk3p1 /media/disk vfat ro,nosuid,nodev,uid=500,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=winnt,utf8 0 0
    [user@localhost disk]$

    it said this, when i mounted the card new and ran "dmesg|tail":

    [user@localhost disk]$ dmesg|tail
    FAT: Filesystem panic (dev mmcblk4p1)
    fat_get_cluster: invalid cluster chain (i_pos 0)
    FAT: Filesystem panic (dev mmcblk4p1)
    fat_get_cluster: invalid cluster chain (i_pos 0)
    FAT: Filesystem panic (dev mmcblk4p1)
    fat_get_cluster: invalid cluster chain (i_pos 0)
    FAT: Filesystem panic (dev mmcblk4p1)
    fat_get_cluster: invalid cluster chain (i_pos 0)
    FAT: Filesystem panic (dev mmcblk4p1)
    fat_get_cluster: invalid cluster chain (i_pos 0)
    [user@localhost disk]$

    let me guess panic is not good?
    I hope you can help me. thanks again.
    Mash
     
    Mash, Aug 19, 2008
    #8
  9. Mash

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    When you say you had problems with dosfstools, what were these problems? Maybe the problem you had was related to my erroneous assumtion the the SD card slot would be /dev/mmcblk0 where I now realise that the number can change. From the output of your commands you can see the device relating to the filesystem when you issued the mount command was /dev/mmcblk3p1, and after you removed and reinserted the card it was /dev/mmcblk4p1, so the dosfsck command should be altered to reflect the actual device of the filesystem to be repaired.

    The mount command tells me that the filesystem is definitely mounted read-only, and from the dmesg output it appears to be a problem related to the filesystem, so I suspect a successful run of dosfsck would fix it, failing that you could format it with "sudo mkdosfs -F32 /dev/mmcblkXp1" where the X is the number of the device for the SD card slot (I think Acer really should have added a easy way to format SD cards in this OS). Now that I think about it, you can use GParted for checking and formatted the SD card, maybe you want to install gparted with "sudo yum install gparted", then you can run it with "sudo gparted" or find it in the System section of your desktop menu (if you have enabled that). I just naturally defaulted to using the command line for these things because I'm used to it and rarely use GParted.

    What I was actually looking for in the dmesg output was lines similar to
    Code:
    mmc0: new SDHC card at address d555
    mmcblk3: mmc0:d555 SU08G 7977472KiB 
     mmcblk3: p1
    If the the hardware is telling Linux the write-protect tab is set then the middle line will have "ro" at the end of it, so I wanted to check whether or not this was the case. You can still check this if you want by either running the dmesg command on its own and scrolling up until you find what you are looking for or filter with grep like so "dmesg|grep mmc0 -A1"
     
    retsaw, Aug 19, 2008
    #9
  10. Mash

    Mash

    Joined:
    Aug 13, 2008
    Messages:
    10
    Likes Received:
    0
    thank you for your post retsaw. I am happy to learn new things. I tried running dosfstools again.

    [user@localhost ~]$ sudo dosfsck -af /dev/mmcblk0p1
    dosfsck 2.11, 12 Mar 2005, FAT32, LFN
    open /dev/mmcblk0p1:Read-only file system

    next I installed Gparted but in gparted it says it cant read my filesystem and that it might be damaged.

    [user@localhost ~]$ sudo gparted
    ======================
    libparted : 1.8.6
    ======================
    Unable to open /dev/mmcblk1 read-write (Read-only file system). /dev/mmcblk1 has been opened read-only.
    Unable to open /dev/mmcblk1 read-write (Read-only file system). /dev/mmcblk1 has been opened read-only.
    Unable to open /dev/mmcblk1 read-write (Read-only file system). /dev/mmcblk1 has been opened read-only.
    Unable to open /dev/mmcblk1 read-write (Read-only file system). /dev/mmcblk1 has been opened read-only.

    so I tried your command line

    [user@localhost ~]$ sudo mkdosfs -F32 /dev/mmcblk1p1
    mkdosfs 2.11 (12 Mar 2005)
    mkdosfs: /dev/mmcblk1p1 contains a mounted file system.
    [user@localhost ~]$ sudo mkdosfs -F32 /dev/mmcblk1p1
    mkdosfs 2.11 (12 Mar 2005)
    mkdosfs: unable to open /dev/mmcblk1p1

    now what did I do wrong? thank you again for helping me out.
    mash
     
    Mash, Aug 20, 2008
    #10
  11. Mash

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    What you didn't do was unmount the SD card filesystem before running those commands, or did you? The first mkdosfs command complains about the filesystem being mounted but the second one doesn't, was it unmounted when you tried that command the second time.

    Maybe you can also try "dmesg|grep mmc0 -A1" I mentioned at the end of my last post and see what the output is, if the reader is reporting that the card is read-only it would explain the problems. If you get the chance it might be useful trying the card in another computer, that would help isolate if the problem is with the card itself or something to do with your Aspire One.
     
    retsaw, Aug 21, 2008
    #11
  12. Mash

    Mash

    Joined:
    Aug 13, 2008
    Messages:
    10
    Likes Received:
    0
    Ha! I did it.
    When I ran your last command dmesg and it gave (ro) I thought he maybe in my hurry I did not check the swich correctly.
    So I unlocked my sd card and read

    mmc0: SDHCI at 0x37300100 irq 16 DMA
    PCI: Enabling device 0000:01:00.3 (0000 -> 0002)
    --
    mmc0: card 0002 removed
    mmc0: new SDHC card at address 0002
    mmcblk2: mmc0:0002 SD 8046592KiB
    mmcblk2: p1

    and thought hm lets try gparted again. first try at formating no luck but after i unmounted my card i could format it.
    Although I feel a little stupid :roll: I am very greatful for your time. But I learned lots.
     
    Mash, Aug 21, 2008
    #12
  13. Mash

    retsaw

    Joined:
    Aug 1, 2008
    Messages:
    133
    Likes Received:
    0
    So I was right with what I first said. :roll:

    Anyway, I'm glad I could help and that you learned something from it. :)
     
    retsaw, Aug 21, 2008
    #13
  14. Mash

    jonnyl

    Joined:
    Oct 12, 2008
    Messages:
    3
    Likes Received:
    0
    I was copying from my cameras SD card and it froze whilst doing it. I didn't really have a choice but to turn of the computer, which then must have corrupted the file. As a result, my SD expansion card in the left slot became locked to read only (only in the left slot, strangely it worked perfectly in the right slot!) and my xD card from my camera got locked too (but not all the time, occasionally it worked fine). I used your sudo dosfsck -af .... commands to fix both cards and now they work perfectly again. Thanks so much for your help!!
     
    jonnyl, Aug 19, 2009
    #14
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.