DaemonForums  

Go Back   DaemonForums > FreeBSD > FreeBSD General

FreeBSD General Other questions regarding FreeBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 22nd September 2019
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 250
Default files cannot be used because of Invalid argument

Only one issue let to solve before having a perfectly running system.

File names that begin with Chinese and Japanese appear in a console as ?????? and "do not exist." A graphical file manager displays the titles in red in Chinese and Japanese, but cannot be opened, copied to hard-drive or handled in any way because the files are
Code:
Error: Invalid argument
It happens with all file types: .odt, text files, .avi, mp4, etc. It is not a language problem. I copied some music to the hard-drive and two songs with English titles are also invalid arguments. There are no problems with any of the files on OpenBSD, Linux and Windows. I have not yet used a computer at work to change a title and test to see if FreeBSD can see it after the change.

My guess is it is a problem with encoding. If so, the solution might be as simple as installing an additional encoding package. The problem with that is there are many such packages and I have no idea which one I would need.
Reply With Quote
  #2   (View Single Post)  
Old 22nd September 2019
Beastie Beastie is offline
Daemonology student
 
Join Date: Jan 2009
Location: /dev/earth0
Posts: 334
Default

I very rarely need this to warrant using a permanent solution as shown below since for me it's only when accessing external devices. What I usually do is to just set locale when mounting through the root user which will in turn load the appropriate character tables. Also I have no idea if the following will behave properly with East-Asian characters. So take it with a (big) grain of salt.

Without further ado...

/boot/loader.conf:
Code:
libiconv_load="YES"
/etc/rc.conf:
Code:
kiconv_preload="YES"
kiconv_local_charsets="UFT-8"
kiconv_foreign_charsets="UTF-8"
You'll need to install sysutils/kiconvtool.

Try charsets other than UTF-8 too.

HTH
__________________
May the source be with you!
Reply With Quote
  #3   (View Single Post)  
Old 22nd September 2019
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 250
Default

Did not work. No change at all actually.
When I try to manipulate such files with MC the error message is
Code:
Error: Invalid argument (22)
It is a strange situation.
Very few files with English titles are affected.
Chinese and Japanese in titles are not a problem.
Files and directories that begin with Chinese or Japanese and an occasional English title cannot be read.

The experiment of changing a few titles will have to wait until I get back to work in a few days.
Reply With Quote
  #4   (View Single Post)  
Old 27th September 2019
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 250
Default

I did an experiment. I have not yet tried with English titles that the system cannot read, only Chinese.
I used Windows to change the name of four directories from 孝經 , 孫子兵法 , 易經 , 道家經典 to 1, 2, 3, 4. There was no problem copying the directories and their files to the hard-drive. I then changed the names to the Chinese ones and tried to copy them to the USB drive, but they could not be written to the device.
Code:
bocere/USB/My_Transcriptions/孫子兵法: Invalid argument (22)
Failed to move /home/bocere/USB/My_Transcriptions/1 as /home/bocere/USB/My_Transcriptions/孫子兵法
I then tried another experiment.
I changed the names of four photographs to 綿陽501, 綿陽502, 綿陽503, 綿陽504 and they also cannot be copied to the USB drive.

I also noticed that the system cannot do anything with files with names like
1_一-戶.odt
although that is exactly how the system sees the name, including the .odt extension.
Reply With Quote
  #5   (View Single Post)  
Old 27th September 2019
Beastie Beastie is offline
Daemonology student
 
Join Date: Jan 2009
Location: /dev/earth0
Posts: 334
Default

For cases when mounting external devices, you should do what I mentioned in my previous post.

# mount_msdosfs -L en_US.UTF-8 -D UTF-8 ...
I'm not using my computer right now, but I think it's correct. Note that this must be done as root.
__________________
May the source be with you!
Reply With Quote
  #6   (View Single Post)  
Old 27th September 2019
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 250
Default

