Diskless_BuildDefaultImage.sh sometimes fails to find and copy kernel into tftpboot preventing netboot of media director
On LinuxMCE / Kubuntu 14.04 Hybrid
After running /usr/pluto/bin/Diskless_CreateTBZ.sh on the core and trying to network boot a media director, the vmlinuz file is not found when the machine tries to network boot and the media director is never brought up properly. I know this worked before as I have done this many times without error so I was curious why this time it didn't. This machine has been running as a hybrid for some time but I wanted to add more media directors like I have done so before.
The following is how I diagnosed the issue.
Look in /usr/pluto/bin/Diskless_CreateTBZ.sh and follow to /usr/pluto/bin/Diskless_BuildDefaultImage.sh the assignment of the KERNEL line finds the name of the kernel.
KERNEL=$(find * -maxdepth 0 -type d |sort -r |head -1)
Here is what was in my kernel modules directory at the time.
$ ls /lib/modules
4.4.0-127-generic 4.4.0-130-generic 4.4.0-31-generic 4.4.0-128-generic 4.4.0-131-generic
simulate what the script would do.
$ cd /lib/modules
calling the command that assigns the KERNEL variable
$ find * -maxdepth 0 -type d |sort -r |head -1
This is an old kernel and doesn't appear to be the one to work from, this issue is probably not stumbled upon a lot because what are the odds that a kernel name would be 4.4.0-31-generic and 4.4.0-131-generic and still have those directories installed in /lib/modules.
I assume the script is supposed to get the latest kernel and copy it, so after looking at the options for the sort command and trying a few things adding the option -V, --version-sort natural sort of (version) numbers within text gets the latest kernel that is installed
$ find * -maxdepth 0 -type d |sort -rV |head -1
I re-ran the /usr/pluto/bin/Diskless_BuildDefaultImage.sh and the diskless node now boots properly.
Attached patch attempting to fix the issue. Diskless_BuildDefaultImage.sh-find-vmlinuz-fix.patch
Have ran across a post in the forum which seems like a very similar issue that I had. Thought I would cross reference it here just in case more info is needed.
Diskless md (Problem) https://forum.linuxmce.org/index.php?topic=14648.0
closedToggle commit list