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.
I poked around in mkinitrd sources some time ago, intending to allow for a way to pass an option that would automatically append a kernel version string to the initrd name, but it didn't appear to be as trivial as I wanted, so I gave up. I'd rather not introduce bugs to accompany a feature that nobody else has ever requested :-)
Code:
--- /mnt/sbin/mkinitrd.orig 2017-06-29 19:11:26.000000000 +0200
+++ /mnt/sbin/mkinitrd 2017-06-30 17:21:15.000000000 +0200
@@ -467,7 +466,7 @@
# If no OUTPUT_IMAGE was specified, read it from the SOURCE_TREE if possible:
OUTPUT_IMAGE=${OUTPUT_IMAGE:-"$(cat $SOURCE_TREE/initrd-name)"}
# If we still have no value, apply the default:
-OUTPUT_IMAGE=${OUTPUT_IMAGE:-"/boot/initrd.gz"}
+OUTPUT_IMAGE=${OUTPUT_IMAGE:-"/boot/initrd.gz-$KERNEL_VERSION"}
# Finally, write the image name into the SOURCE_TREE:
echo "$OUTPUT_IMAGE" > $SOURCE_TREE/initrd-name
As basically any name could come from the SOURCE TREE us changing it cannot (should not) introduce side effects. And from my experience it does not.
Note there is an empty line at the end of the patch.
Edit Jul 9, 2017: The $KERNEL_VERSION here represents the "-k <target kernel version>" mkinitrd invocation parameter. If this was not given things default to the version of the *running* kernel, something that for my use case (create an initrd for the new generic kernel I just built and installed) would be inappropriate.
I poked around in mkinitrd sources some time ago, intending to allow for a way to pass an option that would automatically append a kernel version string to the initrd name, but it didn't appear to be as trivial as I wanted, so I gave up. I'd rather not introduce bugs to accompany a feature that nobody else has ever requested :-)
I'm curious if you could edit the /etc/mkinitrd.conf file and swap KERNEL_VERSION and OUTPUT_IMAGE and then use the KERNEL_VERSION variable in the OUTPUT_IMAGE? Although, this would only work for people who use mkinitrd.conf.
--ORIGINAL--
Code:
# mkinitrd.conf.sample
# See "man mkinitrd.conf" for details on the syntax of this file
#
#SOURCE_TREE="/boot/initrd-tree"
#CLEAR_TREE="0"
#OUTPUT_IMAGE="/boot/initrd.gz"
#KERNEL_VERSION="$(uname -r)"
#KEYMAP="us"
#MODULE_LIST="ext4"
#LUKSDEV="/dev/sda2"
#LUKSKEY="LABEL=TRAVELSTICK:/keys/alienbob.luks"
#ROOTDEV="/dev/sda1"
#ROOTFS="ext3"
#RESUMEDEV="/dev/sda2"
#RAID="0"
#LVM="0"
#UDEV="1"
#MODCONF="0"
#WAIT="1"
--NEW--
Code:
# mkinitrd.conf.sample
# See "man mkinitrd.conf" for details on the syntax of this file
#
#SOURCE_TREE="/boot/initrd-tree"
#CLEAR_TREE="0"
#KERNEL_VERSION="$(uname -r)"
#OUTPUT_IMAGE="/boot/initrd-${KERNEL_VERSION}.gz"
#KEYMAP="us"
#MODULE_LIST="ext4"
#LUKSDEV="/dev/sda2"
#LUKSKEY="LABEL=TRAVELSTICK:/keys/alienbob.luks"
#ROOTDEV="/dev/sda1"
#ROOTFS="ext3"
#RESUMEDEV="/dev/sda2"
#RAID="0"
#LVM="0"
#UDEV="1"
#MODCONF="0"
#WAIT="1"
I'm curious if you could edit the /etc/mkinitrd.conf file and swap KERNEL_VERSION and OUTPUT_IMAGE and then use the KERNEL_VERSION variable in the OUTPUT_IMAGE?
That should work just fine, since mkinitrd.conf is sourced by mkinitrd, so mkinitrd.conf becomes actually part of mkinitrd script and so variables are evaluated just as in scripts.
PHP 5.6.31 is here and it is also a security release.
It fixes a buffer overflow which open the room for a type of DDOS attack and another one which can expose (chunks of) sensitive data from server, via a prepared GIF image.
I believe that this is more than enough to qualify for a "must upgrade", but of course that's me alone.
I am hospitalized now with only some kind of kiosk access, so I cannot test.
So for as far as I can theorize about it the .conf approach does not work as it picks up the running kernel. And most of the time you will run mkinitrd for a new (generic) kernel which you cannot boot without the to-be-created new initrd.
You will need the -k <kernel version> mkinitrd invocation parameter and that one is first picked up after reading the .conf -- as I do in with my patch for quite some time now.
I am hospitalized now with only some kind of kiosk access, so I cannot test.
So for as far as I can theorize about it the .conf approach does not work as it picks up the running kernel. And most of the time you will run mkinitrd for a new (generic) kernel which you cannot boot without the to-be-created new initrd.
You will need the -k <kernel version> mkinitrd invocation parameter and that one is first picked up after reading the .conf -- as I do in with my patch for quite some time now.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.