SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
after a few times when I forgot to write eliloconfig when upgrade kernel to new one I feel a little bit discriminated against lilo users because slackpkg asked to run lilo. I think it's can be added in function lookkernel() in file post-function.sh of slackpkg to check if /boot/efi is mounted and if is mounted to ask for eliloconfig instead lilo.
--- /usr/libexec/slackpkg/functions.d/post-functions.sh 2017-10-10 10:40:20.000000000 +0300
+++ post-functions.sh 2018-03-24 10:40:37.865627653 +0200
@@ -212,10 +212,25 @@
/sbin/lilo
fi
else
- echo -e "\n
+ if [ -d /sys/firmware/efi ]; then
+ MACHINE=$(uname -m)
+ if mount | grep vfat | grep -wq /boot/efi ; then
+ if [ "$MACHINE" == "x86_64" ]; then
+ cp /boot/elilo-x86_64.efi /boot/efi/EFI/Slackware/elilo.efi
+ else
+ cp /boot/elilo-ia32.efi /boot/efi/EFI/Slackware/elilo.efi
+ fi
+ cp /boot/vmlinuz /boot/efi/EFI/Slackware/vmlinuz
+ echo -e "\n
+Your kernel image was updated and copied with elilo efi file to /boot/efi/EFI/Slackware.
+Check it out before reboot. If you need start eliloconfig to adjust your boot manager."
+ fi
+ else
+ echo -e "\n
Your kernel image was updated and lilo is not found on your system.
You may need to adjust your boot manager (like GRUB) to boot appropriate
kernel."
+ fi
fi
fi
}
Here is what I do, now is time to wait for new kernel in current to test the changes. If some one bash guru find error, pls let me know.
Last edited by gildbg; 03-24-2018 at 08:31 AM.
Reason: fix syntax error
@gildbg - Thanks for taking on the challenge!
My minor quibble is that the user should be be prompted to make the changes, rather than accept the changes after they have have been made.
A couple of caveats:
1. For a full install the file /sbin/lilo will exist and the patch will never be run. One solution is to delete the file but a better test would be
Code:
if [ -f /etc/lilo.conf ]
as the elilo.conf is only created if lilo is configured.
2. Will not work for generic kernels.
Yep,
it's should be: if [ -x /sbin/lilo ] && [ ! -d /sys/firmware/efi ]; then
I now saw it.
Code:
--- /usr/libexec/slackpkg/functions.d/post-functions.sh 2018-03-26 17:02:38.674602360 +0300
+++ post-functions.sh 2018-03-26 17:01:15.206302661 +0300
@@ -203,7 +203,7 @@
lookkernel() {
NEWKERNELMD5=$(md5sum /boot/vmlinuz 2>/dev/null)
if [ "$KERNELMD5" != "$NEWKERNELMD5" ]; then
- if [ -x /sbin/lilo ]; then
+ if [ -x /sbin/lilo ] && [ ! -d /sys/firmware/efi ]; then
echo -e "\n
Your kernel image was updated. We highly recommend you run: lilo
Do you want slackpkg to run lilo now? (Y/n)"
@@ -212,10 +212,25 @@
/sbin/lilo
fi
else
- echo -e "\n
+ if [ -d /sys/firmware/efi ]; then
+ MACHINE=$(uname -m)
+ if mount | grep vfat | grep -wq /boot/efi ; then
+ if [ "$MACHINE" == "x86_64" ]; then
+ cp /boot/elilo-x86_64.efi /boot/efi/EFI/Slackware/elilo.efi
+ else
+ cp /boot/elilo-ia32.efi /boot/efi/EFI/Slackware/elilo.efi
+ fi
+ cp /boot/vmlinuz /boot/efi/EFI/Slackware/vmlinuz
+ echo -e "\n
+Your kernel image was updated and copied with elilo efi file to /boot/efi/EFI/Slackware.
+Check it out before reboot. If you need start eliloconfig to adjust your boot manager."
+ fi
+ else
+ echo -e "\n
Your kernel image was updated and lilo is not found on your system.
You may need to adjust your boot manager (like GRUB) to boot appropriate
kernel."
+ fi
fi
fi
}
Why do you think will now work for generic kernels ? If the kernel images is different script will copy from boot directory file vmlinuz to /boot/efi/EFI/Slackware/vmlinuz
As far as I understand it the /boot/vmlinuz is a symlink to the huge kernel. Users of the generic kernel would need to copy /boot/vmlinuz-generic. They would also have to update their initrd file. It's a long time since I've used a generic kernel and possibly my memory is playing tricks with me :-(
@Didier Spaier suggestion trying to resolve the problem when you upgrade your kernel and work on mixed machines few with LILO few with ELILO and and write reboot after upgrade without to copy vmlinuz file to in /boot/efi/EFI/Slackware/ and then you realize that this machine is with ELILO not with LILO and you are ....
@phi11ip I look into slackpkg files and did not see such functionality if you are with LILO. I added initrd check
@allend I added yes or no question for copy new files as you suggest. Also I added error message if efi directory is not mounted.
My english isnt so good, so pls fix the language errors.
Code:
--- /usr/libexec/slackpkg/functions.d/post-functions.sh 2018-03-30 16:43:13.825538532 +0300
+++ post-functions.sh 2018-03-30 16:43:05.899623732 +0300
@@ -203,7 +203,7 @@
lookkernel() {
NEWKERNELMD5=$(md5sum /boot/vmlinuz 2>/dev/null)
if [ "$KERNELMD5" != "$NEWKERNELMD5" ]; then
- if [ -x /sbin/lilo ]; then
+ if [ -x /sbin/lilo ] && [ ! -d /sys/firmware/efi ]; then
echo -e "\n
Your kernel image was updated. We highly recommend you run: lilo
Do you want slackpkg to run lilo now? (Y/n)"
@@ -212,10 +212,38 @@
/sbin/lilo
fi
else
- echo -e "\n
+ if [ -d /sys/firmware/efi ]; then
+ MACHINE=$(uname -m)
+ echo -e "\n
+Your kernel image was updated. We highly recommend you to copy elilo, vmlinuz and initrd
+to /boot/efi/EFI/Slackware/ Do you want slackpkg to do that for you ? (Y/n)"
+ answer
+ if [ "$ANSWER" != "n" ] && [ "$ANSWER" != "N" ]; then
+ if mount | grep vfat | grep -wq /boot/efi ; then
+ if [ "$MACHINE" == "x86_64" ]; then
+ cp /boot/elilo-x86_64.efi /boot/efi/EFI/Slackware/elilo.efi
+ else
+ cp /boot/elilo-ia32.efi /boot/efi/EFI/Slackware/elilo.efi
+ fi
+ cp /boot/vmlinuz /boot/efi/EFI/Slackware/vmlinuz
+ if [ -r /boot/initrd.gz ]; then
+ cp /boot/initrd.gz /boot/efi/EFI/Slackware 1> /dev/null 2> /dev/null
+ touch -r /boot/initrd.gz /boot/efi/EFI/Slackware/initrd.gz
+ fi
+ echo -e "\n
+Your kernel image was updated and copied with elilo efi file and initrd.gz if exists to /boot/efi/EFI/Slackware.
+Check it out before reboot. If you need start eliloconfig to adjust your boot manager."
+ else
+ echo -e "\n
+Your efi partition is not mounted. Check that before reboot."
+ fi
+ fi
+ else
+ echo -e "\n
Your kernel image was updated and lilo is not found on your system.
You may need to adjust your boot manager (like GRUB) to boot appropriate
kernel."
+ fi
fi
fi
}
Last edited by gildbg; 03-30-2018 at 08:48 AM.
Reason: Added yes or no question
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.