LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-12-2017, 08:17 PM   #1
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Rep: Reputation: 1
grub update takes 20 minutes to complete


Hello,

I have a problem that nobody could help me so far. I posted this issue several times in the past but no one ever replied to my post.
I hope someone could help me here or give me some tip how to trouble shot the problem.
The problem is this: grub update takes 15 to 20 minutes to complete.
Because I didn't know how to go about solving this issue I bought a new harddrive thinking the problem was the harddrive. But the new harddrive has the same issue.
Currently, I have two harddrives, one SSD and one regular.
On the SSD I have four partitions; on the regular one has 9 partitions. All Linux partitions.
Currently, only four distros are installed, the rest of the partitions are empty. All fresh installs - one Manjaro and three archlinux.
These are the partition setups:
Code:
[mak@myhost ~]$ sudo fdisk -l /dev/sda
[sudo] password for mak: 
Disk /dev/sda: 111.8 GiB, 120034123776 bytes, 234441648 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 22A20B2E-487A-11E5-B8E9-001FC6BA03E0

Device         Start       End  Sectors Size Type
/dev/sda1         40     32807    32768  16M BIOS boot
/dev/sda2      32808  58753063 58720256  28G Linux filesystem
/dev/sda3   58755072 117473279 58718208  28G Linux filesystem
/dev/sda4  117473320 176193575 58720256  28G Linux filesystem
/dev/sda5  176193576 232816679 56623104  27G Linux filesystem
[mak@myhost ~]$ sudo fdisk -l /dev/sdb
Disk /dev/sdb: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 42F64D19-BEBD-4777-8A52-CD249A6511CF

Device         Start        End    Sectors  Size Type
/dev/sdb1       2048      34815      32768   16M BIOS boot
/dev/sdb2      34816   62949375   62914560   30G Linux filesystem
/dev/sdb3   62949376  125863935   62914560   30G Linux filesystem
/dev/sdb4  125863936  188778495   62914560   30G Linux filesystem
/dev/sdb5  188778496  251693055   62914560   30G Linux filesystem
/dev/sdb6  251693056  314607615   62914560   30G Linux filesystem
/dev/sdb7  314607616  377522175   62914560   30G Linux filesystem
/dev/sdb8  377522176  388007935   10485760    5G Linux filesystem
/dev/sdb9  388007936 1950386175 1562378240  745G Linux filesystem
[mak@myhost ~]$
I hope someone can give me some tips what could be wrong.
Thank you.
 
Old 05-12-2017, 08:35 PM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,945

Rep: Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070
How are you updating grub ?.
 
Old 05-12-2017, 08:52 PM   #3
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by syg00 View Post
How are you updating grub ?.
I use this command:
Code:
grub-mkconfig -o /boot/grub/grub.cfg
 
Old 05-12-2017, 09:26 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,945

Rep: Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070
That's a worry - I've heard of grub-install taking inordinate time (usually searching for a floppy drive), but not mkconfig.
It's just a script - maybe turn on some debug options "set -xv"
 
Old 05-12-2017, 09:59 PM   #5
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by syg00 View Post
That's a worry - I've heard of grub-install taking inordinate time (usually searching for a floppy drive), but not mkconfig.
It's just a script - maybe turn on some debug options "set -xv"
I turned on that option but it didn't provide any useful info.

