Tiny Core Linux

General TC => General TC Talk => Topic started by: kirin-rex on April 01, 2020, 10:29:41 PM

Title: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 01, 2020, 10:29:41 PM
Background:  A few years ago, a coworker set up our ancient Japanese Epson laptops with tiny core so that I didn't have to throw them away.  Unfortunately, he no longer works here, and I'm not very knowledgeable about Tiny Core (but I'm learning!)

So I'd like, if possible, to fix the keyboard settings and be able to read Japanese writing on the internet.

PROBLEM 1
Japanese Epson Laptop with JIS keyboard can type, but some symbols are in typical English qwerty locations instead of JIS locations (example:  shift+2 is @ instead of ").

Followed directions in FAQ:
http://tinycorelinux.net/faq.html#keyboard

Installed keymaps.tcz.
Tried code:
Code: [Select]
sudo loadkmap < /usr/share/kmap/qwerty/fi-latin9.kmapbut it doesn't change the symbols

Not a big deal, since I can figure it out, but it would be convenient if I could get it to work.
Is there something else I'm not doing?

I tried adding above code (minus sudo) to bootlocal.sh, but again, no change.  Not broken, but could be better.

Problem 2
I want to be able to read Japanese on the internet.  I don't care if I can't type Japanese (though that would be convenient, it's not 100% necessary), but being able to view Japanese characters on websites would be useful.

I downloaded some fonts from google fonts.

I want to put them in /usr/share/fonts (I'm using a file manager called SpaceFM as a gui for file folders to copy paste), but it tells me I don't have permission.

I'm not sure how to proceed.  Advice?

Thanks in advance.
Title: Re: Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 01, 2020, 11:17:02 PM
Okay, solved the font problem.  I kept getting permission denied, so finally, following advice I found in a ubuntu forum, I used the following code in terminal to manually transfer a ttf file:

Code: [Select]
sude cp -f /sdb1/MPLUS1p-Medium.ttf /usr/share/fonts/
That successfully transferred the file without error, and I can now look at web pages in Japanese using the laptop.

So, 1 problem down.  Now, if I can just figure out the keyboard.  Again, not a huge deal.  We can adapt, but it would be nice ...
Title: Re: Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 02, 2020, 05:45:42 AM
Hi kirin-rex
Load  kmaps.tcz.
You must be in the console to change the keyboard. If you are in the GUI, click on the  Exit  icon and select  Exit to Prompt.
Then execute the following command:
Code: [Select]
sudo loadkmap < /usr/share/kmap/qwerty/fi-latin9.kmap
startx
If the keyboard is to your liking, click on the  Editor  icon and add the following line to your  /opt/bootsync.sh  file:
Code: [Select]
loadkmap < /usr/share/kmap/qwerty/fi-latin9.kmap
The  fi-latin9.kmap  is a  Finnish  keymap.  Maybe you meant  jp106.map ?

    [EDIT]: Changed bootlocal.sh to bootsync.sh  as per reply #12. Rich
Title: Re: Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 05, 2020, 10:51:43 PM
Thank you!  Yes, I was using the jp106.kmap.  So at least I had that part right.  Where I was going wrong was that I was trying to enter the first sudo code using terminal.  Once I exited to prompt, it worked!

Thank you again, Rich!  I really appreciate it!  I'm a teacher in Japan, and we're trying to get computers up and ready to use Google's G-Suite and Google Classroom ... but with COVID-19, students may end up studying at home, anyway!

Thanks for your help!
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 06, 2020, 06:31:22 AM
Hi kirin-rex
You are welcome. Glad to hear you got it working. I've marked you original post as solved.
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 06, 2020, 07:19:40 PM
Oops, still having problems with the kmap.  For some reason, when I reboot, the keyboard is still acting like a US qwerty keyboard.  But when I exit to prompt, even if I don't type anything, the JP keyboard works properly.  When I "startx" to go back to the desktop, it still works.  But if I reboot, it goes back to US QWERTY.

1.  So, I went to "run program" and entered kmaps.tcz and clicked the box that said "run with sudo"

2.  I then clicked on EXIT and selected EXIT TO PROMPT.

3.  Typed the following code:
Code: [Select]
sudo loadkmap < /usr/share/kmap/qwerty/jp106.kmap
I tested it to make sure it works by typing:  "
I erased " and typed
Code: [Select]
startx
4.  I opened bootlocal.sh and typed:
Code: [Select]
loadkmap < /usr/share/kmap/qwerty/jp106.kmapSaved the file.

Rebooted.

Typing SHIFT+2 should (on a jp106 keyboard) give me ", but instead it gives me @ like a US QWERTY.

However, if I click EXIT and EXIT TO PROMPT, I can type " with no problem.  If I erase " and type STARTX, I can still type " with no problem.  But if I reboot, I get @ for SHIFT+2.

Any idea what I'm doing wrong?
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 06, 2020, 07:33:27 PM
Hi kirin-rex
Please post the results of the following commands:
Code: [Select]
showbootcodes
cat /opt/,filetool.lst
cat /opt/bootlocal.sh
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 06, 2020, 09:53:17 PM
I'm unable to copy-paste directly from the tiny-core laptop because it's telling me this forum's login isn't safe (for some reason), so I wrote it down and will type it here.  I'll try to be careful not to make too many mistakes.

Code: [Select]
showbootcodesgave me
Code: [Select]
BOOT_IMAGE=/tce/boot/vmlinuz quiet waitusb=5:UUID="7fb56286-fb74-42a4-8761-c9f348a0e2d1" tce=UUID="7fb56286-fb74-42a4-8761-c9f348a0e2d1" initrd=/tce/boot/core.gz
Code: [Select]
cat /opt/.filetool.lstgave me
Code: [Select]
opt
home

Code: [Select]
cat /opt/bootlocal.shgave me
Code: [Select]
#!/bin/sh
# put other system startup commands here
ifconfig wlan0 up
wpa_supplicant -iwlan0 -c/home/tc/wifi.cfg -Dwext -B
udhcpc -i wlan0 -t 10
loadkmap < /usr/share/kmap/qwerty/jp106.kmap

    [EDIT]: Fixed typo. Changed loadmap to loadkmap.  Rich
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 06, 2020, 10:00:36 PM
Hi kirin-rex
Is  kmaps.tcz  installed onboot? Is it listed in your  tce/onboot.lst  file?
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 06, 2020, 10:39:53 PM
Yes, I installed "on boot" and it is listed in the onboot.lst
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 07, 2020, 06:25:27 AM
Hi kirin-rex
I don't see anything wrong in your setup. You said:
... However, if I click EXIT and EXIT TO PROMPT, I can type " with no problem.  If I erase " and type STARTX, I can still type " with no problem.  ...
So, if I understand you correctly, just doing  Exit to Prompt  and then  startx  fixes it?

Try moving the command:
Code: [Select]
loadkmap < /usr/share/kmap/qwerty/jp106.kmapfrom  bootlocal.sh  to  bootsync.sh.

It should appear before the line that calls  bootlocal.sh , like this:
Code: [Select]
loadkmap < /usr/share/kmap/qwerty/jp106.kmap
/opt/bootlocal.sh &

    [EDIT]: Fixed typo. Changed loadmap to loadkmap.  Rich
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 09, 2020, 01:55:37 AM
Thank you, Rich!  You're awesome!

That fixed the problem.

I added the lines in bootsync.sh.

It gave me a little trouble because it didn't want to save.  Same permission trouble I had before the first time I wanted to edit bootlocal.  Luckily, I wrote all the steps on that thread.

I used
Code: [Select]
sudo chown tc:staff /opt/bootsync.sh
sudo chmod 775 /opt/bootsync.sh

That let me save.  Had a minor problem with a misspelling (wrote "loadmap" instead of "loadkmap"), but it was easily found and fixed.

Keyboard seems properly working now.  Just have to add it to the other 13 laptops, but seems to be good!

Thank you again for your outstanding help.
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 09, 2020, 05:32:41 AM
Hi kirin-rex
I just want to add some notes here in case someone else runs into the same problem.

Here's what I think was happening:

1. bootsync.sh is launched almost at the end of tc-config.
2. bootsync.sh runs synchronously in the foreground effectively blocking tc-config from running until it completes.
3. The last line in bootsync.sh launches bootlocal.sh to run in the background. This allows tc-config to continue
   executing in parallel with bootlocal.sh.
4. tc-config executes its last few commands and returns control to /etc/inittab.
5. /etc/inittab logs in the user which executes the contents ~/.profile which launches X
6. We now have a potential race between bootlocal.sh completing and X starting.


The  "loadkmap < /usr/share/kmap/qwerty/jp106.kmap"  command needs to run before X starts. Placing it in bootlocal.sh does
not guarantee that. Placing it in bootsync.sh does.

Maybe the FAQ page should be updated to recommend using bootsync.sh instead of bootlocal.sh for this function?

... Had a minor problem with a misspelling (wrote "loadmap" instead of "loadkmap"), but it was easily found and fixed. ...
That was my fault. I copy/pasted your misspelling from another post. :)  I will fix those posts.
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: curaga on April 09, 2020, 09:36:49 AM
FAQ updated, thanks.
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 14, 2020, 05:55:33 PM
Back to the font problem.
tldr version:  Put a new font in /usr/share/fonts/ but it disappears on reboot.


I want to be able to see Japanese characters when using firefox, so I attempted to install a Japanese font.
Most advice I've seen says to simply copy the font to /usr/share/fonts/, but I got a "permission denied", so I used terminal:
Code: [Select]
sudo cp -f /sdb1/MPLUS1p-Medium.ttf /usr/share/fonts/
That worked ... but on reboot the font is gone again.

Some advice says put is in /usr/local/share/fonts/ but I don't have a fonts folder in /user/local/share.
Other advice says maybe put it in ~/.fonts ... but I don't know where that is.

I'm thinking there's something really simply I need to do to keep the font in the /usr/share/fonts folder.
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 14, 2020, 06:47:08 PM
Hi kirin-rex
Back to the font problem.
tldr version:  Put a new font in /usr/share/fonts/ but it disappears on reboot. ...
Most Linux distros have a persistent file system (/bin, /dev, /etc, /home, /lib, ..... ). When packages get installed, their files get copied
to  /usr (/usr/local/bin, /usr/local/lib, ..... ).

Tinycore is different. The file system gets created from scratch every time you boot. This diagram may help:
http://distro.ibiblio.org/tinycorelinux/architecture.html

You could add this to your  /opt/filetool.lst  file:
Code: [Select]
usr/share/fonts/MPLUS1p-Medium.ttfThen run a backup.

Quote
Some advice says put is in /usr/local/share/fonts/ ...
That's the preferred location, unless an application is hard coded to look in  /usr/share/fonts/.

Quote
Other advice says maybe put it in ~/.fonts ... but I don't know where that is.
When you see  ~/  its referring to your home directory (/home/tc/).  A filename that begins with a period (.font) is a hidden file.

Consider turning the font file into an extension:
Code: [Select]
tce-load -wi squashfs-tools
mkdir -p pkg/usr/local/share/fonts
cp /sdb1/MPLUS1p-Medium.ttf pkg/usr/local/share/fonts/
mksquashfs pkg MPLUS1p-Medium.tcz
cp MPLUS1p-Medium.tcz /etc/sysconfig/tcedir/optional
echo MPLUS1p-Medium.tcz >> /etc/sysconfig/tcedir/onboot.lst
tce-load -i MPLUS1p-Medium.tcz
Your fonts should now be installed and will also get loaded when you boot.

If your fonts need to be in  /usr/share/fonts/  then adjust the lines containing  pkg/usr/local/share/fonts  accordingly.
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: kirin-rex on April 14, 2020, 07:29:41 PM
Thank you so much, Rich!  That worked perfectly!
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 14, 2020, 07:43:38 PM
Hi kirin-rex
You are welcome. Glad to hear it worked out.
Title: Re: [SOLVED] Japanese Epson Laptop - keyboard help and Japanese font help
Post by: Rich on April 14, 2020, 07:56:44 PM
Hi kirin-rex
By converting the font file into an extension, you can now copy it to your other laptops.