illiliti / tinyramfs

Tiny initramfs written in POSIX shell
GNU General Public License v3.0
103 stars 19 forks source link

cp: cannot stat 'module option': No such file or directory #37

Closed dkwo closed 1 year ago

dkwo commented 1 year ago

With the following

$ cat /etc/modprobe.d/modprobe.conf 
options snd-hda-intel model=tpt460

I do get an error, and the image is not created:

$ doas xbps-reconfigure -f linux6.3
linux6.3: configuring ...
Executing post-install kernel hook: 20-initramfs ...
>> creating ramfs structure
>> copying hook: eudev.init
>> copying hook: eudev.init.late
>> evaluating hook: eudev
>> copying hook: luks.init
>> evaluating hook: luks
>> copying hook: lvm.init
>> evaluating hook: lvm
>> copying hostonly modules
cp: cannot stat '/lib/modules/6.3.3_1/kernel/sound/pci/hda/snd-hda-intel.ko.zst model=tpt460': No such file or directory
Executing post-install kernel hook: 50-efibootmgr ...
linux6.3: configured successfully.

It seems that tinyramfs is incorrectly parsing my modprobe.d configuration.

illiliti commented 1 year ago

Does this patch fix the bug for you?

diff --git a/lib/common.sh b/lib/common.sh
index 1f72a69..db7477a 100755
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -95,7 +95,7 @@ copy_kmod()
 {
     modprobe -S "$kernel" -D "$1" 2> /dev/null |

-    while read -r _ _mod || [ "$_mod" ]; do
+    while read -r _ _mod _ || [ "$_mod" ]; do
         case $_mod in /*) copy_file "$_mod" "$_mod" 0644; esac
     done
 }
dkwo commented 1 year ago

it works, thank you! now the initram is generated, and audio works fine. can you merge this into master, so i can add the patch to void linux repos?

illiliti commented 1 year ago

https://github.com/illiliti/tinyramfs/commit/80074e02dde40fc25af66098c45984f0e4ea5e3c