WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0  (Read 4783 times)

Offline mindshade

  • Newbie
  • *
  • Posts: 4
Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« on: December 29, 2020, 10:02:06 AM »
Hi!

I have been trying to get piCore (ARMv6) setup on my model B Pi (2012 Q4), but got stuck with the getlocale package (because I wanted to get tmux running and it complains about needing a UTF-8 locale).

First I tried piCore-12.0, following all the instructions carefully (resizing fs etc.). Then installed the getlocale package using tce-load -iw getlocale. All looks fine but when i run sudo getlocale.sh no dialog is shown and the dialog command, used by the script, exits with a non zero exit code (no error message is shown).

I then tried the same thing with piCore-9.0.3 and there it works fine. The dialog is shown and I can select the locales to install.

Feeling brave I also tried on piCore-11.0, here the extension getlocale.tcz failed due to install error:

    Downloading: glibc_i18n_locale.tcz
    Connecting to repo.tinycorelinux.net (89.22.99.37:80)
    wget: server returned error: HTTP/1.1 404 Not Found
    md5sum: glibc_i18n_locale.tcz.md5.txt: No such file or directory


It would be nice to get everything running on 12.0 so any suggestions are most welcome.

Cheers

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #1 on: December 29, 2020, 12:44:35 PM »
Hi mindshade
Welcome to the forum

The  dialog.tcz  extension was rebuilt since TC9, so maybe something broke.
Does this return any results:
Code: [Select]
ldd $(which dialog) | grep -i found
You could also try reverting to the previous version of dialog to see if that's the problem. Remove the following from your
tce directory:
Code: [Select]
dialog.tcz
dialog.tcz.md5.txt

Fetch the following and place it in your tce directory:
http://repo.tinycorelinux.net/9.x/armv6/tcz/dialog.tcz

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1243
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #2 on: December 29, 2020, 02:52:03 PM »
dialog has changed over time.  I had made updates for another piCore port.  Can you test this script

I just tested this on piCore12

Install the getlocal package, but then create a script with the below contents, then run it.....

Code: [Select]
#!/bin/sh

. /etc/init.d/tc-functions

checkroot

SFILE=/usr/local/share/getlocale/SUPPORTED
# Override terminal, incase ncurses-terminfo is not loaded
export TERM=xterm
export tempfile=`mktemp`
temp2=`mktemp`

echo "#!/bin/sh" > $temp2
echo "dialog --backtitle \"TinyCore\" \\" >> $temp2
echo "   --title \"LOCALE\" \"\$@\" \\" >> $temp2
echo "--separate-output --checklist \"Choose which locales to support:\" 0 42 20 \\" >> $temp2
for i in `cat $SFILE`; do
   echo "$i \" \" off \\" >> $temp2
done

echo "2> $tempfile" >> $temp2
chmod 755 $temp2

$temp2

[ "$?" -ne 0 ] && exit 1

rm $temp2
clear
echo -e "${BLUE}Press enter to start processing."
read gagme

# Data available. Process.

clear

echo -ne "${BLUE}Now processing... ${CYAN}"

mkdir -p /usr/lib/locale

( for i in `cat $tempfile`; do
   dest=${i%%/*}
   charset=${i##*/}
   locale=${dest%%.*}

   nice -n19 localedef -i $locale -c -f $charset $dest
 done
 echo "$dest" > /tmp/examplelocale
) &

rotdash $!

rm $tempfile

echo -ne "\n${BLUE}Locales installed. Creating extension... ${CYAN}"

( tempdir=`mktemp -d`
   cd $tempdir
   mkdir -p usr/lib/locale
   cp -a /usr/lib/locale/locale-archive usr/lib/locale
   cd ..
   chmod 755 $tempdir

   rm -f mylocale.tcz
   mksquashfs $tempdir mylocale.tcz > /dev/null 2>&1

   rm -rf $tempdir
) &

rotdash $!
TCEDIR=`cat /opt/.tce_dir 2>/dev/null`
readlink /etc/sysconfig/tcedir >/dev/null && TCEDIR=`readlink /etc/sysconfig/tcedir`
OPTIONAL=${TCEDIR}/optional

cp /tmp/mylocale.tcz $OPTIONAL
grep -q "^mylocale.tcz" ${TCEDIR}/onboot.lst 2>/dev/null || echo "mylocale.tcz" >> ${TCEDIR}/onboot.lst
echo "glibc_gconv.tcz" > ${OPTIONAL}/mylocale.tcz.dep
md5sum ${OPTIONAL}/mylocale.tcz > ${OPTIONAL}/mylocale.tcz.md5.txt

