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

Notices


Reply
  Search this Thread
Old 06-21-2011, 09:49 AM   #1
cccc
Senior Member
 
Registered: Sep 2003
Distribution: Debian Squeeze / Wheezy
Posts: 1,623

Rep: Reputation: 50
install Grub using Debian Live-CD


Hi

Howto install Grub into a squeeze partition instead of MBR using Debian Live-CD?
Is this the correct way?
Code:
# mount /dev/sda2 /mnt
# grub-install --force --root-directory=/mnt /dev/sda2

Last edited by cccc; 06-21-2011 at 09:52 AM.
 
Old 06-21-2011, 11:19 AM   #2
andrewthomas
Senior Member
 
Registered: May 2010
Location: Chicago Metro
Distribution: Arch, Gentoo, Slackware
Posts: 1,690

Rep: Reputation: 311Reputation: 311Reputation: 311Reputation: 311
You are correct.
 
1 members found this post helpful.
Old 03-08-2019, 11:03 AM   #3
ab1jx
LQ Newbie
 
Registered: Feb 2017
Posts: 10

Rep: Reputation: Disabled
Upvote that answer except:

It seems there's no "force" option anymore (2019), only force-lba.

I did
grub-install --root-directory=/lin /dev/sda3
and got
The file /lin/boot/grub/stage1 not read correctly.

[I have a Debian root in /dev/sda3, a /usr in /dev/sda9, which I mounted on /lin and /lin/usr before this.]

In /lin/boot/grub I see
drwxr-xr-x 2 root root 4096 Mar 8 15:21 .
drwxr-xr-x 4 root root 4096 Mar 8 03:50 ..
-rw-r--r-- 1 root root 197 Mar 8 15:21 default
-rw-r--r-- 1 root root 0 Mar 8 03:27 device.map
-rw-r--r-- 1 root root 8852 Mar 8 15:21 e2fs_stage1_5
-rw-r--r-- 1 root root 8628 Mar 8 15:21 fat_stage1_5
-rw-r--r-- 1 root root 9600 Mar 8 15:21 jfs_stage1_5
-rw-r--r-- 1 root root 8148 Mar 8 15:21 minix_stage1_5
-rw-r--r-- 1 root root 10644 Mar 8 15:21 reiserfs_stage1_5
-rw-r--r-- 1 root root 512 Mar 8 15:21 stage1
-rw-r--r-- 1 root root 120100 Mar 8 15:21 stage2
-rw-r--r-- 1 root root 10266 Mar 8 15:21 xfs_stage1_5

Stage1 at 512 bytes looks like maybe a bootsector as a file, just guessing.
Looking at it in the mc file viewer, it's not text at least.

But I run update-grub and I can't find any menu.lst anywhere. I don't
want/need a menu anyway.

Copied stage1 to the windows dir, set it up in boot.ini

Rebooted, got some floppy error from grub, should have done the --no-floppy
option I guess.

So trying
grub-install --no-floppy --root-directory=/lin /dev/sda3
with lin mounted to /dev/sda3 and /lin/usr to /dev/sda9