I must have missed that part of your post.
mount_msdosfs -L en_US.UTF-8 -D UTF-8 works for most of the files. Only a few songs with English titles are still invalid arguments. They are all .wav files, but most of the .wav files are fine. And one directory is still a problem:
Code:
File doesn't exist, or I can't access it: /home/bocere/USB/academic/China/history/1-Ancient_China:Studies_in_Early_Civilisation
Again, a directory with an English title containing photographs. There are thirteen directories with the title format "1-title", "2-title", etc., but only one is a problem. All of them were created at the same time with the same computer (OpenBSD).

The only glitch is that FreeBSD no longer displays the correct characters. For example, 婚禮 shows ups as 婚禮.
For now I consider the problem solved, since only a very small number of files are still affected. That is an inconvenience, not a problem. Displaying unintelligible characters is a bigger inconvenience, but I know what the contents are and can work on solving it at my leisure. Thanks for the help.

Last edited by sacerdos_daemonis; 27th September 2019 at 10:38 PM.
Reply With Quote
  #7   (View Single Post)  
Old 28th September 2019
Beastie Beastie is offline
Daemonology student
 
Join Date: Jan 2009
Location: /dev/earth0
Posts: 334
Default

Quote:
Originally Posted by sacerdos_daemonis View Post
one directory is still a problem:
Code:
File doesn't exist, or I can't access it: /home/bocere/USB/academic/China/history/1-Ancient_China:Studies_in_Early_Civilisation
Again, a directory with an English title containing photographs.
In this case the problem has nothing to do with encoding.

This is while copying from your computer to the external device, right? That's because the colon (":") is a valid filename character for UFS2 but invalid on FAT and NTFS (outside POSIX namespace) since Windows uses it to separate the drive letter from the rest of the path.

Personally, no matter the filesystem I usually automatically replace the colon with " - " (space hyphen space). IMHO it's always better, both technically and aesthetically.
__________________
May the source be with you!
Reply With Quote
  #8   (View Single Post)  
Old 30th September 2019
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 250
Default

Replacing the colons with underscores solved that problem. The two .wav files where fixed by removing commas, which is very strange. The files were originally downloaded many years ago with Windows and were fine over the years with Windows, Linux and OpenBSD, but FreeBSD and newer versions of Windows cannot read them. ????? Computers can be a pain in the arse sometimes.
Reply With Quote
  #9   (View Single Post)  
Old 30th September 2019
Beastie Beastie is offline
Daemonology student
 
Join Date: Jan 2009
Location: /dev/earth0
Posts: 334
Default

Quote:
Originally Posted by sacerdos_daemonis View Post
Replacing the colons with underscores solved that problem. The two .wav files where fixed by removing commas, which is very strange.
It's possible it was not using the usual "," comma (U+002C), but some other form such as the fullwidth comma or even something else.
If for example in Microsoft Word you save a file that has a comma in the first line, Word will use that line (including the comma) as your filename. And you may end up with filenames that are valid in Windows and NTFS/FAT32 and invalid/unreadable when moving the file to other operating systems and file systems. The same is true for many other characters (ellipsis instead of 3 dots, dash instead of hyphen, etc.)

Quote:
Originally Posted by sacerdos_daemonis View Post
The files were originally downloaded many years ago with Windows and were fine over the years with Windows, Linux and OpenBSD, but FreeBSD and newer versions of Windows cannot read them. ????? Computers can be a pain in the arse sometimes.
The real problem is that character encoding itself is a total mess. In the past, many DOS code pages and Windows code pages "standards" were in use. And since old habits die hard, even when Microsoft tried to impose UTF-8/16, everyone practically kept on using the system's locale default encoding.
__________________
May the source be with you!
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
NTFS on OpenBSD, "Invalid argument" Smith OpenBSD General 21 25th August 2014 08:30 AM
mount_cd9660 : Invalid argument .. daemonfowl OpenBSD General 5 23rd February 2012 02:40 PM
cat: [file]: Invalid argument pieterverberne OpenBSD General 6 19th November 2011 02:43 PM
mount-msdosfs /dev/dao: : Invalid argument harold FreeBSD General 5 12th December 2010 06:59 AM
Mount DVD - invalid argument. maxrussell FreeBSD General 17 7th January 2009 08:46 AM


All times are GMT. The time now is 02:12 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick