LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   eliloconfig swap device for resume from hiberrnate (https://www.linuxquestions.org/questions/slackware-14/eliloconfig-swap-device-for-resume-from-hiberrnate-4175629136/)

saxa 05-06-2018 11:07 AM

eliloconfig swap device for resume from hiberrnate
 
Hi all, I have not have much experience with the eliloconfig , but lastly i got a uefi hardware and had to start using it. What bothered me every time i had a new kernel I got with the append line rewriten after running eliloconfig. Therefore I attach here a patch which should solve this issue partially at least.

The patch basically checks /etc/fstab for a swap device and adds it to the append line of the kernel at boot time. This permits that pm-hibernate works out of the box.

I have not tested this patch during the slackware install process, but on a installed machine it works ok.

The code is here:
Code:

--- /usr/sbin/eliloconfig        2017-11-20 22:34:26.000000000 -0300
+++ /usr/sbin/eliloconfig.mod        2018-05-06 12:51:29.097835059 -0300
@@ -1,5 +1,6 @@
 #!/bin/sh
 # Copyright 2013, 2016, 2017  Patrick Volkerding, Sebeka, Minnesota, USA
+# Copyright 2018  Sasa Ostrouska, Nova Gorica, Slovenija
 # All rights reserved.
 #
 # Redistribution and use of this script, with or without modification, is
@@ -67,6 +68,16 @@
  fi
 fi
 
+# Determine the swap partition (susch as /dev/sda1) to make the
+# resume= argument of the append line.
+if [ "$SWAP_DEVICE" = "" ]; then
+ #if [ -r $TMP/SeTswapdev ]; then
+ # SWAP_DEVICE="$(cat $TMP/SeTswapdev)"
+ #else
+  SWAP_DEVICE="$(cat /etc/fstab | grep swap | cut -f 1 -d ' ')"
+ #fi
+fi
+
 # If the system is not running under EFI, skip running this script:
 if [ ! -d /sys/firmware/efi ]; then
  if [ "$T_PX" = "/" ]; then
@@ -148,7 +159,7 @@
 fi
 cat << EOF >> $T_PX/boot/efi/EFI/Slackware/elilo.conf
        read-only
-        append="root=$ROOT_DEVICE vga=normal ro"
+        append="resume=$SWAP_DEVICE root=$ROOT_DEVICE vga=normal ro"
 EOF
 
 dialog --title "INSTALL BOOT MENU ENTRY?" \

Please comment if there is a better solution to this problem. Of course that the best thing would be also
to preserve the existing elilo.conf append line or probably even better add the possibility to create
your own append line as it exists in the liloconfig script in ask_appen() .
I have thought that maybe unifying the liloconfig and eliloconfig scritps that would automatically select the correct setup would be probably the easiest and more cleaner way.

Rgds
Saxa

laprjns 05-06-2018 01:47 PM

I think the crux of the problem is that eliloconfig overwrites the elilo.conf file whenever you run it and answer yes to the "Do you want to install elilo to the ESP" question. This results in the lost of any customization that may have been done to an existing eleio.config file. If all that is being done is updating the kernel, then there is no reason to touch the elilo.conf file. I use UUID for block device identification in elilo.conf and would have to update the elilo.conf file after each kernel updated. I eventually figured out that there was no need to run eliloconfig after a kernel update and now I just copied over the new kernel (and initrd if needed) to the ESP. I think the first step in solving your problem is to have eliloconfig ask before replacing an existing elilo.conf file.
Now on initial installation, that another issue. I'm sure that there are several other append line options the others would like to add during the initial installation. Therefore not sure if its the correct thing to do.

saxa 05-06-2018 02:14 PM

Hi, sure, the big problem is the overwrite of the append line. If you add any append option to elilo.conf after you run the eliloconfig it will simply be ignored.

saxa 05-06-2018 02:15 PM

PS: What happened in my case was that I wanted to add the resume= option after i installed slackware to be able to use pm-hibernate and it simply had no effect if I didn`t update elilo.conf and then run eliloconfig.

laprjns 05-06-2018 04:06 PM

Quote:

Originally Posted by saxa (Post 5851376)
If you add any append option to elilo.conf after you run the eliloconfig it will simply be ignored.

There is there is no need to run eliloconf after making changes to elilo.conf. As long as you edit the elilo.conf file in EFI/Slackware/elilo.conf using the correct syntax, on the next boot, the bootloader, elilo.efi, will read elilo.conf and pass the append options to the kernel.

saxa 05-06-2018 06:31 PM

I need to test that, but AFAIK on my machine didnt work. As said, I did that modification to permit the append line to remain with the resume option, as simply by running eliloconfig it doesnt retain the existing values.
Also in the first place I have tried to add the resume option to my appnd line in the elilo.conf file , rebooted and it was ignored. Maybe i did something wrong and will try to do it again, just to make sure it works like you are describing. If it works the way you are telling me there is no need to have this addition in the eliloconfig script.

Will check and report back.

Rgds
Saxa

chemfire 05-08-2018 10:10 AM

laprjns is trying to explain that unlike LILO you do not need to reinstall the ELILO boot loader to pickup config changes. You can simply modify the config file in /boot/efi and it will be read by ELILO the next time the system boots. You should run eliloconfig exactly once.

saxa 05-08-2018 01:12 PM

Sir, I perfectly understood that, but unfortunately on my machine this was not happening at the time when I created the patch. I have no idea why it have not picked up the changes, but I am 100% sure this was not working that way. I had no time to test it yet and do
few reboots to confirm that. Will surely report back when I do test it.

saxa 05-12-2018 09:24 PM

Ok, I just tested it today, and I have to say that I basically forgot why I did that. What exactly happened today is that I lost 2h trying to solve the problem. So the full process I did is:
1. slackpkg upgrade-all , this is where i got my new kernel 4.14.40 downloaded and installed.
2. rebooted the machine since it had to pick up the newly upgraded kernel without running eliloconfig.

After reboot unfortunately the efi picks up the kernel i had before 4.14.39 because it boots the /boot/efi/EFI/Slackware/vmlinuz for some reason which obviously has not been overwritten
from the new 4.14.30 kenrel.

What happened is that the machine safely starts up but it does not load any modules from the /lib/modules/4.14.39 dir as it does no longer exists, and therefore for my hardware at least
the USB keyboard does not work, and I can not do anything with my system except hold the power button 4s to make a hard shut down.

Now the question is, after installing a new kernel simply cp /boot/vmlinuz /boot/efi/EFI/Slackware/ will work ?

I think I tested this in th epast and it has not worked, therefore the reason why I have to run eliloconfig on my system every time I upgrade the kernel.

Rgds
Saxa

laprjns 05-13-2018 06:03 AM

Yes, when using elilo as your bootloader, after a kernel upgrade the new kernel and initrd (if required) need to be copied to the EFI/Slackware directory on the ESP partition (mounted on /boot/efi and therefore is /boot/efi/EFI/Slackware). Running eliloconfig and selecting "OK" at the "INSTALL ELILO" dialog box will copy the new kernel to /boot/efi/EFI/Slackware/vmlinuz and the initrd to /boot/efi/EFI/Slackware/initrd.gz. Unfortunately it also installs, or overwrites a new elilo.conf file to /boot/efi/EFI?Slackware/elilo.conf. This results in the lost of any customization that you may have made to the elilo.conf file prior to running eliloconfig. This is why I posted this request in the "Request for -current topic.

I therefore no longer run eliloconf after a kernel upgrade and instead just copy over the new kernel (i don't use a initrd) to the ESP.

saxa 05-13-2018 09:05 AM

Ok i got it, so there is 2 ways the manual copy or running eliloconfig. Manual copy should work until you do not forget it for some reason, therefore
IMHO it is way better to unify all that stuff and call it direcly after the upgradepkg kernel from the postinstall script like it does now for lilo.

A real progress would be to make feel to the user that things are working not only for who uses lilo, but for any bootloader slackware supports.
Thats just my 2c but for me would be enough that eliloconfig would maintain my modifications and this is why i made the patch to make it append
the resume= option.

Rgds
Saxa


All times are GMT -5. The time now is 10:50 AM.