Score:0

Why won't Ubuntu 20.04.3 LTS copy con.c to external USB drive?

vn flag
Rob

I upgraded from Ubuntu 18.04 LTS to Ubuntu 20.04.3 LTS on my desktop on 11-12-2021.
I compiled con.c on the new gcc version 9.3.0-17 compiler and it gave me warnings on
using sprintf(). I converted all the sprintf()'s warnings to snprintf()'s and got a clean compile.
I copied the folder that contained con.c and 8 other .c files and their .o files to an external
USB drive. It copied all but the con.c and con.o. files. There is no error when copying these
files to another folder on the Internal hard drive.

When trying to copy con.c to a USB drive, it gives me these error messages:

Files (Nautilus) gives me this error message:

Error while copying "con.c"

There was an error copying the file into /media/rob/TOSHIBA EXT/000/c/projects/ai/builds/40-49

Invalid filename

Xfe file manager gives me this error message:

An error has occurred during the copy file operation!

The terminal produces this:

rob@rob-MS-7721:~$ sudo cp /home/rob/c/con.c "/media/rob/TOSHIBA EXT/000/c/projects/ai/builds/40-49/con.c" cp: cannot create regular file '/media/rob/TOSHIBA EXT/000/c/projects/ai/builds/40-49/con.c': Invalid argument

rob@rob-MS-7721:~$ sudo cp /home/rob/c/util.c "/media/rob/TOSHIBA EXT/000/c/projects/ai/builds/40-49/util.c"

As you can see it will copy util.c but will not copy con.c to the USB drive.

I have used Google to searched for answers on this but there seems to be very little out there
on Ubuntu 20.04 outside of installation, upgrade and how to mount a USB drive etc.

I got around this by renaming con.c to con0.c and it copied fine. But, it will not let me rename
con0.c to con.c on the USB drive.

Ubuntu 18.04 copied this file without error.

Can anyone tell me if con.* has become a protected file name or if there is this a bug
in Ubuntu 20.04 that is producing this error?

waltinator avatar
it flag
Explore your Mount/Read/Write/Execute problems with `https://github.com/waltinator/pathlld`, a `bash` script to show the permissions, mount options along the path to an object or objects.
Rob avatar
vn flag
Rob
I don't have a clue as to how bash scripts work or how to edit them if I need to. I copied the script into: "011-pathlld-bash-script.sh". I ran "/media/rob/TOSHIBA EXT/011-pathlld-bash-script.sh" from the base of the USB drive and from the Internal Hard drive and both gave me: "Nothing to do". I added -h for help and got the same output?
Rob avatar
vn flag
Rob
@waltinator Please read my comment above. I forgot to add your name to it.
hr flag
That's a Windows filesystem limitation I think (`con` is a reserved device name, even with a "dot extension" - see for example [What are reserved filenames for various platforms?](https://stackoverflow.com/a/122412/4440445)
Rob avatar
vn flag
Rob
@steeldriver Xfe tells me the File system is: "fuseblk". Disks tells me it's Partition type is "NTFS/exFAT/HPFS" and contents: "NTFS". I had to use "ntfsfix" in both Ubuntu 18.04 and now in 20.04 to get the USB disks to mount. And I know NTFS is a Windows filesystem setup. What I don't get is why would "con.c" be accepted in Ubuntu 18.04 and not in 20.04? I use "con.c" in almost every "C" program. I'll use rename con.c to con0.c to copy it to the USB drive rather than change it in all those programs.
waltinator avatar
it flag
NTFS filesystems are Windows filesystems, and enforce Windows restrictions. Windows fears `con*`.
Rob avatar
vn flag
Rob
@waltinator Old haunts have lasting memories. I thought I got rid of the crappy Windows system entirely when I joyfully dumped Windows 10. Now you've shown it's still haunting me.
waltinator avatar
it flag
Using NTFS in a Linux-only environment risks problems like this, and problems with hardlinks/permission for no benefit. Backup your data, compare your data and backup, unmount (`umount`) the partition, use `gparted` to delete the NTFS partition and create an `ext4` partition/filesystem. Mount it, and restore your backup. This comment is insufficiently detailed to work from. Do more study.
Rob avatar
vn flag
Rob
@waltinator I like your suggestion. I just don't quite understand what all this will do. Will following your suggestion make all the data in my /home/ directory inaccessible? If so, should the backup be a mirror image of my /home/ directory? Also, if that is so, wouldn't I be better off doing a complete new installation of Ubuntu 20.04 from my ISO disk? The upgrade to 20.04 did not go smoothly and I would like to have a clean Operating System when all is said and done.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.