antonio-petricca / buddy-linux

Do you remember "Wubi Ubuntu Installer"? This project is both a replacement and an improvement of Wubi. You will be able to install your Debian (or derived) distribution on a PC without repartitioning it, simply by using a secondary/external boot device (like a USB drive).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help regarding writing a HelloWorld dracut module

aravindhank11 opened this issue · comments

Hi @antonio-petricca,

I am certain this is not the right place, but being a novice operator with "dracut," I thought I could gain some help from a maintainer who knows the ins & outs of it.

I want to write a very preliminary module that just does an echo command to get myself started with dracut. It would be of great help if you could help/point me to the right resources.

# #My new module is 90avi
# pwd
/usr/lib/dracut/modules.d/90avi

# cat module-setup.sh
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
    return 0
}
depends() {
    echo base lvm
    return 0
}
install() {
    inst_hook cmdline 90 "${moddir}/subroot.sh"
}

# cat subroot.sh
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-lib.sh
info "This is a sample info tag!!!"

# cat /proc/cmdline
BOOT_IMAGE=/boot/vmlinuz-5.10.61-1.ph4 root=PARTUUID=89e99bcd-d182-4769-8752-20650ca6d0cd init=/lib/systemd/systemd ro loglevel=5 rd.debug no-vmw-sta console=tty0 console=ttyS0,115200 net.ifnames=0 plymouth.enable=0 systemd.legacy_systemd_cgroup_controller=yes

However, as per the Serial Console logs, I have collected, I am unable to see the This is a sample info tag!!! log. I am not sure if my module never got inserted to initrd (or) if it is getting executed however, my cmdline args are obscuring it.

I ran dracut -f command to kick start the inird building. Also, I am able to grep my module using dracut --list:

# dracut --list | grep avi
dracut: Executing: /usr/bin/dracut --list
avi

Could you please help?

Thanks

Looks like, I was making a silly issue. The initrd I generated the one the grub was loading was different. Sorry :(

Hi, so could we consider your issue solved? :)

Yes, sorry for the trouble.

I am exploring Dracut using the man page and examples from this git page. Your git page is beneficial.

I might reach out if I get stuck on something and cannot find a way out. Thank you.