Custom plymouth theme, passwork prompt don't work

Hi ! I want to “copy-paste” my Archlinux Plymouth theme to Fedora.

On Arch everything work perfectly BUT on fedora, plymouth doesn’t display the password prompt when I need to unlock LUKS.

This is my custom_theme.script (i’m sorry if its hard to read, i found it in a old repo, and didn’t spend many time on it bc i just wanted something to work ^^‘’) :

// Screen size
screen.w = Window.GetWidth(0);
screen.h = Window.GetHeight(0);
screen.half.w = Window.GetWidth(0) / 2;
screen.half.h = Window.GetHeight(0) / 2;

// Question prompt
question = null;
answer = null;

// Message
message = null;

// Password prompt
bullets = null;
prompt = null;
bullet.image = Image.Text("*", 1, 1, 1);

// Flow
state.status = "play";
state.time = 0.0;

//--------------------------------- Refresh (Logo animation) --------------------------

# cycle through all images
for (i = 0; i < 479; i++)
  flyingman_image[i] = Image("progress-" + i + ".png");
  #flyingman_image[i].Scale(1920,1080);
flyingman_sprite = Sprite();

# set image position
flyingman_sprite.SetX(Window.GetX() + (Window.GetWidth(0) / 2 - flyingman_image[0].GetWidth() / 2)); # Place images in the center
flyingman_sprite.SetY(Window.GetY() + (Window.GetHeight(0) / 2 - flyingman_image[0].GetHeight() / 2));
#flyingman_sprite.SetX(0);
#flyingman_sprite.SetY(0);

progress = 0;

fun refresh_callback ()
  {
      flyingman_sprite.SetImage(flyingman_image[Math.Int(progress) % 479]);
      progress++;
  }

Plymouth.SetRefreshFunction (refresh_callback);

//------------------------------------- Password prompt -------------------------------
fun DisplayQuestionCallback(prompt, entry) {
    question = null;
    answer = null;

    if (entry == "")
        entry = "<answer>";

    question.image = Image.Text(prompt, 1, 1, 1);
    question.sprite = Sprite(question.image);
    question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
    question.sprite.SetY(screen.h - 4 * question.image.GetHeight());

    answer.image = Image.Text(entry, 1, 1, 1);
    answer.sprite = Sprite(answer.image);
    answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
    answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
}
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);

//------------------------------------- Password prompt -------------------------------
fun DisplayPasswordCallback(nil, bulletCount) {
    state.status = "pause";
    totalWidth = bulletCount * bullet.image.GetWidth();
    startPos = screen.half.w - totalWidth / 2;

    prompt.image = Image.Text("Saisissez votre Code PIN", 1, 1, 1);
    prompt.sprite = Sprite(prompt.image);
    prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
    prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());

    // Clear all bullets (user might hit backspace)
    bullets = null;
    for (i = 0; i < bulletCount; i++) {
        bullets[i].sprite = Sprite(bullet.image);
        bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
        bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
    }
}
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);

//--------------------------- Normal display (unset all text) ----------------------
fun DisplayNormalCallback() {
    state.status = "play";
    bullets = null;
    prompt = null;
    message = null;
    question = null;
    answer = null;
}
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);

//----------------------------------------- Message --------------------------------
fun MessageCallback(text) {
    message.image = Image.Text(text, 1, 1, 1);
    message.sprite = Sprite(message.image);
    message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
}
Plymouth.SetMessageFunction(MessageCallback);

Its the same script i use for ArchLinux

EDIT : My initrd is built with my custom plymouth theme (i’m creating a .efi binary with the --uefi flag with dracut, i am not using GRUB—my EFI firmware boots directly into the .efi binary.).

Is it the same version of plymouth in Fedora as arch?

First to check plymouth theme :
plymouth-set-default-theme
will display name of default theme
after that when you know name do :
sudo plymouth-set-default-theme <name_of_default theme> -R
Note that the -R flag will rebuild your initrd, and the next time you reboot your system, you will see the theme in action.

The OP has the theme installed, but it is not working as required.

1 Like

My idea is to rebuild initrd for custom theme and see how is going

But it must be in the initramfs already right?

1 Like

EDIT (i forget to answer the question sorry) : no, dracut version is different than arch, fedora have a custom version of dracut. dracut 103-3.fc41 for fedora and dracut 106 for Arch

@ledeni, i think i wasn’t clear :

  • My custom Plymouth theme is correctly set in /etc/plymouth/plymouthd.conf
root@fedora:~# cat /etc/plymouth/plymouthd.conf 
# Administrator customizations go in this file
[Daemon]
Theme=custom_theme
  • My initrd is built with my custom plymouth theme (to be 100% honest and clear : i’m creating a .efi binary with the --uefi flag with dracut, i am not using GRUB—my EFI firmware boots directly into the .efi binary.).
  • When I boot, I can see my theme, but when a password is required, the password prompt does not appear.
  • Everything I did, I originally tested on Arch Linux (where everything works). Theoretically, it should work here as well. That’s why I’m asking for help—maybe Fedora has modified something in Plymouth or Dracut? (I noticed Fedora has its own Dracut repository.)

It’s been a very long time since I worked on a plymouth theme.
And I have forgotten the details…

What I would do is read the source code of a working theme and see if there is something different that might explain the password prompt being missing with your theme.

For what is understand, the key lines for plymouth are like :

Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback)

Plymouth executes the DisplayPasswordCallback function when it receives a “password prompt call” from somewhere (maybe from the systemd-ask-for-password Dracut module, I’m not sure its just a wild guess i don’t 100% understand every dracut process during boot).

I tried looking at other Fedora themes, but they seem to use the same approach as I do in my script (Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback)). I’ll keep searching for themes that work with Fedora.

The default Fedora theme works fine, but I can’t find something like a “.script” file. There’s only a “.plymouth” file, but there must be something else defining the theme. Let me know if I’m wrong about that—maybe the .plymouth file alone is enough to create the Fedora default theme?

You will need to read the docs for plymouth.
I think that is how I found out how to code a theme, but it was a very long time ago and I do not remember the details.