Here is the output:
Code:
[mak@myhost ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg "set -xv"
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image(s) in /boot: initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
Found Arch Linux (rolling) on /dev/sda3
Found Manjaro Linux (17.0.1) on /dev/sdb2
Found Arch Linux on /dev/sdb3
done
[mak@myhost ~]$
During the 20 minutes update the fan becomes very loud. I turned on the "top" command and I noticed "grub-mount" uses 100% cpu. I don't know this has any relevance.
Code:
PID USER      PR  NI    VIRT    RES  %CPU %MEM     TIME+ S COMMAND            
  415 mak       20   0 2278.2m 209.8m   0.7  3.5   6:05.55 S                  + 
11456 mak       20   0   42.8m   3.7m   0.7  0.1   0:00.19 R              `- t+ 
11247 root      20   0   49.6m  26.2m 100.0  0.4   9:07.77 R      `- grub-mount 
 6569 mak       20   0 1088.6m 165.4m   0.7  2.8   1:27.26 S                  + 
 7635 mak       20   0 1237.7m 340.9m   0.7  5.7   2:53.60 S

Last edited by jozmak; 05-12-2017 at 10:10 PM.
 
Old 05-12-2017, 10:10 PM   #6
Sefyir
Member
 
Registered: Mar 2015
Distribution: Linux Mint
Posts: 634

Rep: Reputation: 316Reputation: 316Reputation: 316Reputation: 316
Quote:
Originally Posted by jozmak View Post
I turned on that option but it didn't provide any useful info.

Here is the output:
Code:
[mak@myhost ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg "set -xv"
[...]
[mak@myhost ~]$
Not sure what you're trying to do there...
Maybe edit grub-mkconfig and at the very top include "set -xv"? (Remove this after you have run it).
If it takes awhile to "find" it, that might the troublemaker

whereis will show you where it is located

Code:
whereis grub-mkconfig
Perhaps watch the program and see if there's a particular one that takes awhile to show up?
 
Old 05-12-2017, 10:55 PM   #7
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,945

Rep: Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070
My Fedora doesn't have grub[2]-mount. I'll go fire up an x86 Arch system sometime.
Hmmm - I see several bugzilla entries for this. Looks like a os-prober issue. BTW I've never had this on any system - I use Arch a fair bit, but not Manjaro, and all (x86) machines have several different systems, Linux and Windows.
Try pre-mounting all the system partitions and see if that helps.
 
Old 05-12-2017, 10:59 PM   #8
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by Sefyir View Post
Not sure what you're trying to do there...
Maybe edit grub-mkconfig and at the very top include "set -xv"? (Remove this after you have run it).
If it takes awhile to "find" it, that might the troublemaker

whereis will show you where it is located

Code:
whereis grub-mkconfig
Perhaps watch the program and see if there's a particular one that takes awhile to show up?
Thanks for telling me how to do it.
Here is the output:

Code:
[mak@myhost ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
set -e
+ set -e

# Generate grub.cfg by inspecting /boot contents.
# 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"
+ prefix=/usr
exec_prefix="/usr"
+ exec_prefix=/usr
datarootdir="/usr/share"
+ datarootdir=/usr/share

prefix="/usr"
+ prefix=/usr
exec_prefix="/usr"
+ exec_prefix=/usr
sbindir="/usr/bin"
+ sbindir=/usr/bin
bindir="/usr/bin"
+ bindir=/usr/bin
sysconfdir="/etc"
+ sysconfdir=/etc
PACKAGE_NAME=GRUB
+ PACKAGE_NAME=GRUB
PACKAGE_VERSION=2.02
+ PACKAGE_VERSION=2.02
host_os=linux-gnu
+ host_os=linux-gnu
datadir="${datarootdir}"
+ datadir=/usr/share
if [ "x$pkgdatadir" = x ]; then
    pkgdatadir="${datadir}/grub"
fi
+ '[' x = x ']'
+ pkgdatadir=/usr/share/grub
# export it for scripts
export pkgdatadir
+ export pkgdatadir

grub_cfg=""
+ grub_cfg=
grub_mkconfig_dir="${sysconfdir}"/grub.d
+ grub_mkconfig_dir=/etc/grub.d

self=`basename $0`
++ basename /usr/bin/grub-mkconfig
+ self=grub-mkconfig

grub_probe="${sbindir}/grub-probe"
+ grub_probe=/usr/bin/grub-probe
grub_file="${bindir}/grub-file"
+ grub_file=/usr/bin/grub-file
grub_editenv="${bindir}/grub-editenv"
+ grub_editenv=/usr/bin/grub-editenv
grub_script_check="${bindir}/grub-script-check"
+ grub_script_check=/usr/bin/grub-script-check

export TEXTDOMAIN=grub
+ export TEXTDOMAIN=grub
+ TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"
+ export TEXTDOMAINDIR=/usr/share/locale
+ TEXTDOMAINDIR=/usr/share/locale

. "${pkgdatadir}/grub-mkconfig_lib"
+ . /usr/share/grub/grub-mkconfig_lib
# Helper library for grub-mkconfig
# Copyright (C) 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"
++ prefix=/usr
exec_prefix="/usr"
++ exec_prefix=/usr
datarootdir="/usr/share"
++ datarootdir=/usr/share
datadir="${datarootdir}"
++ datadir=/usr/share
bindir="/usr/bin"
++ bindir=/usr/bin
sbindir="/usr/bin"
++ sbindir=/usr/bin
if [ "x$pkgdatadir" = x ]; then
    pkgdatadir="${datadir}/grub"
fi
++ '[' x/usr/share/grub = x ']'

if test "x$grub_probe" = x; then
  grub_probe="${sbindir}/grub-probe"
fi
++ test x/usr/bin/grub-probe = x
if test "x$grub_file" = x; then
  grub_file="${bindir}/grub-file"
fi
++ test x/usr/bin/grub-file = x
if test "x$grub_mkrelpath" = x; then
  grub_mkrelpath="${bindir}/grub-mkrelpath"
fi
++ test x = x
++ grub_mkrelpath=/usr/bin/grub-mkrelpath

if which gettext >/dev/null 2>/dev/null; then
  :
else
  gettext () {
     printf "%s" "$@"
  }
fi
++ which gettext
++ :

grub_warn ()
{
  echo "$(gettext "Warning:")" "$@" >&2
}

make_system_path_relative_to_its_root ()
{
  "${grub_mkrelpath}" "$1"
}

is_path_readable_by_grub ()
{
  path="$1"

  # abort if path doesn't exist
  if test -e "$path" ; then : ;else
    return 1
  fi

  # abort if file is in a filesystem we can't read
  if "${grub_probe}" -t fs "$path" > /dev/null 2>&1 ; then : ; else
    return 1
  fi

  # ... or if we can't figure out the abstraction module, for example if
  # memberlist fails on an LVM volume group.
  if abstractions="`"${grub_probe}" -t abstraction "$path"`" 2> /dev/null ; then 
      :
  else
    return 1
  fi

  if [ x$GRUB_ENABLE_CRYPTODISK = xy ]; then
      return 0
  fi
  
  for abstraction in $abstractions; do
      if [ "x$abstraction" = xcryptodisk ]; then
	  return 1
      fi
  done

  return 0
}

convert_system_path_to_grub_path ()
{
  path="$1"

  grub_warn "convert_system_path_to_grub_path() is deprecated.  Use prepare_grub_to_access_device() instead."

  # abort if GRUB can't access the path
  if is_path_readable_by_grub "${path}" ; then : ; else
    return 1
  fi

  if drive="`"${grub_probe}" -t drive "$path"`" ; then : ; else
    return 1
  fi

  if relative_path="`make_system_path_relative_to_its_root "$path"`" ; then : ; else
    return 1
  fi

  echo "${drive}${relative_path}"
}

save_default_entry ()
{
  if [ "x${GRUB_SAVEDEFAULT}" = "xtrue" ] ; then
    cat << EOF
savedefault
EOF
  fi
}

prepare_grub_to_access_device ()
{
  old_ifs="$IFS"
  IFS='
'
  partmap="`"${grub_probe}" --device $@ --target=partmap`"
  for module in ${partmap} ; do
    case "${module}" in
      netbsd | openbsd)
        echo "insmod part_bsd";;
      *)
        echo "insmod part_${module}";;
    esac
  done

  # Abstraction modules aren't auto-loaded.
  abstraction="`"${grub_probe}" --device $@ --target=abstraction`"
  for module in ${abstraction} ; do
    echo "insmod ${module}"
  done

  fs="`"${grub_probe}" --device $@ --target=fs`"
  for module in ${fs} ; do
    echo "insmod ${module}"
  done

  if [ x$GRUB_ENABLE_CRYPTODISK = xy ]; then
      for uuid in `"${grub_probe}" --device $@ --target=cryptodisk_uuid`; do
	  echo "cryptomount -u $uuid"
      done
  fi

  # If there's a filesystem UUID that GRUB is capable of identifying, use it;
  # otherwise set root as per value in device.map.
  fs_hint="`"${grub_probe}" --device $@ --target=compatibility_hint`"
  if [ "x$fs_hint" != x ]; then
    echo "set root='$fs_hint'"
  fi
  if fs_uuid="`"${grub_probe}" --device $@ --target=fs_uuid 2> /dev/null`" ; then
    hints="`"${grub_probe}" --device $@ --target=hints_string 2> /dev/null`" || hints=
    echo "if [ x\$feature_platform_search_hint = xy ]; then"
    echo "  search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
    echo "else"
    echo "  search --no-floppy --fs-uuid --set=root ${fs_uuid}"
    echo "fi"
  fi
  IFS="$old_ifs"
}

grub_get_device_id ()
{
  old_ifs="$IFS"
  IFS='
'
  device="$1"
  if fs_uuid="`"${grub_probe}" --device ${device} --target=fs_uuid 2> /dev/null`" ; then
    echo "$fs_uuid";
  else
    echo $device |sed 's, ,_,g'
  fi
  IFS="$old_ifs"
}

grub_file_is_not_garbage ()
{
  if test -f "$1" ; then
    case "$1" in
      *.dpkg-*) return 1 ;; # debian dpkg
      *.rpmsave|*.rpmnew) return 1 ;;
      README*|*/README*)  return 1 ;; # documentation
    esac
  else
    return 1
  fi
  return 0
}

version_sort ()
{
  case $version_sort_sort_has_v in
    yes)
      LC_ALL=C sort -V;;
    no)
      LC_ALL=C sort -n;;
    *)
      if sort -V </dev/null > /dev/null 2>&1; then
        version_sort_sort_has_v=yes
	LC_ALL=C sort -V
      else
        version_sort_sort_has_v=no
        LC_ALL=C sort -n
      fi;;
   esac
}

version_test_numeric ()
{
  version_test_numeric_a="$1"
  version_test_numeric_cmp="$2"
  version_test_numeric_b="$3"
  if [ "$version_test_numeric_a" = "$version_test_numeric_b" ] ; then
    case "$version_test_numeric_cmp" in
      ge|eq|le) return 0 ;;
      gt|lt) return 1 ;;
    esac
  fi
  if [ "$version_test_numeric_cmp" = "lt" ] ; then
    version_test_numeric_c="$version_test_numeric_a"
    version_test_numeric_a="$version_test_numeric_b"
    version_test_numeric_b="$version_test_numeric_c"
  fi
  if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then
    return 0
  else
    return 1
  fi
}

version_test_gt ()
{
  version_test_gt_a="`echo "$1" | sed -e "s/[^-]*-//"`"
  version_test_gt_b="`echo "$2" | sed -e "s/[^-]*-//"`"
  version_test_gt_cmp=gt
  if [ "x$version_test_gt_b" = "x" ] ; then
    return 0
  fi
  case "$version_test_gt_a:$version_test_gt_b" in
    *.old:*.old) ;;
    *.old:*) version_test_gt_a="`echo "$version_test_gt_a" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=gt ;;
    *:*.old) version_test_gt_b="`echo "$version_test_gt_b" | sed -e 's/\.old$//'`" ; version_test_gt_cmp=ge ;;
  esac
  version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$version_test_gt_b"
  return "$?"
}