echo -e "\n\n${GREEN}Done. The extension is at ${OPTIONAL}/mylocale.tcz and in onboot.lst"
echo "Reboot with lang=xyz (for example lang=`cat /tmp/examplelocale`) to start using this."
echo -e "\n\nPress enter to quit.${NORMAL}"
read gagme

rm -f /tmp/examplelocale

I'm also not entirely sure why there is a extension autoload script.  It requires xterm, which is not a depenancy.
« Last Edit: December 29, 2020, 02:58:56 PM by Paul_123 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #3 on: December 29, 2020, 05:03:37 PM »
Hi Paul_123
... I'm also not entirely sure why there is a extension autoload script.  It requires xterm, which is not a depenancy.
Back in TC4 xterm (aterm) was still part of Xlibs.

According to the  .info  file,  getlocale.tcz  was last updated Jan 15, 2013:
Quote
Current:        2013/01/15 Updated dep for 5.x (back to glibc_gconv)

The first TC5 alpha announcement dated May 30, 2013 states:
Quote
aterm, freetype, imlib2, jpeg and libpng factored out of Xlibs/Xprogs
found here:
http://forum.tinycorelinux.net/index.php/topic,15467.0.html

It appears getlocale.tcz was updated in advance of the TC5 alpha release. Both aterm and lxterminal create a link to xterm. Maybe
other terminal packages do the same, which would explain why the missing dep was never noticed.

Offline mindshade

  • Newbie
  • *
  • Posts: 4
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #4 on: December 30, 2020, 06:41:04 AM »
Thanks Rich and Paul_123!

Code: [Select]
ldd $(which dialog) | grep -i foundReports no missing libraries in piCore12 but if I install the version from 9.x I do get an error for a missing libncursesw.so.6.

When running the script you posted Paul_123, the dialog and everything else works just fine!

I did some more investigation myself before getting the new script version and found that the original getlocale.sh  script can be fixed with a micro tweak. It seems dialog does not expect a trailing slash last on each option line, when using an input file.

This modification fixes the original script:
Code: [Select]
    --- /usr/local/bin/getlocale.sh
    +++ ./getlocale.sh
    @@ -10,7 +10,7 @@
   
     echo "--separate-output --checklist \"Choose which locales to support:\" 0 42 10 " > $temp2
     for i in `cat $SFILE`; do
    - echo "$i \" \" off \\" >> $temp2
    + echo "$i \" \" off" >> $temp2
     done

Cheers

PS. I have noted that the extensions are not versioned individually. Are extension updates always released as part of a new TCL release?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #5 on: December 30, 2020, 09:31:07 AM »
Hi mindshade
... but if I install the version from 9.x I do get an error for a missing libncursesw.so.6. ...
if  ncurses.tcz  was loaded  libncursesw.so.6  should have been found:
http://tinycorelinux.net/12.x/armv6/tcz/ncurses.tcz.list

Are you sure it wasn't looking for  libncursesw.so.5 ?

Code: [Select]
... Are extension updates always released as part of a new TCL release?Not all extensions get updated. Kernel modules do because they need to match the kernel. The compiler and tool chain get
updated too. Many work just fine as is and get copied over.

Offline mindshade

  • Newbie
  • *
  • Posts: 4
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #6 on: December 31, 2020, 06:20:48 AM »
Are you sure it wasn't looking for  libncursesw.so.5 ?

Yes, that is a bit strange, maybe I did not replace the 12 version correctly? What i did was this:

Code: [Select]
  ce
  cd optional
  rm dialog.tcz*
  wget http://repo.tinycorelinux.net/9.x/armv6/tcz/dialog.tcz

  ls -l /tmp/tcloop/dialog/usr/local/bin/dialog
        -rwxr-xr-x    1 tc       staff       181400 Dec 26  2018 /tmp/tcloop/dialog/usr/local/bin/dialog
  sudo reboot
   
  ls -l /tmp/tcloop/dialog/usr/local/bin/dialog
        -rwxr-xr-x    1 root     root        165600 May 28  2016 /tmp/tcloop/dialog/usr/local/bin/dialog
   
  ldd $(which dialog) | grep -i found
  /bin/bash: error while loading shared libraries: libncursesw.so.6: cannot open shared object file: No such file or directory

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11590
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #7 on: December 31, 2020, 07:35:56 AM »
Hi mindshade
Code: [Select]
----- Snip -----

  rm dialog.tcz*

 ----- Snip -----
You removed the dependency (.tcz.dep) file, so  ncurses.tcz  is probably not loaded.

That's why I said:
... Remove the following from your
tce directory:
Code: [Select]
dialog.tcz
dialog.tcz.md5.txt
...

