nikp123 / minecraft-plymouth-theme

MIT License
27 stars 1 forks source link

Top line displayed in wrong font when booting #2

Closed Lxtharia closed 2 months ago

Lxtharia commented 6 months ago

Hey! I finally got around to try this and I love it. (A pity my arch boots so fast, i only get to look at it for max 2 seconds).

I have an issue where, when I boot, the line that says "Booting OS" is not displayed in the Minecraft font, the messages below are though.

Thanks!

Lxtharia commented 6 months ago

Ok, the problem was, that there was no /usr/lib/plymouth/label.so but rather two seperate ones:

/usr/lib/plymouth/label-pango.so 
/usr/lib/plymouth/label-freetype.so

so I changed it in dracut/99-minecraft-plymouth.conf and it worked!

Lxtharia commented 5 months ago

Sorry for re-opening, I'm trying it with mkinitcpio and the problem's there again.

I ran the ./install.sh and put this into my /etc/mkinitcpio.conf:

FILES=( /usr/lib/plymouth/label-freetype.so
    /usr/lib/plymouth/label-pango.so
    /usr/lib/plymouth/text.so
    /usr/share/fonts/OTF/Minecraft.otf
    /etc/fonts/fonts.conf
    /etc/fonts/conf.d/00-minecraft.conf
)

Which should do the same as the dracut drop-in, but for mkinitcpio.

When running lsinitrd /boot/initramfs-linux.img i also find all of the files got included.

It's also very weird that it's only the "Booting OS" text that's in the wrong font.

nikp123 commented 5 months ago

It's also very weird that it's only the "Booting OS" text that's in the wrong font.

Could not replicate after 1 hour of trying, both texts seem to use the wrong font. The problem is that Plymouth doesn't really offer a neat way of controlling the fonts and text.

Lxtharia commented 5 months ago

So its never explicitly set? I may try it later, but what if I just remove all other fonts? Maybe it'll display nothing or crash, but might be worth the shot

nikp123 commented 5 months ago

So its never explicitly set? I may try it later, but what if I just remove all other fonts? Maybe it'll display nothing or crash, but might be worth the shot

It is, but the method relies on fontconfig actually figuring out WHAT font file I want to set as opposed to setting it directly, like you would in SDL_ttf for example.

For reference see this

Lxtharia commented 5 months ago