version_find_latest ()
{
  version_find_latest_a=""
  for i in "$@" ; do
    if version_test_gt "$i" "$version_find_latest_a" ; then
      version_find_latest_a="$i"
    fi
  done
  echo "$version_find_latest_a"
}

# One layer of quotation is eaten by "" and the second by sed; so this turns
# ' into \'.
grub_quote () {
  sed "s/'/'\\\\''/g"
}

gettext_quoted () {
  gettext "$@" | grub_quote
}

# Run the first argument through gettext, and then pass that and all
# remaining arguments to printf.  This is a useful abbreviation and tends to
# be easier to type.
gettext_printf () {
  gettext_printf_format="$1"
  shift
  printf "$(gettext "$gettext_printf_format")" "$@"
}

uses_abstraction () {
  device="$1"
  old_ifs="$IFS"
  IFS='
'

  abstraction="`"${grub_probe}" --device ${device} --target=abstraction`"
  for module in ${abstraction}; do
    if test "x${module}" = "x$2"; then
      IFS="$old_ifs"
      return 0
    fi
  done
  IFS="$old_ifs"
  return 1
}

print_option_help () {
  if test x$print_option_help_wc = x; then
      if wc -L  </dev/null > /dev/null 2>&1; then
	  print_option_help_wc=-L
      elif wc -m  </dev/null > /dev/null 2>&1; then
	  print_option_help_wc=-m
      else
	  print_option_help_wc=-b
      fi
  fi
  if test x$grub_have_fmt = x; then
      if fmt -w 40  </dev/null > /dev/null 2>&1; then
	  grub_have_fmt=y;
      else
	  grub_have_fmt=n;
      fi
  fi
  print_option_help_lead="  $1"
  print_option_help_lspace="$(echo "$print_option_help_lead" | wc $print_option_help_wc)"
  print_option_help_fill="$((26 - print_option_help_lspace))"
  printf "%s" "$print_option_help_lead"
  if test $print_option_help_fill -le 0; then
      print_option_help_nl=y
      echo
  else
      print_option_help_i=0;
      while test $print_option_help_i -lt $print_option_help_fill; do
      printf " "
	  print_option_help_i=$((print_option_help_i+1))
      done
      print_option_help_nl=n
  fi
  if test x$grub_have_fmt = xy; then
      print_option_help_split="$(echo "$2" | fmt -w 50)"
  else
      print_option_help_split="$2"
  fi
  if test x$print_option_help_nl = xy; then
      echo "$print_option_help_split" | awk \
	  '{ print "                          " $0; }'
  else
      echo "$print_option_help_split" | awk 'BEGIN   { n = 0 }
  { if (n == 1) print "                          " $0; else print $0; n = 1 ; }'
  fi
}

grub_fmt () {
  if test x$grub_have_fmt = x; then
      if fmt -w 40 < /dev/null > /dev/null; then
	  grub_have_fmt=y;
      else
	  grub_have_fmt=n;
      fi
  fi

  if test x$grub_have_fmt = xy; then
      fmt
  else
      cat
  fi
}

grub_tab="	"
++ grub_tab='	'

grub_add_tab () {
  sed -e "s/^/$grub_tab/"
}


# Usage: usage
# Print the usage.
usage () {
    gettext_printf "Usage: %s [OPTION]\n" "$self"
    gettext "Generate a grub config file"; echo
    echo
    print_option_help "-o, --output=$(gettext FILE)" "$(gettext "output generated config to FILE [default=stdout]")"
    print_option_help "-h, --help" "$(gettext "print this message and exit")"
    print_option_help "-v, --version" "$(gettext "print the version information and exit")"
    echo
    gettext "Report bugs to <bug-grub@gnu.org>."; echo
}

argument () {
  opt=$1
  shift

  if test $# -eq 0; then
      gettext_printf "%s: option requires an argument -- \`%s'\n" "$self" "$opt" 1>&2
      exit 1
  fi
  echo $1
}

# Check the arguments.
while test $# -gt 0
do
    option=$1
    shift

    case "$option" in
    -h | --help)
	usage
	exit 0 ;;
    -V | --version)
	echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
	exit 0 ;;
    -o | --output)
	grub_cfg=`argument $option "$@"`; shift;;
    --output=*)
	grub_cfg=`echo "$option" | sed 's/--output=//'`
	;;
    -*)
	gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
	usage
	exit 1
	;;
    # Explicitly ignore non-option arguments, for compatibility.
    esac
done
+ test 2 -gt 0
+ option=-o
+ shift
+ case "$option" in
++ argument -o /boot/grub/grub.cfg
++ opt=-o
++ shift
++ test 1 -eq 0
++ echo /boot/grub/grub.cfg
+ grub_cfg=/boot/grub/grub.cfg
+ shift
+ test 0 -gt 0

if [ "x$EUID" = "x" ] ; then
  EUID=`id -u`
fi
+ '[' x0 = x ']'

if [ "$EUID" != 0 ] ; then
  root=f
  case "`uname 2>/dev/null`" in
    CYGWIN*)
      # Cygwin: Assume root if member of admin group
      for g in `id -G 2>/dev/null` ; do
	case $g in
	  0|544) root=t ;;
	esac
      done ;;
  esac
  if [ $root != t ] ; then
    gettext_printf "%s: You must run this as root\n" "$self" >&2
    exit 1
  fi
fi
+ '[' 0 '!=' 0 ']'

set $grub_probe dummy
+ set /usr/bin/grub-probe dummy
if test -f "$1"; then
    :
else
    gettext_printf "%s: Not found.\n" "$1" 1>&2
    exit 1
fi
+ test -f /usr/bin/grub-probe
+ :

# Device containing our userland.  Typically used for root= parameter.
GRUB_DEVICE="`${grub_probe} --target=device /`"
++ /usr/bin/grub-probe --target=device /
+ GRUB_DEVICE=/dev/sda2
GRUB_DEVICE_UUID="`${grub_probe} --device ${GRUB_DEVICE} --target=fs_uuid 2> /dev/null`" || true
++ /usr/bin/grub-probe --device /dev/sda2 --target=fs_uuid
+ GRUB_DEVICE_UUID=14de3fcf-edb9-40a1-9d18-a6ec0817c3e3

# Device containing our /boot partition.  Usually the same as GRUB_DEVICE.
GRUB_DEVICE_BOOT="`${grub_probe} --target=device /boot`"
++ /usr/bin/grub-probe --target=device /boot
+ GRUB_DEVICE_BOOT=/dev/sda2
GRUB_DEVICE_BOOT_UUID="`${grub_probe} --device ${GRUB_DEVICE_BOOT} --target=fs_uuid 2> /dev/null`" || true
++ /usr/bin/grub-probe --device /dev/sda2 --target=fs_uuid
+ GRUB_DEVICE_BOOT_UUID=14de3fcf-edb9-40a1-9d18-a6ec0817c3e3

# Filesystem for the device containing our userland.  Used for stuff like
# choosing Hurd filesystem module.
GRUB_FS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2> /dev/null || echo unknown`"
++ /usr/bin/grub-probe --device /dev/sda2 --target=fs
+ GRUB_FS=ext2

if [ x"$GRUB_FS" = xunknown ]; then
    GRUB_FS="$(stat -f --printf=%T / || echo unknown)"
fi
+ '[' xext2 = xunknown ']'

if test -f ${sysconfdir}/default/grub ; then
  . ${sysconfdir}/default/grub
fi
+ test -f /etc/default/grub
+ . /etc/default/grub
GRUB_DEFAULT=0
++ GRUB_DEFAULT=0
GRUB_TIMEOUT=5
++ GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="Arch"
++ GRUB_DISTRIBUTOR=Arch
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
++ GRUB_CMDLINE_LINUX_DEFAULT=quiet
GRUB_CMDLINE_LINUX=""
++ GRUB_CMDLINE_LINUX=

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
++ GRUB_PRELOAD_MODULES='part_gpt part_msdos'

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console
++ GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto
++ GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep
++ GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter 
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx" 
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true
++ GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors.  Used by normal and wallpaper 
# modes only.  Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
#GRUB_BACKGROUND="/path/to/wallpaper"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

#GRUB_SAVEDEFAULT="true"

# XXX: should this be deprecated at some point?
if [ "x${GRUB_TERMINAL}" != "x" ] ; then
  GRUB_TERMINAL_INPUT="${GRUB_TERMINAL}"
  GRUB_TERMINAL_OUTPUT="${GRUB_TERMINAL}"
fi
+ '[' x '!=' x ']'

termoutdefault=0
+ termoutdefault=0
if [ "x${GRUB_TERMINAL_OUTPUT}" = "x" ]; then
    GRUB_TERMINAL_OUTPUT=gfxterm;
    termoutdefault=1;
fi
+ '[' x = x ']'
+ GRUB_TERMINAL_OUTPUT=gfxterm
+ termoutdefault=1

for x in ${GRUB_TERMINAL_OUTPUT}; do
    case "x${x}" in
	xgfxterm) ;;
	xconsole | xserial | xofconsole | xvga_text)
            # make sure all our children behave in conformance with ascii..
	    export LANG=C;;
	*) echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&2 ; exit 1 ;;
    esac
done
+ for x in ${GRUB_TERMINAL_OUTPUT}
+ case "x${x}" in

GRUB_ACTUAL_DEFAULT="$GRUB_DEFAULT"
+ GRUB_ACTUAL_DEFAULT=0

if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ s,^saved_entry=,,p'`" ; fi
+ '[' x0 = xsaved ']'


# These are defined in this script, export them here so that user can
# override them.
export GRUB_DEVICE \
  GRUB_DEVICE_UUID \
  GRUB_DEVICE_BOOT \
  GRUB_DEVICE_BOOT_UUID \
  GRUB_FS \
  GRUB_FONT \
  GRUB_PRELOAD_MODULES \
  GRUB_ACTUAL_DEFAULT
+ export GRUB_DEVICE GRUB_DEVICE_UUID GRUB_DEVICE_BOOT GRUB_DEVICE_BOOT_UUID GRUB_FS GRUB_FONT GRUB_PRELOAD_MODULES GRUB_ACTUAL_DEFAULT

# These are optional, user-defined variables.
export GRUB_DEFAULT \
  GRUB_HIDDEN_TIMEOUT \
  GRUB_HIDDEN_TIMEOUT_QUIET \
  GRUB_TIMEOUT \
  GRUB_TIMEOUT_STYLE \
  GRUB_DEFAULT_BUTTON \
  GRUB_HIDDEN_TIMEOUT_BUTTON \
  GRUB_TIMEOUT_BUTTON \
  GRUB_TIMEOUT_STYLE_BUTTON \
  GRUB_BUTTON_CMOS_ADDRESS \
  GRUB_BUTTON_CMOS_CLEAN \
  GRUB_DISTRIBUTOR \
  GRUB_CMDLINE_LINUX \
  GRUB_CMDLINE_LINUX_DEFAULT \
  GRUB_CMDLINE_XEN \
  GRUB_CMDLINE_XEN_DEFAULT \
  GRUB_CMDLINE_LINUX_XEN_REPLACE \
  GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT \
  GRUB_CMDLINE_NETBSD \
  GRUB_CMDLINE_NETBSD_DEFAULT \
  GRUB_CMDLINE_GNUMACH \
  GRUB_TERMINAL_INPUT \
  GRUB_TERMINAL_OUTPUT \
  GRUB_SERIAL_COMMAND \
  GRUB_DISABLE_LINUX_UUID \
  GRUB_DISABLE_RECOVERY \
  GRUB_VIDEO_BACKEND \
  GRUB_GFXMODE \
  GRUB_BACKGROUND \
  GRUB_THEME \
  GRUB_GFXPAYLOAD_LINUX \
  GRUB_DISABLE_OS_PROBER \
  GRUB_COLOR_NORMAL \
  GRUB_COLOR_HIGHLIGHT \
  GRUB_INIT_TUNE \
  GRUB_SAVEDEFAULT \
  GRUB_ENABLE_CRYPTODISK \
  GRUB_BADRAM \
  GRUB_OS_PROBER_SKIP_LIST \
  GRUB_DISABLE_SUBMENU
+ export GRUB_DEFAULT GRUB_HIDDEN_TIMEOUT GRUB_HIDDEN_TIMEOUT_QUIET GRUB_TIMEOUT GRUB_TIMEOUT_STYLE GRUB_DEFAULT_BUTTON GRUB_HIDDEN_TIMEOUT_BUTTON GRUB_TIMEOUT_BUTTON GRUB_TIMEOUT_STYLE_BUTTON GRUB_BUTTON_CMOS_ADDRESS GRUB_BUTTON_CMOS_CLEAN GRUB_DISTRIBUTOR GRUB_CMDLINE_LINUX GRUB_CMDLINE_LINUX_DEFAULT GRUB_CMDLINE_XEN GRUB_CMDLINE_XEN_DEFAULT GRUB_CMDLINE_LINUX_XEN_REPLACE GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT GRUB_CMDLINE_NETBSD GRUB_CMDLINE_NETBSD_DEFAULT GRUB_CMDLINE_GNUMACH GRUB_TERMINAL_INPUT GRUB_TERMINAL_OUTPUT GRUB_SERIAL_COMMAND GRUB_DISABLE_LINUX_UUID GRUB_DISABLE_RECOVERY GRUB_VIDEO_BACKEND GRUB_GFXMODE GRUB_BACKGROUND GRUB_THEME GRUB_GFXPAYLOAD_LINUX GRUB_DISABLE_OS_PROBER GRUB_COLOR_NORMAL GRUB_COLOR_HIGHLIGHT GRUB_INIT_TUNE GRUB_SAVEDEFAULT GRUB_ENABLE_CRYPTODISK GRUB_BADRAM GRUB_OS_PROBER_SKIP_LIST GRUB_DISABLE_SUBMENU

if test "x${grub_cfg}" != "x"; then
  rm -f "${grub_cfg}.new"
  oldumask=$(umask); umask 077
  exec > "${grub_cfg}.new"
  umask $oldumask