Offline mindshade

  • Newbie
  • *
  • Posts: 4
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #8 on: December 31, 2020, 10:58:11 AM »
Ah, right! Thanks for clearing that up. Still getting the hang of TC.
Cheers

Offline hellork

  • Newbie
  • *
  • Posts: 1
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #9 on: September 28, 2021, 05:36:45 PM »
Tmux has always worked with all versions of piCore right out of the box, if you skip past its goofy locale check with a debugger. No need to mess around with locales.

I merely commented out the if statement that checks for LC_ALL in tmux.c and recompiled.

Runs great. Multiple windows, hotkeys, sessions, editing commands, all of it.

Linux has been fully UTF-8 for ages. I see no valid reason why tmux should still be checking for that.  ::)
« Last Edit: September 28, 2021, 05:53:50 PM by hellork »

Offline mcblack

  • Newbie
  • *
  • Posts: 1
Re: Trouble with getlocale.sh on piCore-11.0 and piCore-12.0
« Reply #10 on: December 22, 2022, 07:46:04 AM »
Hi Paul_123,
Using this script gave me errors in lines 47 and 48 due to hidden characters on that lines after copy and paste

47 done
48 echo "$dest" > /tmp/examplelocale

After removing de spaces in front of done and echo the script is working in picore-13.2 as well.

Again a copy paste error due to hidden characters, as I met in a copied script from the picoreplayer site see:
https://forums.slimdevices.com/showthread.php?107366-picoreplayer-3-11-waveshare-3-5-TFT-jivelite-Raspberry-Pi-2B/page27

Hope this will help others



dialog has changed over time.  I had made updates for another piCore port.  Can you test this script

I just tested this on piCore12

Install the getlocal package, but then create a script with the below contents, then run it.....

Code: [Select]
#!/bin/sh

. /etc/init.d/tc-functions

checkroot

SFILE=/usr/local/share/getlocale/SUPPORTED
# Override terminal, incase ncurses-terminfo is not loaded
export TERM=xterm
export tempfile=`mktemp`
temp2=`mktemp`

echo "#!/bin/sh" > $temp2
echo "dialog --backtitle \"TinyCore\" \\" >> $temp2
echo "   --title \"LOCALE\" \"\$@\" \\" >> $temp2
echo "--separate-output --checklist \"Choose which locales to support:\" 0 42 20 \\" >> $temp2
for i in `cat $SFILE`; do
   echo "$i \" \" off \\" >> $temp2
done

echo "2> $tempfile" >> $temp2
chmod 755 $temp2

$temp2

[ "$?" -ne 0 ] && exit 1

rm $temp2
clear
echo -e "${BLUE}Press enter to start processing."
read gagme

# Data available. Process.

clear

echo -ne "${BLUE}Now processing... ${CYAN}"

mkdir -p /usr/lib/locale

( for i in `cat $tempfile`; do
   dest=${i%%/*}
   charset=${i##*/}
   locale=${dest%%.*}

   nice -n19 localedef -i $locale -c -f $charset $dest
 done
 echo "$dest" > /tmp/examplelocale
) &

rotdash $!

rm $tempfile

echo -ne "\n${BLUE}Locales installed. Creating extension... ${CYAN}"

( tempdir=`mktemp -d`
   cd $tempdir
   mkdir -p usr/lib/locale
   cp -a /usr/lib/locale/locale-archive usr/lib/locale
   cd ..
   chmod 755 $tempdir

   rm -f mylocale.tcz
   mksquashfs $tempdir mylocale.tcz > /dev/null 2>&1

   rm -rf $tempdir
) &

rotdash $!
TCEDIR=`cat /opt/.tce_dir 2>/dev/null`
readlink /etc/sysconfig/tcedir >/dev/null && TCEDIR=`readlink /etc/sysconfig/tcedir`
OPTIONAL=${TCEDIR}/optional

cp /tmp/mylocale.tcz $OPTIONAL
grep -q "^mylocale.tcz" ${TCEDIR}/onboot.lst 2>/dev/null || echo "mylocale.tcz" >> ${TCEDIR}/onboot.lst
echo "glibc_gconv.tcz" > ${OPTIONAL}/mylocale.tcz.dep
md5sum ${OPTIONAL}/mylocale.tcz > ${OPTIONAL}/mylocale.tcz.md5.txt

echo -e "\n\n${GREEN}Done. The extension is at ${OPTIONAL}/mylocale.tcz and in onboot.lst"
echo "Reboot with lang=xyz (for example lang=`cat /tmp/examplelocale`) to start using this."
echo -e "\n\nPress enter to quit.${NORMAL}"
read gagme

rm -f /tmp/examplelocale

I'm also not entirely sure why there is a extension autoload script.  It requires xterm, which is not a depenancy.