You are not logged in.

#1 2022-08-21 08:56:52

return114514
Member
Registered: 2022-08-21
Posts: 3

What happened with grub?

When the locale is c.UTF-8
Generating grub configuration file ...
Found theme: /boot/grub/themes/tela/theme.txt
Found linux image: /boot/vmlinuz-linux
Found initrd image: /boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img amd-ucode.img initramfs-linux-fallback.img
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done
When the locale is zh_CN.UTF-8:
正在生成 grub 配置文件 ...
找到主题:/boot/grub/themes/tela/theme.txt
找到 Linux 镜像:/boot/vmlinuz-linux
找到 initrd 镜像:/boot/intel-ucode.img /boot/amd-ucode.img /boot/initramfs-linux.img
Found fallback initrd image(s) in /boot:  intel-ucode.img amd-ucode.img initramfs-linux-fallback.img
警告: os-prober 将运行以检测其它可引导分区。将使用 os-prober 的输出,以检测分区中可引导的二进制文件,并为其创建新的启动项。
/usr/share/grub/grub-mkconfig_lib: 第 237 行:printf: “$”:无效格式字符

Offline

#2 2022-08-21 11:08:15

sydneyj
Member
From: Texas, US
Registered: 2018-10-20
Posts: 22

Re: What happened with grub?

You now have two posts on this same subject, neither of which contains any information, or makes any sense.  First, please do not cross post.  Second, you will benefit by reading this:

http://www.catb.org/~esr/faqs/smart-questions.html

Offline

#3 2022-08-21 13:37:33

seth
Member
Registered: 2012-09-03
Posts: 51,319

Re: What happened with grub?

There's an error when running grub-mkconfig at the zh_CN.UTF-8 locale

China wrote:

/usr/share/grub/grub-mkconfig_lib: 第 237 行:printf: “$”:无效格式字符

Google translate wrote:

/usr/share/grub/grub-mkconfig_lib: line 237: printf: "$": invalid format character

printf "$(gettext "$gettext_printf_format")" "$@"

So "$gettext_printf_format" probably holds some bogus nonsense in chinese, but the variable is passed into the function.

@return114514, edit /usr/bin/grub-mkconfig and add "set -x", then re-run grub-mkconfig
This will print a shit-ton of text and hopefully reveal what's passed in there.
The problem is most likely some zh_CN.UTF-8 locale string (ie. the translator probably replaced "%d" or so with some chinese glyph without understanding that this is not text, but a format instruction that was not meant to be touched)

Offline

#4 2022-08-23 06:51:32

Firestar
Member
From: Beijing, China
Registered: 2021-07-19
Posts: 80
Website

Re: What happened with grub?

Create the locale.conf(5) file, and set the LANG variable accordingly:

/etc/locale.conf

LANG=en_US.UTF-8

**Here you should only use en_US.UTF-8 在 /etc/locale.conf 里面你只能用 en_US.UTF-8**

See this: https://zhuanlan.zhihu.com/p/138951848

The problem is that when you boot into your new system, the locale is English, I changed it to Chinese in KDE settings manually. KDE settings is at `~/.config/plasma-localerc`

问题就是,一开始装机的时候你只能用英语,我后面是在KDE系统设置里面自己改的。或者直接在 ~/.config/plasma-localerc 里面添加

[Formats]
LANG=en_US.UTF-8

[Translations]
LANGUAGE=zh_CN:en_US

Last edited by Firestar (2022-08-23 07:13:25)


Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.

Offline

#5 2022-08-23 07:15:05

seth
Member
Registered: 2012-09-03
Posts: 51,319

Re: What happened with grub?

Thanks for chiming in.

So, the idea was that there's perhaps a bug in the zh_CN localization files, I don't think that using en_US is really an option for the OP.

Firestar wrote:

**Here you should only use en_US.UTF-8**

See this: https://zhuanlan.zhihu.com/p/138951848

Does that guide somehow address that and says something to the effect of "you must use the english locale because the chinese one is broken"?
I'd rather address that.
Translators of all nations tend to make this kind of mistake where they start to "interpret" "foo %d" as "bar %[latin d]" or something because they're often more linguists than programmers and don't understand that "%d" is a control character.
But because the error message is too generic - we somehow end up w/ "printf "%$", but w/o context it's gonna be hard to figure what is being mistranslated there.

Offline

#6 2022-08-25 17:28:08

Firestar
Member
From: Beijing, China
Registered: 2021-07-19
Posts: 80
Website

Re: What happened with grub?

Does that guide somehow address that and says something to the effect of "you must use the english locale because the chinese one is broken"?

No. but this article downwards also said that not recommended to set /etc/locale.conf to Chinese as this causes tty crashes.

https://zhuanlan.zhihu.com/p/385251617?utm_id=0

设置locale全局配置文件/etc/locale.conf ,但不推荐在该文件中配置全局的中文locale,会导致 tty 乱码。

Last edited by Firestar (2022-08-25 17:28:36)


Write programs that do one thing and do it well.
Write programs to work together.
Write programs to handle text streams, because that is a universal interface.

Offline

#7 2022-08-25 18:37:34

seth
Member
Registered: 2012-09-03
Posts: 51,319

Re: What happened with grub?

Google says the page says

Set the locale global configuration file /etc/locale.conf, but it is not recommended to configure the global Chinese locale in this file, which will cause garbled tty characters.

which, ok - I don't see anything supporting CJK in https://adeverteuil.github.io/linux-con … reenshots/

But: that's different from the problem at hand.
You can still have zh_CN in some VTE because they all (ok, all relevant) support UTF-8 and so do enough fonts you can get for them.

The problem here seems to be that a translator injected "%$" into a message object, in a string that's used as control sequence for a printf call.
That's not supposed to be there and needs to be fixed in the translation.

Offline

#8 2022-08-25 19:06:55

progandy
Member
Registered: 2012-05-17
Posts: 5,199

Re: What happened with grub?

seth wrote:

The problem here seems to be that a translator injected "%$" into a message object, in a string that's used as control sequence for a printf call.
That's not supposed to be there and needs to be fixed in the translation.

The grub translations are provided by the Translation Project.
return114514 (or someone else), you can report the translation bug here: https://translationproject.org/team/zh_CN.html

I found a few strings like these that have to be fixed:

msgid "Register %x of %x:%02x.%x is %x\n"
msgstr "%2$x:%3$02x.%4$x 的寄存器 %1$x 是 %5$x\n"

There are some valid $ signs for variables in the file as well, so blindly removing them won't work.

Last edited by progandy (2022-08-25 19:07:30)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#9 2022-08-31 05:08:17

puzzle
Member
Registered: 2019-03-09
Posts: 10

Re: What happened with grub?

https://bbs.archlinuxcn.org/viewtopic.p … 813#p52813

It seems to be a translation problem

Offline

#10 2022-08-31 08:41:01

Greatpi
Member
Registered: 2022-08-27
Posts: 10

Re: What happened with grub?

Chinese?

Offline

Board footer

Powered by FluxBB