fi
+ test x/boot/grub/grub.cfg '!=' x
+ rm -f /boot/grub/grub.cfg.new
++ umask
+ oldumask=0022
+ umask 077
+ exec
+ umask 0022
gettext "Generating grub configuration file ..." >&2
+ gettext 'Generating grub configuration file ...'
Generating grub configuration file ...echo >&2
+ echo


cat << EOF
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by $self using templates
# from ${grub_mkconfig_dir} and settings from ${sysconfdir}/default/grub
#
EOF
+ cat


for i in "${grub_mkconfig_dir}"/* ; do
  case "$i" in
    # emacsen backup files. FIXME: support other editors
    *~) ;;
    # emacsen autosave files. FIXME: support other editors
    */\#*\#) ;;
    *)
      if grub_file_is_not_garbage "$i" && test -x "$i" ; then
        echo
        echo "### BEGIN $i ###"
        "$i"
        echo "### END $i ###"
      fi
    ;;
  esac
done
+ for i in "${grub_mkconfig_dir}"/*
+ case "$i" in
+ grub_file_is_not_garbage /etc/grub.d/00_header
+ test -f /etc/grub.d/00_header
+ case "$1" in
+ return 0
+ test -x /etc/grub.d/00_header
+ echo
+ echo '### BEGIN /etc/grub.d/00_header ###'
+ /etc/grub.d/00_header
+ echo '### END /etc/grub.d/00_header ###'
+ for i in "${grub_mkconfig_dir}"/*
+ case "$i" in
+ grub_file_is_not_garbage /etc/grub.d/10_linux
+ test -f /etc/grub.d/10_linux
+ case "$1" in
+ return 0
+ test -x /etc/grub.d/10_linux
+ echo
+ echo '### BEGIN /etc/grub.d/10_linux ###'
+ /etc/grub.d/10_linux
Found linux image: /boot/vmlinuz-linux
Found initrd image(s) in /boot: initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
+ echo '### END /etc/grub.d/10_linux ###'
+ for i in "${grub_mkconfig_dir}"/*
+ case "$i" in
+ grub_file_is_not_garbage /etc/grub.d/20_linux_xen
+ test -f /etc/grub.d/20_linux_xen
+ case "$1" in
+ return 0
+ test -x /etc/grub.d/20_linux_xen
+ echo
+ echo '### BEGIN /etc/grub.d/20_linux_xen ###'
+ /etc/grub.d/20_linux_xen
+ echo '### END /etc/grub.d/20_linux_xen ###'
+ for i in "${grub_mkconfig_dir}"/*
+ case "$i" in
+ grub_file_is_not_garbage /etc/grub.d/30_os-prober
+ test -f /etc/grub.d/30_os-prober
+ case "$1" in
+ return 0
+ test -x /etc/grub.d/30_os-prober
+ echo
+ echo '### BEGIN /etc/grub.d/30_os-prober ###'
+ /etc/grub.d/30_os-prober
Found Arch Linux (rolling) on /dev/sda3
Found Manjaro Linux (17.0.1) on /dev/sdb2
Found Arch Linux on /dev/sdb3
+ echo '### END /etc/grub.d/30_os-prober ###'
+ for i in "${grub_mkconfig_dir}"/*
+ case "$i" in
+ grub_file_is_not_garbage /etc/grub.d/40_custom
+ test -f /etc/grub.d/40_custom
+ case "$1" in
+ return 0
+ test -x /etc/grub.d/40_custom
+ echo
+ echo '### BEGIN /etc/grub.d/40_custom ###'
+ /etc/grub.d/40_custom
+ echo '### END /etc/grub.d/40_custom ###'
+ for i in "${grub_mkconfig_dir}"/*
+ case "$i" in
+ grub_file_is_not_garbage /etc/grub.d/41_custom
+ test -f /etc/grub.d/41_custom
+ case "$1" in
+ return 0
+ test -x /etc/grub.d/41_custom
+ echo
+ echo '### BEGIN /etc/grub.d/41_custom ###'
+ /etc/grub.d/41_custom
+ echo '### END /etc/grub.d/41_custom ###'
+ for i in "${grub_mkconfig_dir}"/*
+ case "$i" in
+ grub_file_is_not_garbage /etc/grub.d/README
+ test -f /etc/grub.d/README
+ case "$1" in
+ return 1

if test "x${grub_cfg}" != "x" ; then
  if ! ${grub_script_check} ${grub_cfg}.new; then
    # TRANSLATORS: %s is replaced by filename
    gettext_printf "Syntax errors are detected in generated GRUB config file.
Ensure that there are no errors in /etc/default/grub
and /etc/grub.d/* files or please file a bug report with
%s file attached." "${grub_cfg}.new" >&2
    echo >&2
    exit 1
  else
    # none of the children aborted with error, install the new grub.cfg
    mv -f ${grub_cfg}.new ${grub_cfg}
  fi
fi
+ test x/boot/grub/grub.cfg '!=' x
+ /usr/bin/grub-script-check /boot/grub/grub.cfg.new
+ mv -f /boot/grub/grub.cfg.new /boot/grub/grub.cfg

gettext "done" >&2
+ gettext done
doneecho >&2
+ echo

[mak@myhost ~]$
 
Old 05-13-2017, 05:30 AM   #9
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by syg00 View Post
My Fedora doesn't have grub[2]-mount. I'll go fire up an x86 Arch system sometime.
Hmmm - I see several bugzilla entries for this. Looks like a os-prober issue. BTW I've never had this on any system - I use Arch a fair bit, but not Manjaro, and all (x86) machines have several different systems, Linux and Windows.
Try pre-mounting all the system partitions and see if that helps.
Hi syg00,

I've never had this problem before. It started developing a couple of months ago.
 
Old 05-13-2017, 06:43 AM   #10
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Here are some new developments.
I unplugged the regular spinning harddrive and I made a grub update only with one harddrive (SSD) operational. The update was instantaneous. The update becomes painfully slow only when the second harddrive is plugged in. It seem there is some problem with the detection of the second harddrive.

I also experimented by plugging the harddrives in different interfaces - my motherboard has 4 sata interfaces. When I did this and made a grub update, grub mixed up the partitions. I don't know this is normal.

Look at the output below:
Code:
[mak@myhost ~]$ sudo grub-mkconfig -o /boot/grub/grub.cfg
[sudo] password for mak: 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-linux
Found initrd image(s) in /boot: initramfs-linux.img
Found fallback initrd image(s) in /boot: initramfs-linux-fallback.img
Found Manjaro Linux (17.0.1) on /dev/sda2
Found Arch Linux on /dev/sda3
Found Arch Linux (rolling) on /dev/sdb3
done
[mak@myhost ~]$
It detected Manjaro as /dev/sda2, when Manjaro is installed on /dev/sdb2
 
Old 05-13-2017, 06:58 AM   #11
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 20,945

Rep: Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070Reputation: 4070
I wonder if having two BIOS-boot partitions confuses things. I think UEFI for example insists there is only one EFI partition.
I would delete the unneeded one.

As for the drive changing address when moved onto a different interface, that is normal. It depends on how the BIOS enumerates the drive order.
 
Old 05-13-2017, 08:24 AM   #12
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by syg00 View Post
I wonder if having two BIOS-boot partitions confuses things. I think UEFI for example insists there is only one EFI partition.
I would delete the unneeded one.

As for the drive changing address when moved onto a different interface, that is normal. It depends on how the BIOS enumerates the drive order.
Thanks for the suggestion.

This set up worked for years without problem. I've never had any problem before.

I like this set up because if something goes wrong with the grub installation I can always boot any distro from the second harddrive.

I checked my bios. It shows the four sata interfaces like this:

Sata 1
Sata 2 > shows my SSD harddrive
Sata 3
Sata 4 > shows my regular harddrive

But in fact the regular harddrive plugged in the Sata 1 interface in the motherboard - if we count the actual physical interfaces from left to right. If this is the case than, the SSD card is in the right position but the regular harddrive is not. I tried to move the regular harddrive to the first position but there is option for that.

I don't know this has anything to do with the issue.
 
Old 05-13-2017, 08:32 AM   #13
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051Reputation: 6051
tl;dr

my experience is that this happens when

a) os-prober is installed
b) i have unused & unformatted partitions

os-prober seems to search the whole partition for some sign of some sort of bootloader, which apparently can take a very long time.
 
Old 05-13-2017, 05:29 PM   #14
jozmak
Member
 
Registered: Aug 2005
Posts: 81

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by ondoho View Post
tl;dr

my experience is that this happens when

a) os-prober is installed
b) i have unused & unformatted partitions

os-prober seems to search the whole partition for some sign of some sort of bootloader, which apparently can take a very long time.
Hi ondoho,

Thanks for the reply.
I made more experiments, this time I unplugged the SSD harddrive and I found that the slowness affects only the regular harddrive.
This is a brand new harddrive I just installed it yesterday.
Both harddrive have 2 distributions installed on them.
How is this possible?
 
Old 05-14-2017, 01:18 AM   #15
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,131
Blog Entries: 5

Rep: Reputation: 106Reputation: 106
My thoughts..
a) Can you include the "time" log parameter when you "sudo grub-mkconfig -o /boot/grub/grub.cfg"?. A time marker will show where it stucks.
b) Disconnect your PC from the WLAN/LAN (Internet) when you do it and inform if it is better.
 
  


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] X takes 1.5 minutes to start xterm and 3.5 minutes to start GNOME gregorian Linux - Newbie 16 12-25-2009 05:56 AM
ssh login takes several minutes exodist *BSD 10 05-26-2005 03:17 PM
X login is slow, takes 2 minutes jhcatch22 Linux - Newbie 3 07-08-2004 12:33 AM
xfree takes minutes to start snu Linux - Software 0 07-13-2003 09:26 AM
Xfree takes minutes to start snu Linux - Software 2 07-10-2003 11:55 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:07 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
Open Source Consulting | Domain Registration