[SOLVED] Help with adding new Slackware install in Grub.d
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.
Hey everyone, I'm struggling to understand/add the new installation of slackware to my existing list of Grub2, I added the following lines to the custom_40 in grub2.d
Would that be sufficient?
I do get the Slackware option along with my other distributions but it says Error
must load kernel first.
Any help will be much appreciated!
Your entry for booting Slackware from a Grub2 menentry is all wrong. The entry you have is part Grub2 (just the menuentry part) and the rest is Grub Legacy. A sample entry to boot Slackware from Grub2 is below. Your entry should be similar but obviously you will have to change the UUID and partition entries:
Code:
menuentry "Slackware (on /dev/sda7)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos7)'
search --no-floppy --fs-uuid --set=root a150ce5c-84c8-4770-a1d0-ae8544ad7302
linux /boot/vmlinuz root=/dev/sda7 ro vt.default_utf8=0 vga = 773
Your entry for booting Slackware from a Grub2 menentry is all wrong. The entry you have is part Grub2 (just the menuentry part) and the rest is Grub Legacy. A sample entry to boot Slackware from Grub2 is below. Your entry should be similar but obviously you will have to change the UUID and partition entries:
Code:
menuentry "Slackware (on /dev/sda7)" --class gnu-linux --class gnu --class os {
insmod part_msdos
insmod ext2
set root='(/dev/sda,msdos7)'
search --no-floppy --fs-uuid --set=root 7c7e2646-fd13-4974-bea2-6d70483a1917
linux /boot/vmlinuz root=/dev/sda7 ro vt.default_utf8=0 vga = 773
Thanks for the example man, worked like a charm! I've got some questions if you don't mind. (For interest's sake) ?
What is the uuid, msdos, insmod?
I'm leaving it as a reference for any other newbies struggling to add this to grub2: Firstly, here's mine:
Quote:
menuentry "Slackware 13.37 (on /dev/sda2)" --class gnu-linux --class gnu --class os
{
insmod part_msdos
insmod ext3
set root='(/dev/sda2,msdos2)'
search --no-floppy --fs-uuid --set=root myuuid
linux /boot/vmlinuz root=/dev/sda2 ro vt.default_utf8=0 vga = 773
}
Secondly, you can find the custom_40 file in /etc/grub.d. This is where you are supposed to add your new OS to grub2.
After updating run update-grub to generate the grub.cfg file in /boot/grub
Also, if you want to see the UUID's a handy line is:
ls -l /dev/disk/by-uuid
Last edited by Terminal(ly)- ill; 06-02-2012 at 04:50 AM.
You could try this as /etc/grub.d/09_slackware_linux:
Code:
#! /bin/sh -e
# grub-mkconfig helper script.
# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
prefix=/usr
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=/usr/lib64
. ${libdir}/grub/grub-mkconfig_lib
export TEXTDOMAIN=grub
export TEXTDOMAINDIR=@LOCALEDIR@
CLASS="--class gnu-linux --class gnu --class os"
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
OS="${GRUB_DISTRIBUTOR} GNU/Linux"
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr '[A-Z]' '[a-z]') ${CLASS}"
fi
# loop-AES arranges things so that /dev/loop/X can be our root device, but
# the initrds that Linux uses don't like that.
case ${GRUB_DEVICE} in
/dev/loop/*|/dev/loop[0-9])
GRUB_DEVICE=`losetup ${GRUB_DEVICE} | sed -e "s/^[^(]*(\([^)]\+\)).*/\1/"`
;;
esac
if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \
|| ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}" ; then
LINUX_ROOT_DEVICE=${GRUB_DEVICE}
else
LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
fi
linux_entry ()
{
os="$1"
tag="$2"
version="$3"
recovery="$4"
args="$5"
if ${recovery} ; then
title="$(gettext "%s, with Linux %s [%s] (recovery mode)")"
else
title="$(gettext "%s, with Linux %s [%s]")"
fi
printf "menuentry \"${title}\" ${CLASS} {\n" "${os}" "${version}" "${tag}"
save_default_entry | sed -e "s/^/\t/"
# Use ELILO's generic "efifb" when it's known to be available.
# FIXME: We need an interface to select vesafb in case efifb can't be used.
if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then
if grep -qx "CONFIG_FB_EFI=y" /boot/config-${version} 2> /dev/null \
&& grep -qx "CONFIG_VT_HW_CONSOLE_BINDING=y" /boot/config-${version} 2> /dev/null; then
cat << EOF
set gfxpayload=keep
EOF
fi
else
cat << EOF
set gfxpayload=$GRUB_GFXPAYLOAD_LINUX
EOF
fi
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF
echo $(printf "$(gettext "Loading Linux %s ...")" ${version})
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
cat << EOF
echo $(gettext "Loading initial ramdisk ...")
initrd ${rel_dirname}/${initrd}
EOF
fi
cat << EOF
}
EOF
}
process_list ()
{
mylist="$1"
tag="$2"
initrd_allowed="$3"
while [ "x$mylist" != "x" ] ; do
linux=`version_find_latest $mylist`
echo "Found linux image: $linux" >&2
basename=`basename $linux`
dirname=`dirname $linux`
rel_dirname=`make_system_path_relative_to_its_root $dirname`
version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
alt_version=`echo $version | sed -e "s,\.old$,,g"`
linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
initrd=
if [ "x${initrd_allowed}" = "xtrue" ]; then
for i in "initrd-${version}.gz" "initrd.gz" \
"initrd.img-${version}" "initrd-${version}.img" \
"initrd-${version}" "initrd.img-${alt_version}" \
"initrd-${alt_version}.img" "initrd-${alt_version}"; do
if test -e "${dirname}/${i}" ; then
initrd="$i"
break
fi
done
if test -n "${initrd}" ; then
echo "Found initrd image: ${dirname}/${initrd}" >&2
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
fi
else
# "UUID=" magic is parsed by initrds. Since there's no initrd, it can't work here.
linux_root_device_thisversion=${GRUB_DEVICE}
fi
linux_entry "${OS}" "${tag}" "${version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry "${OS}" "${tag}" "${version}" true \
"single ${GRUB_CMDLINE_LINUX}"
fi
mylist=`echo $mylist | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`
done
}
prepare_boot_cache=
list=`for i in /boot/vmlinu[xz]-generic-* /vmlinu[xz]-generic-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
process_list "${list}" "generic" "true"
list=`for i in /boot/vmlinu[xz]-huge-* /vmlinu[xz]-huge-* ; do
if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
done`
process_list "${list}" "huge" "false"
I assume in it that you'll name your initrd.gz files to match the kernel for which they are built.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.