• We did not send an email asking for donations - please read this post.

Simple copy from external USB hdd to Ubuntu PC does not work (cp: cannot create regular file)

mike_linux

Active Member
Joined
Nov 20, 2020
Messages
112
Reaction score
61
Credits
1,064
Hi folks, hope you're doing fine.
I have a very basic problem and didn't remember how I had fixed this in past. I have mounted my extern western digital hdd and want to copy a bookmark to my ubuntu py now. The problem is that I get this error message while I execute the following:

[email protected]:/media/mikeubnt-pc/Data/System/Backup/Google Chrome$ cp /media/mikeubnt-pc/WINDOWS_MAC/BACKUP_MY/Chrome/bookmarks_8_23_22.html /media/mikeubnt-pc/Data/System/Backup/Google\ Chrome
I have tried this with the last / and without but I don't remember how I had fixed this to copy a simple file from an external hdd to my ubuntu 20.04.LTS pc.

ERROR
cp: cannot create regular file '/media/mikeubnt-pc/Data/System/Backup/Google Chrome/bookmarks_8_23_22.html': No such file or directory

What exactly it the problem here? What I have done wrong?

When I do this by drag-and-drop I get also the same error
Error opening file “/media/mikeubnt-pc/Data/System/Backup/Google Chrome/bookmarks_8_23_22.html”: No such file or directory

It is such a simple problem and I can't remember what I had done to fix this issue :(.
 


KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
7,382
Reaction score
6,371
Credits
59,826
I have an idea of what it is. Can you try the command again, this time using sudo?

Or, graphically, you can open your file manager as root and try it that way.

This is usually a permissions issue, you need read permissions. A quick and dirty method to fix that would be sudo chown <user>:<user> /media/<user>/<disk>

So, something like:

Code:
sudo chown mikeubnt-pc:mikeubnt-pc /media/mikeubnt-pc/Data/
 
OP
mike_linux

mike_linux

Active Member
Joined
Nov 20, 2020
Messages
112
Reaction score
61
Credits
1,064
I have an idea of what it is. Can you try the command again, this time using sudo?

Or, graphically, you can open your file manager as root and try it that way.

This is usually a permissions issue, you need read permissions. A quick and dirty method to fix that would be sudo chown <user>:<user> /media/<user>/<disk>

So, something like:

Code:
sudo chown mikeubnt-pc:mikeubnt-pc /media/mikeubnt-pc/Data/
Hello, after issuing the command with sudo provileges from my USB device
$ sudo chown mikeubnt-pc:mikeubnt-pc /media/mikeubnt-pc/Data/
$ sudo cp bookmarks_8_23_22.html /media/mikeubnt-pc/Data/System/Backup/Google\ Chrome/
outputs me this error
$ cp: cannot create regular file '/media/mikeubnt-pc/Data/System/Backup/Google Chrome/bookmarks_8_23_22.html': Read-only file system
 

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
7,382
Reaction score
6,371
Credits
59,826
Whelp, it wasn't what I expected and when external drives say 'read only file system' it often means they've failed. Not always, but quite frequently.

I'm assuming the external device doesn't have a lock switch or, if it does, you've checked that. Google 'linux read only file system' for some possible solutions.
 
OP
mike_linux

mike_linux

Active Member
Joined
Nov 20, 2020
Messages
112
Reaction score
61
Credits
1,064
Whelp, it wasn't what I expected and when external drives say 'read only file system' it often means they've failed. Not always, but quite frequently.

I'm assuming the external device doesn't have a lock switch or, if it does, you've checked that. Google 'linux read only file system' for some possible solutions.
No it doesn't have a lock switch. I have checked this.
 

captain-sensible

Well-Known Member
Joined
Jun 14, 2019
Messages
2,913
Reaction score
1,970
Credits
18,126
what happens if you put ' ' around Google Chrome

eg my external toshiba :

Code:
[[email protected]:~/Desktop]$ rsync -avu  trycatch.txt   /run/media/andrew/TOSHIBA EXT
sending incremental file list
rsync: [sender] link_stat "/run/media/andrew/TOSHIBA" failed: No such file or directory (2)
trycatch.txt

sent 641 bytes  received 35 bytes  1,352.00 bytes/sec
total size is 526  speedup is 0.78
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1327) [sender=v3.2.5]
[[email protected]:~/Desktop][23]$ rsync -avu  trycatch.txt   /run/media/andrew/'TOSHIBA EXT'/         (08-27 19:39)
sending incremental file list
trycatch.txt

sent 641 bytes  received 35 bytes  1,352.00 bytes/sec
total size is 526  speedup is 0.78
[[email protected]:~/Desktop]$                                                                         (08-27 19:39)
 
OP
mike_linux

mike_linux

Active Member
Joined
Nov 20, 2020
Messages
112
Reaction score
61
Credits
1,064
Guys, I have encountered that if I want to copy the files from my external USB drive to my Ubuntu hard disk this works now (don't know why this suddenly happens), but if I attempt to copy the files to my intern second hdd which is an ntfs one this does not work. Do I need to use different copy commands for ntfs?
 

wizardfromoz

Administrator
Staff member
Gold Supporter
Joined
Apr 30, 2017
Messages
7,790
Reaction score
6,615
Credits
28,677
OP
mike_linux

mike_linux

Active Member
Joined
Nov 20, 2020
Messages
112
Reaction score
61
Credits
1,064
Mike, take a look at what I have just posted here

https://www.linux.org/threads/file-...-but-chrome-sucks-in-ubuntu.41678/post-168819

and see if GNOME disks can help you with the mounting options. If it does, you can likely use the same method with your NTFS drive.

You will just have to have any external drives plugged in at the time.

HTH

Wizard
Hi @wizardfromoz I have tried your solution but cannot still copy any file from my ubuntu hdd to my ntfs hdd. After applying everything mentioned in the above post of yours, I restarted the pc and tried to copy a test.txt file to my ntfs hdd, but doesn't worked (/mnt/2CCCE1B2CCE1770C/System/ is my ntfs hdd)
$ cp test_copy.txt /mnt/2CCCE1B2CCE1770C/System/
cp: cannot create regular file '/mnt/2CCCE1B2CCE1770C/System/test_copy.txt': Read-only file system
 
OP
mike_linux

mike_linux

Active Member
Joined
Nov 20, 2020
Messages
112
Reaction score
61
Credits
1,064
Guys, finally I managed to get full r-w access to the ntfs partition from ubuntu. The steps I followed are these ones described in the following:
  1. Installed an implementation of the MS NTFS file system with read/write support by issuing sudo apt install ntfs-3g
  2. Then I executed the ntfsfix command shown by this tutorial
  3. After that I opened nautilus with sudo rights i.e. sudo nautilus otherwise you will not be able to change the permissions on the ntfs system.
  4. Restarted the pc and wola now I am able to gain full r-w access on the ntfs file system.
Trying these commands based on this post didn't fix it
sudo mount -o remount,rw /partition/identifier /mount/point
 

bob466

Well-Known Member
Joined
Oct 22, 2020
Messages
652
Reaction score
461
Credits
4,784
Maybe it's Ubuntu that's the problem.
confused0006.gif
All my External HDDs are NTFS and I've never had this happen.

I once had a Portable HDD fail to mount...since it was NTFS...I plugged it in to a windwoes computer and in mounted...when I plugged it back in to Linux Mint...it mounted and it still working now.
confused0009.gif
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top