Outside the chroot I don't have grub-install, inside the chroot I don't
have /lin (It's now just /). Inside the chroot I can't see /dev/sda3 either,
fdisk -l returns nothing at all. So, installing grub outside the chroot
(live CD's ramdisk I guess).

did
grub-install --no-floppy --root-directory=/lin /dev/sda3
got
The file /lin/boot/grub/stage1 not read correctly.

Got a fresh stage1 anyway (by date/time)
mounted the windows partition, copied the new stage1 to it.

Rebooted, got the floppy error again. I was keeping notes on the machine in a text file, I sftped it over to a Pi to send.
 
Old 03-08-2019, 06:01 PM   #4
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 8,458

Rep: Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723Reputation: 1723
You responded to a thread that has been dead for almost 9 years. At that point I believe Debian was using Grub Legacy. If you have a recent version of Debian, it is using Grub2 and the commands and boot files are different. The output you posted for the boot/grub directory shows boot files for Grub Legacy. WHich release of Debian are you using? The update-grub command does not work on Grub Legacy. It is actually just a stub created by Ubuntu which runs the grub-mkconfig script.

Quote:
Copied stage1 to the windows dir, set it up in boot.ini
Did you use dd to copy the boot sector of that partition (Debian) and then put a boot entry in the xp boot.ini file for Debian? The last release that used boot.ini was xp, is that what you are using?

You need either a menu.lst or grub.conf file in the /boot/grub directory in order to boot with Grub Legacy. You don't have one.

You will need to answer the above questions and post more details on your system if you want help. Also, might start a new thread but that's up to the moderators.
 
Old 03-08-2019, 09:11 PM   #5
ab1jx
LQ Newbie
 
Registered: Feb 2017
Posts: 10

Rep: Reputation: Disabled
I got it eventually. Linux is so much more complicated than OpenBSD, but runs more stuff. And Raspbian has me spoiled where everything is an image you download, and boot, and clone.

I kept hammering away at the grub prompt, running over to another computer to look things up, until I got it booted. Then I did update-grub which worked flawlessly once I wasn't in a chroot and provided me with this grub.cfg which I'm copying around.

Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

### BEGIN /etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
  set have_grubenv=true
  load_env
fi
if [ "${next_entry}" ] ; then
   set default="${next_entry}"
   set next_entry=
   save_env next_entry
   set boot_once=true
else
   set default="0"
fi

if [ x"${feature_menuentry_id}" = xy ]; then
  menuentry_id_option="--id"
else
  menuentry_id_option=""
fi

export menuentry_id_option

if [ "${prev_saved_entry}" ]; then
  set saved_entry="${prev_saved_entry}"
  save_env saved_entry
  set prev_saved_entry=
  save_env prev_saved_entry
  set boot_once=true
fi

function savedefault {
  if [ -z "${boot_once}" ]; then
    saved_entry="${chosen}"
    save_env saved_entry
  fi
}
function load_video {
  if [ x$feature_all_video_module = xy ]; then
    insmod all_video
  else
    insmod efi_gop
    insmod efi_uga
    insmod ieee1275_fb
    insmod vbe
    insmod vga
    insmod video_bochs
    insmod video_cirrus
  fi
}

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod ext2
set root='hd0,msdos9'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-baremetal=ahci0,msdos9  b97b4a25-d147-4028-81b2-a21ca798c29f
else
  search --no-floppy --fs-uuid --set=root b97b4a25-d147-4028-81b2-a21ca798c29f
fi
    font="/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=auto
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=en_US
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=30
else
  if [ x$feature_timeout_style = xy ] ; then
    set timeout_style=menu
    set timeout=5
  # Fallback normal timeout code in case the timeout_style feature is
  # unavailable.
  else
    set timeout=5
  fi
fi
### END /etc/grub.d/00_header ###

### BEGIN /etc/grub.d/05_debian_theme ###
insmod part_msdos
insmod ext2
set root='hd0,msdos9'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos9 --hint-efi=hd0,msdos9 --hint-baremetal=ahci0,msdos9  b97b4a25-d147-4028-81b2-a21ca798c29f
else
  search --no-floppy --fs-uuid --set=root b97b4a25-d147-4028-81b2-a21ca798c29f
fi
insmod png
if background_image /share/desktop-base/softwaves-theme/grub/grub-4x3.png; then
  set color_normal=white/black
  set color_highlight=black/white
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
### END /etc/grub.d/05_debian_theme ###

### BEGIN /etc/grub.d/10_linux ###
function gfxmode {
	set gfxpayload="${1}"
}
set linux_gfx_mode=
export linux_gfx_mode
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-22419e26-e392-4e67-aff6-ed0519f0148a' {
	load_video
	insmod gzio
	if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
	insmod part_msdos
	insmod ext2
	set root='hd0,msdos3'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3  22419e26-e392-4e67-aff6-ed0519f0148a
	else
	  search --no-floppy --fs-uuid --set=root 22419e26-e392-4e67-aff6-ed0519f0148a
	fi
	echo	'Loading Linux 4.9.0-7-amd64 ...'
	linux	/boot/vmlinuz-4.9.0-7-amd64 root=UUID=22419e26-e392-4e67-aff6-ed0519f0148a ro  quiet
	echo	'Loading initial ramdisk ...'
	initrd	/boot/initrd.img-4.9.0-7-amd64
}
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option 'gnulinux-advanced-22419e26-e392-4e67-aff6-ed0519f0148a' {
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-7-amd64' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-7-amd64-advanced-22419e26-e392-4e67-aff6-ed0519f0148a' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3  22419e26-e392-4e67-aff6-ed0519f0148a
		else
		  search --no-floppy --fs-uuid --set=root 22419e26-e392-4e67-aff6-ed0519f0148a
		fi
		echo	'Loading Linux 4.9.0-7-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-7-amd64 root=UUID=22419e26-e392-4e67-aff6-ed0519f0148a ro  quiet
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-7-amd64
	}
	menuentry 'Debian GNU/Linux, with Linux 4.9.0-7-amd64 (recovery mode)' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.9.0-7-amd64-recovery-22419e26-e392-4e67-aff6-ed0519f0148a' {
		load_video
		insmod gzio
		if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
		insmod part_msdos
		insmod ext2
		set root='hd0,msdos3'
		if [ x$feature_platform_search_hint = xy ]; then
		  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos3 --hint-efi=hd0,msdos3 --hint-baremetal=ahci0,msdos3  22419e26-e392-4e67-aff6-ed0519f0148a
		else
		  search --no-floppy --fs-uuid --set=root 22419e26-e392-4e67-aff6-ed0519f0148a
		fi
		echo	'Loading Linux 4.9.0-7-amd64 ...'
		linux	/boot/vmlinuz-4.9.0-7-amd64 root=UUID=22419e26-e392-4e67-aff6-ed0519f0148a ro single 
		echo	'Loading initial ramdisk ...'
		initrd	/boot/initrd.img-4.9.0-7-amd64
	}
}

