LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-06-2018, 12:07 PM   #1
saxa
Member
 
Registered: Aug 2004
Distribution: Slackware
Posts: 449

Rep: Reputation: 45
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
 
Old 05-06-2018, 02:47 PM   #2
laprjns
Member
 
Registered: Oct 2005
Location: Connecticut USA
Distribution: SalixOS
Posts: 185

Rep: Reputation: 92
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.
 
Old 05-06-2018, 03:14 PM   #3
saxa
Member
 
Registered: Aug 2004
Distribution: Slackware
Posts: 449

Original Poster
Rep: Reputation: 45
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.
 
Old 05-06-2018, 03:15 PM   #4
saxa
Member
 
Registered: Aug 2004
Distribution: Slackware
Posts: 449

Original Poster
Rep: Reputation: 45
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.
 
Old 05-06-2018, 05:06 PM   #5
laprjns
Member
 
Registered: Oct 2005
Location: Connecticut USA
Distribution: SalixOS
Posts: 185

Rep: Reputation: 92
Quote:
Originally Posted by saxa View Post
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.

Last edited by laprjns; 05-07-2018 at 05:37 AM.
 
Old 05-06-2018, 07:31 PM   #6
saxa
Member
 
Registered: Aug 2004
Distribution: Slackware
Posts: 449

Original Poster
Rep: Reputation: 45
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
 
Old 05-08-2018, 11:10 AM   #7
chemfire
Member
 
Registered: Sep 2012
Posts: 210

Rep: Reputation: Disabled
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.
 
Old 05-08-2018, 02:12 PM   #8
saxa
Member
 
Registered: Aug 2004
Distribution: Slackware
Posts: 449

Original Poster
Rep: Reputation: 45
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.
 
Old 05-12-2018, 10:24 PM   #9
saxa
Member
 
Registered: Aug 2004
Distribution: Slackware
Posts: 449

Original Poster
Rep: Reputation: 45
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
 
Old 05-13-2018, 07:03 AM   #10
laprjns
Member
 
Registered: Oct 2005
Location: Connecticut USA
Distribution: SalixOS
Posts: 185

Rep: Reputation: 92
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.
 
Old 05-13-2018, 10:05 AM   #11
saxa
Member
 
Registered: Aug 2004
Distribution: Slackware
Posts: 449

Original Poster
Rep: Reputation: 45
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] [BUG] eliloconfig fails with non-standard device zerouno Slackware 3 11-21-2017 09:23 AM
squash-livecd swap resume basteon Linux - Software 0 03-24-2013 04:44 AM
resume: could not stat the resume device file Zaskar Debian 17 03-29-2012 11:10 PM
resume problem with s2disk: swap gone rdozijn_2 Debian 0 02-02-2009 07:55 AM
resume: cannot stat resume device file sixerjman Linux - Kernel 0 05-27-2007 04:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration