5

I wanted to create live bootable USB of gparted via unetbootin. But by mistake I specified the device of USB as a partition of external HDD rather than the USB drive. I deleted all the files that unetbootin created in that HDD partition except one named "ldlinux.sys". I failed to do that via root user also. I'm unable to delete that file. You can please see the screen shot of the file in the HDD below.

ldlinux.sys in external HDD

Please see below for the message I'm getting while trying to delete the file via terminal.

ravi@ravi-Aspire-5315:/media/ravi/MyPassport Linux$ ll
total 92
drwxr-xr-x  12 ravi ravi  4096 Nov  6 11:04 ./
drwxr-x---+  5 root root  4096 Nov  8 09:28 ../
drwxrwxr-x   3 ravi ravi  4096 Jun 24 13:44 15GB_rsync/
drwxrwxr-x   3 ravi ravi  4096 Jun 24 15:13 3.5GB_rsync/
drwxrwxr-x   3 ravi ravi  4096 Jun 24 15:09 7.3GB_rsync/
drwx------   5 ravi ravi  4096 Nov  6 10:24 asus_21.06.2014/
drwxrwxr-x   4 ravi ravi  4096 Sep 24 09:18 asus_camera_27.09.14/
drwxrwxr-x   3 ravi ravi  4096 Oct  4 15:46 Dusherra_mau/
-r--r--r--   1 root root 32768 Nov  6 09:59 ldlinux.sys
drwx------   2 ravi ravi 16384 Apr 24  2014 lost+found/
drwx------   5 ravi ravi  4096 Jun 23 09:43 .Trash-1000/
drwxr-xr-x   3 ravi ravi  4096 Aug  3 12:31 ubuntu13.10_encripted_home_data/
drwxrwxr-x   3 ravi ravi  4096 Jun 24 15:15 ubuntu_home_rsync/

ravi@ravi-Aspire-5315:/media/ravi/MyPassport Linux$ sudo rm ldlinux.sys
rm: cannot remove ‘ldlinux.sys’: Operation not permitted
ravi@ravi-Aspire-5315:/media/ravi/MyPassport Linux$

Then I noticed that the file isn't having executable permission. I felt that was the reason. So, to change the permissions of the file, I used chmod but it didn't happen & the error message was thrown as below.

ravi@ravi-Aspire-5315:/media/ravi/MyPassport Linux$ sudo chmod 777 ldlinux.sys
chmod: changing permissions of ‘ldlinux.sys’: Operation not permitted
ravi@ravi-Aspire-5315:/media/ravi/MyPassport Linux$ sudo chmod 555 ldlinux.sys
chmod: changing permissions of ‘ldlinux.sys’: Operation not permitted
ravi@ravi-Aspire-5315:/media/ravi/MyPassport Linux$ sudo chmod 666 ldlinux.sys
chmod: changing permissions of ‘ldlinux.sys’: Operation not permitted

Why it's happening so & how to delete the file?

  • please can you check whether other files are also had permission to remove file . did you mount filesystem in r/w mode? and which file system did you have in you external hardidisk – mcd Nov 8 '14 at 5:42
  • 1
    What does lsattr ldlinux.sys print? – PM 2Ring Nov 8 '14 at 5:47
8

Could be that:

  • The immutable flag is set. As PM 2Ring pointed out - you can use the lsattr ldlinux.sys command and look for the 'i' flag. If this is the case, a chattr -i should remove it.
  • The filesystem is mounted read only (take at look at the output for the mount command)

Reference:

  • I will try your way & update. It's not mounted read only as I mentioned in Q that I was able to delete all other files except this one. – Ravi Nov 8 '14 at 14:51
  • Yes Criveti, great! Thank you. 'i' flag was set & I removed the way you told. Then I was able to delete the file. – Ravi Nov 9 '14 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.