### END /etc/grub.d/10_linux ###

### BEGIN /etc/grub.d/20_linux_xen ###

### END /etc/grub.d/20_linux_xen ###

### BEGIN /etc/grub.d/30_os-prober ###
menuentry 'Windows NT/2000/XP (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-105B-5BFF' {
	insmod part_msdos
	insmod fat
	set root='hd0,msdos1'
	if [ x$feature_platform_search_hint = xy ]; then
	  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  105B-5BFF
	else
	  search --no-floppy --fs-uuid --set=root 105B-5BFF
	fi
	parttool ${root} hidden-
	drivemap -s (hd0) ${root}
	chainloader +1
}
### END /etc/grub.d/30_os-prober ###

### BEGIN /etc/grub.d/30_uefi-firmware ###
### END /etc/grub.d/30_uefi-firmware ###

### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###

### BEGIN /etc/grub.d/41_custom ###
if [ -f  ${config_directory}/custom.cfg ]; then
  source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f  $prefix/custom.cfg ]; then
  source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###
The official online manual was also useful: https://www.gnu.org/software/grub/manual/grub/grub.html

Last edited by ab1jx; 03-08-2019 at 09:43 PM. Reason: link to online manual
 
  


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
How to install GRUB only from Ubuntu 10.04 Live CD matrix13 Linux - Software 11 09-09-2012 09:55 PM
Debian Live on USB - GRUB Problems Diomedes Linux - General 17 10-08-2009 11:51 AM
Debian-Live install to hard disk rakamaka Linux - Newbie 5 02-21-2009 10:19 AM
Can I use Ubuntu Live CD to do a net-install of debian? hkl8324 Debian 9 02-26-2007 04:20 AM
Using Knoppix Live to fix Debian install dgrego Debian 5 06-25-2006 08:49 PM

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

All times are GMT -5. The time now is 09:59 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration