LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 06-01-2012, 04:18 PM   #1
Terminal(ly)- ill
LQ Newbie
 
Registered: Oct 2008
Distribution: Slackware 13.37, Linux Mint 12 Lisa
Posts: 16

Rep: Reputation: 1
Smile Help with adding new Slackware install in Grub.d


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

Quote:
menuentry "Slackware"
{
root (hd0,2)
kernel /boot/vmlinuz-huge-2.6.37.6 root=/dev/sda2
}
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!
 
Old 06-01-2012, 04:23 PM   #2
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 7,097

Rep: Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174Reputation: 4174
I've not played with grub2 recently, but some days ago another user made a similar question: have a look at the end of this topic

https://www.linuxquestions.org/quest...-64bit-947353/
 
Old 06-01-2012, 04:33 PM   #3
Terminal(ly)- ill
LQ Newbie
 
Registered: Oct 2008
Distribution: Slackware 13.37, Linux Mint 12 Lisa
Posts: 16

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by ponce View Post
I've not played with grub2 recently, but some days ago another user made a similar question: have a look at the end of this topic

https://www.linuxquestions.org/quest...-64bit-947353/
Ok, thanks for the link, I'll check it out, try to apply some of the tips.
 
Old 06-01-2012, 04:37 PM   #4
piratesmack
Member
 
Registered: Feb 2009
Distribution: Slackware, Arch
Posts: 519

Rep: Reputation: 142Reputation: 142
It has been a while for me too but I think Grub2 uses
Code:
set root='(hdx,x)'
to set the root

Last edited by piratesmack; 06-01-2012 at 04:38 PM.
 
Old 06-01-2012, 05:47 PM   #5
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
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
 
1 members found this post helpful.
Old 06-02-2012, 04:11 AM   #6
Terminal(ly)- ill
LQ Newbie
 
Registered: Oct 2008
Distribution: Slackware 13.37, Linux Mint 12 Lisa
Posts: 16

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by yancek View Post
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.
 
1 members found this post helpful.
Old 06-03-2012, 05:43 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: Slackware, Ubuntu, PCLinux,
Posts: 10,504

Rep: Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490Reputation: 2490
Quote:
What is the uuid, msdos, insmod?
The uuid is universally unique identifier. Couldn't really give an explanation for the other to, insmod "install module"?? guessing.
 
Old 06-03-2012, 06:16 PM   #8
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
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.

It Works For Me.
 
  


Reply



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] arch - grub (errors adding slackware) portia Arch 3 04-22-2010 03:59 PM
Adding Slackware 13 to Grub Boot loader of Ubuntu 9.10 vinnie_vinodh Slackware 3 01-28-2010 09:38 AM
Installing Slackware 64 and adding it to Grub. glore2002 Slackware 10 08-24-2009 12:57 PM
Adding Slackware 10 to Grub RoaCh Of DisCor Slackware 9 10-25-2004 02:00 PM
Adding Slackware to GRUB jturnbul Slackware 14 09-15-2004 03:48 PM

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

All times are GMT -5. The time now is 03:25 AM.

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
Open Source Consulting | Domain Registration