I figured out how to get debug messages. It looks like it fails to find one shared object because this happens before a newroot is set. I tried setting ShowDelay=2 in the config and it seems the font gets loaded then. Only for a split second though, because the OS boots too quickly :(

Is there a way to set the font just after this newroot? Or put the font somewhere it is always found?

Thanks.

...
129   │ 00:00:04.475 ../plymouth-24.004.60/src/libply-splash-core/ply-boot-splash.c: adding 1920x1080 pixel display
 130   │ 00:00:04.475 ../plymouth-24.004.60/src/libply-splash-core/ply-device-manage: activating renderers
 131   │ 00:00:04.475 ../plymouth-24.004.60/src/libply-splash-core/ply-boot-splash.c: showing splash screen
 132   │ 00:00:04.475 ../plymouth-24.004.60/src/plugins/splash/script/plugin.c:434:s: starting boot animation
 133   │ 00:00:04.475 ../plymouth-24.004.60/src/plugins/splash/script/plugin.c:303:s: parsing script file
 134   │ 00:00:04.479 ../plymouth-24.004.60/src/plugins/splash/script/plugin.c:280:s: executing script file
 135   │ 00:00:04.489 ../plymouth-24.004.60/src/libply/ply-utils.c:549:ply_open_modu: Could not load module "/usr/lib/plymouth/label-pango.so": libcairo.so.2: cannot open 
       │ shared object file: No such file or directory
 136   │ 00:00:04.492 ../plymouth-24.004.60/src/plugins/controls/label-freetype/plug: Text 'Booting OS' has dimensions 211x55
 137   │ 00:00:04.492 ../plymouth-24.004.60/src/libply-splash-graphics/ply-label.c:8: Unloading label control plugin
 138   │ 00:00:04.492 ../plymouth-24.004.60/src/libply/ply-utils.c:549:ply_open_modu: Could not load module "/usr/lib/plymouth/label-pango.so": libcairo.so.2: cannot open 
       │ shared object file: No such file or directory
 139   │ 00:00:04.493 ../plymouth-24.004.60/src/plugins/controls/label-freetype/plug: Text 'Booting OS' has dimensions 211x55
 140   │ 00:00:04.493 ../plymouth-24.004.60/src/libply-splash-graphics/ply-label.c:8: Unloading label control plugin
 141   │ 00:00:04.499 ../plymouth-24.004.60/src/plugins/renderers/drm/plugin.c:749:p: Creating buffer for 1920x1080 renderer head
 142   │ 00:00:04.499 ../plymouth-24.004.60/src/plugins/renderers/drm/plugin.c:253:p: returning 1920x1080 buffer with stride 7680
 143   │ 00:00:04.499 ../plymouth-24.004.60/src/plugins/renderers/drm/plugin.c:757:p: Mapping buffer for 1920x1080 renderer head
 144   │ 00:00:04.499 ../plymouth-24.004.60/src/plugins/renderers/drm/plugin.c:938:a: taking master and scanning out
 145   │ 00:00:04.502 ../plymouth-24.004.60/src/plugins/renderers/drm/plugin.c:711:p: Setting scan out buffer of 1920x1080 head to our buffer
 146   │ 00:00:04.536 ../plymouth-24.004.60/src/plugins/renderers/drm/plugin.c:1758:: Needed to reset scan out buffer on 1920x1080 renderer head
 147   │ 00:00:04.536 ../plymouth-24.004.60/src/libply-splash-core/ply-boot-splash.c: (this is an initial showing)
 148   │ 00:00:04.536 ../plymouth-24.004.60/src/libply-splash-core/ply-boot-splash.c: Pausing 1 already added displays
 149   │ 00:00:04.536 ../plymouth-24.004.60/src/libply-splash-core/ply-device-manage: activating keyboards
 150   │ 00:00:04.536 ../plymouth-24.004.60/src/libply-splash-core/ply-keyboard.c:37: Watching for keyboard input from renderer
 151   │ 00:00:04.537 ../plymouth-24.004.60/src/libply/ply-event-loop.c:1142:ply_eve: freeing destination (1, 0x5f50168ad310, 0x5f50168b0ea0) of fd 13
 152   │ 00:00:04.700 ../plymouth-24.004.60/src/ply-boot-server.c:395:print_connecti: connection is from pid 319 (plymouth update-root-fs --new-root-dir=/new_root) with pa
       │ rent pid 1 (/usr/bin/ash /init splash)
 153   │ 00:00:04.700 ../plymouth-24.004.60/src/ply-boot-server.c:714:ply_boot_conne: got newroot request
 154   │ 00:00:04.700 ../plymouth-24.004.60/src/main.c:668:on_newroot               : new root mounted at "/new_root", switching to it
 155   │ 00:00:04.700 ../plymouth-24.004.60/src/main.c:711:get_cache_file_for_mode  : returning cache file '/var/lib/plymouth/boot-duration'
 156   │ 00:00:04.702 ../plymouth-24.004.60/src/libply/ply-event-loop.c:1142:ply_eve: freeing destination (1, 0x5f50168ad310, 0x5f50168b0ea0) of fd 13
 157   │ 00:00:05.357 ../plymouth-24.004.60/src/ply-boot-server.c:391:print_connecti: connection is from toplevel init process (/sbin/init splash)
 158   │ 00:00:05.357 ../plymouth-24.004.60/src/ply-boot-server.c:446:ply_boot_conne: got update request
 159   │ 00:00:05.357 ../plymouth-24.004.60/src/main.c:192:on_update                : updating status to '-.mount'
 160   │ 00:00:05.436 ../plymouth-24.004.60/src/plugins/controls/label-pango/plugin.: Text '-.mount' has dimensions 176x42
 161   │ 00:00:05.436 ../plymouth-24.004.60/src/plugins/controls/label-pango/plugin.: Text '-.mount' has dimensions 176x42
 162   │ 00:00:05.436 ../plymouth-24.004.60/src/plugins/controls/label-pango/plugin.: Text '-.mount' has dimensions 176x42
 163   │ 00:00:05.437 ../plymouth-24.004.60/src/libply-splash-graphics/ply-label.c:8: Unloading label control plugin
 164   │ 00:00:05.437 ../plymouth-24.004.60/src/plugins/controls/label-pango/plugin.: Text '-.mount' has dimensions 176x42
 165   │ 00:00:05.437 ../plymouth-24.004.60/src/plugins/controls/label-pango/plugin.: Text '-.mount' has dimensions 176x42
 166   │ 00:00:05.437 ../plymouth-24.004.60/src/plugins/controls/label-pango/plugin.: Text '-.mount' has dimensions 176x42
 167   │ 00:00:05.437 ../plymouth-24.004.60/src/libply-splash-graphics/ply-label.c:8: Unloading label control plugin...
...
nikp123 commented 5 months ago

@Lxtharia where is the log displayed, in the console=whatever or in some log file?

nikp123 commented 5 months ago

I tried setting ShowDelay=2 in the config and it seems the font gets loaded then. Only for a split second though, because the OS boots too quickly :(

My guess that it's still missing a so file which fails to load before root gets mounted, after which when it gets mounted it's able to load in the font just fine when you add the delay.

Lxtharia commented 5 months ago

The logs are in /var/log/plymouth-debug.log when booting with plymouth.debug kernel parameters.

It seems this is a packaging issue on Arch (which I use btw) after I found this upstream issue: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/248

nikp123 commented 5 months ago

It seems this is a packaging issue on Arch (which I use btw) after I found this upstream issue: https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/248

Well in that case I am fine with a workaround, because I don't want to needlessly bog down people with doing things the right way and waiting for upstream to wake from its slumber (people have more important stuff to do).

nikp123 commented 5 months ago

But sadly distrobox broke again so I couldn't test this anymore without reinstalling arch on bare metal.

nikp123 commented 4 months ago

@Lxtharia Hey do you mind checking again, I did some changes in the meantime

Reasoning: The problem I noticed is that the plymouth script does math in floating points and I needed to round that when scaling the UI, for obvious reasons, that is implemented now.

Lxtharia commented 4 months ago

Hi! Tried the new version, but didn't solve my problem. For some reason, 135 │ 00:00:04.489 ../plymouth-24.004.60/src/libply/ply-utils.c:549:ply_open_modu: Could not load module "/usr/lib/plymouth/label-pango.so": libcairo.so.2: cannot open shared object file: No such file or directory still occurs even though that library should be in the initramfs.

I am on...

Distro: Arch Linux
Kernel version: 6.9.7-arch1-1
Plymouth version: 24.004.60-7

...btw, some files differ on my system (like label-pango and label-freetype instead of only label).

I seem to have found one workaround though: Changing

    text = create_text(message, 0.5, 0.5 - text_height_adj()); 

to

    fun newroot_callback() {
        text = create_text(message, 0.5, 0.5 - text_height_adj()); 
    }

    Plymouth.SetRootMountedFunction(newroot_callback);

will draw the title only after the root is set (to whatever root it is, i don't really know whats happening there).

Drawback is that there is this tiny delay before it shows up.

Lxtharia commented 4 months ago

Also: Thanks for your effort. I could also try to do it with dracut again, but I'm actually busy with exams rn, so might take some weeks. (Procrastination will make me do it sooner probably)

nikp123 commented 4 months ago

Hi! Tried the new version, but didn't solve my problem. For some reason, 135 │ 00:00:04.489 ../plymouth-24.004.60/src/libply/ply-utils.c:549:ply_open_modu: Could not load module "/usr/lib/plymouth/label-pango.so": libcairo.so.2: cannot open shared object file: No such file or directory still occurs even though that library should be in the initramfs.

Will need to keep an eye out on that, I have a week of exams left before im able to work on this again (just like you). Thanks for providing me pointers.

I also learned that plymouth has a theme C API so I could use that instead, probably even implement the new chunk display boot screen 😎

Lxtharia commented 4 months ago

I also learned that plymouth has a theme C API so I could use that instead, probably even implement the new chunk display boot screen 😎

oh hell yeah! Crossed my mind before but it just seemed way too complicated, still, am exited! Maybe I'll also look into making a minecraft SDDM theme to completely lay out the way up to the desktop with minecraft experience.

Good luck with exams!

SilasPeters commented 4 months ago

Just want to say that I love your enthusiasm for the whole Minecraft startup experience. Keep up the work and good luck for the exams!

SilasPeters commented 3 months ago

I do not remember upgrading this package, but the font works now on boot! I believe this is related to me changing my HOOKS order in /etc/mkinitcpio.conf.

I changed the order of the following hooks, while testing out some stuff:

HOOKS=(base udev plymouth resume autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck)

I do not know the previous ordering.

Anyhow, my guess is that moving the modconf more to the left made it work. Don't have a VM right now to test this.

Lxtharia commented 2 months ago

Hello again, I actually found the solution to my initial problem, which was: In a newer version of plymouth (which i had because I use Arch btw) label.so was replaced with the two other .sos, so I just downgraded the package from 24.004.60 to 23.360.11 and it worked!

(In the end my other PC boots even faster meaning I can only enjoy the theme for only half a second now, sad):

nikp123 commented 2 months ago

Hello again, I actually found the solution to my initial problem, which was: In a newer version of plymouth (which i had because I use Arch btw) label.so was replaced with the two other .sos, so I just downgraded the package from 24.004.60 to 23.360.11 and it worked!

Can you include those two .so files instead, I don't think this solution will last you that long due to binary incompatibility.

Lxtharia commented 2 months ago

Ok, yes, it also works with label-pango.so and label-freetype.so, so everything actually works like it's supposed to :)