FooDeas / raspberrypi-ua-netinst

RaspberryPi (minimal) unattended netinstaller
ISC License
218 stars 45 forks source link

cp: cannot stat 'tmp/lib/modules/5.10.17- #216

Closed unclehowell closed 3 years ago

unclehowell commented 3 years ago

Annoying Errors when I compile the image. cp: cannot stat 'tmp/lib/modules/5.10.17-v7+/kernel/drivers/net/phy': No such file or directory cp: cannot stat 'tmp/lib/modules/5.10.17-v7l+/kernel/drivers/net/phy': No such file or directory cp: cannot stat 'tmp/lib/modules/5.10.17-v8+/kernel/drivers/net/phy': No such file or directory cp: cannot stat 'tmp/lib/modules/5.10.17-v7+/kernel/drivers/hwmon/hwmon.ko': No such file or directory cp: cannot stat 'tmp/lib/modules/5.10.17+/kernel/drivers/hwmon/hwmon.ko': No such file or directory cp: cannot stat 'tmp/lib/modules/5.10.17-v7l+/kernel/drivers/hwmon/hwmon.ko': No such file or directory cp: cannot stat 'tmp/lib/modules/5.10.17-v8+/kernel/drivers/hwmon/hwmon.ko': No such file or directory cp: cannot stat 'tmp/bin/mkfs.btrfs': No such file or directory

Scientist786 commented 3 years ago

I am having the same issues. I solved hwmon error by replacing hwmon with raspberrypi-hwmon in build.sh. Rest of the errors can be partially fixed by commenting out cp_kernelfiles tmp/lib/modules/kernel*/kernel/drivers/net/phy rootfs/lib/modules/kernel*/kernel/net/ and cp --preserve=xattr,timestamps tmp/bin/mkfs.btrfs rootfs/bin/ in build.sh. I don't know how that will affect the generated image.

Mausy5043 commented 3 years ago

This worked for me: sed -ibak s/\/hwmon\.ko/\/raspberrypi-hwmon\.ko/ build.sh

Related to #199 which was fixed by #200, so not sure why you're running into this.

EDIT: I see, now. The fix is only implemented on the devel branch. The master branch still contains the old code.
So, you might want to try and build from the devel branch, which seems reasonably stable at the moment (APR2021).

Mausy5043 commented 3 years ago

Hmm 😞 .
Now also running into cp: cannot stat 'tmp/lib/modules/5.10.17-v8+/kernel/drivers/net/phy': No such file or directory

Scientist786 commented 3 years ago

@Mausy5043 I already told you to comment out those lines. Read my previous comment. I am using the generated image for a month, no issue faced till now.

Mausy5043 commented 3 years ago

@Scientist786 : I understand that your fix works for you. But for the general case this is not enough.

The installer will hold four net directories in raspberrypi-ua-netinst/build_dir/tmp/lib/modules:

$ find . -wholename "*/kernel/drivers/net"
./5.10.17-v8+/kernel/drivers/net
./5.10.17-v7+/kernel/drivers/net
./5.10.17-v7l+/kernel/drivers/net
./5.10.17+/kernel/drivers/net

and only one of them holds a phy directory:

$ find . -wholename "*/kernel/drivers/net/phy"
./5.10.17+/kernel/drivers/net/phy

So, although your fix may work, it will fail for those using the 5.10.17+ kernel.

Mausy5043 commented 3 years ago

This line needs to be changed: https://github.com/FooDeas/raspberrypi-ua-netinst/blob/15b8f30d8b436f081b0d49cf55ca2af84b0a112c/build.sh#L41

to:

eval cp --preserve=xattr,timestamps -r "${1//kernel\*/${kernel}}" "${2//kernel\*/${kernel}}"  || true

This will still output the copying error during the build, but it will not abort it.

And to also tackle OPs final error. This line: https://github.com/FooDeas/raspberrypi-ua-netinst/blob/15b8f30d8b436f081b0d49cf55ca2af84b0a112c/build.sh#L221

should be changes to cp --preserve=xattr,timestamps tmp/sbin/mkfs.btrfs rootfs/sbin/ because the executable was moved.