How to install Grub from a live Ubuntu cd
Ubuntu Forums – How to install Grub from a live Ubuntu cd.
This will restore grub if you already had grub installed but lost it to a windows install or some other occurence that erased/changed your MBR so that grub no longer appears at start up or it returns an error.
(This how to is written for Ubuntu but should work on other systems. The only thing to take note of, when you see “sudo” that will mean to you that the following command should be entered at a root terminal.)
Boot into the live Ubuntu cd. This can be the live installer cd or the older live session Ubuntu cds.
When you get to the desktop open a terminal and enter. (I am going to give you the commands and then I will explain them later)
sudo grub
This will get you a “grub>” prompt (i.e. the grub shell). At grub>. enter these commands
find /boot/grub/stage1
This will return a location. If you have more than one, select the installation that you want to provide the grub files.
Next, THIS IS IMPORTANT, whatever was returned for the find command use it in the next line (you are still at grub>. when you enter the next 3 commands)
root (hd?,?)
Again use the value from the find command i.e. if find returned (hd0,1) then you would enter root (hd0,1)
Next enter the command to install grub to the mbr
setup (hd0)
Finally exit the grub shell
quit
That is it. Grub will be installed to the mbr.
When you reboot, you will have the grub menu at startup.
Now the explanation.
Sudo grub gets you the grub shell.
Find /boot/grub/stage1 has grub locate the file stage1. What this does is tell us where grub’s files are. Only a small part of grub is located on the mbr, the rest of grub is in your boot folder. Grub needs those files to run the setup. So you find the files and then you tell grub where to locate the files it will need for setup.
So root (hd?,?) tells grub it’s files are on that partition.
Finally setup (hd0) tells grub to setup on hd0. When you give grub the parameter hd0 with no following value for a partition, grub will use the mbr. hd0 is the grub label for the first drive’s mbr.
Quit will exit you from the grub shell.
THIS IS AN EDIT. 5-HT MADE A GOOD POINT AND I AM JUST GOING TO COPY/PASTE IT HERE
| Just have recommendation to add that may be irrelevant: it might be of benefit to give an explicit warning (though it is mentioned) that this guide will write GRUB to the MBR (just in case someone is using a different boot loader on their MBR and would like to reinstall GRUB to a partition).
If someone wants GRUB on a partition, the ’setup (hd0)’ step can be modified to ’setup (hdX,Y)’. Where X is the hard disk, and Y the partition using GRUB’s nomenclature of starting from 0 (first partition=0, second=1,…). |
THIS IS ANOTHER EDIT. TOSK POSTED A WAY TO MOUNT PROC AND UDEV. THIS WAS NEEDED BECAUSE GRUB WASN’T RECOGNISING THE DRIVE. I THOUGHT IT WAS A VALUABLE COMMENT AND DECIDED TO PUT IT IN THE ORIGINAL POST SO PEOPLE WILL SEE IT AT THE TOP. IT MAY BE MISSED AS JUST A REPLY POST DOWN THE PAGE.
ALL KNOWLEDGE IS WELCOME!
| Mine was a slightly different story. I couldn’t get grub to find the stage1 file or even recognize my drive. So I borrowed some knowledge I picked up while using Gentoo:
You have to mount your root partition using the livecd: $ Code:
sudo mkdir /mnt/root $ Code:
sudo mount -t ext3 /dev/sda6 /mnt/root Then you have to mount the proc subsystem and udev inside /mnt/root also: $ Code:
sudo mount -t proc none /mnt/root/proc $ Code:
sudo mount -o bind /dev /mnt/root/dev Doing this allows grub to discover your drives. Next you have to chroot: $ Code:
sudo chroot /mnt/root /bin/bash Now that you’re chrooted into your drive as root everything should work. # Code:
sudo grub I edited in the sudo, just to be safe. When I enter grub and not sudo grub, grub cannot find the file. I do not know if the chroot changes this because I did not try it that way. In the end I figured it was better to err on the side of caution. Tosk I hope you don’t mind my editing of your reply. Code:
find /boot/grub/stage1 It found mine on (hd0,5) grub> Code:
root (hd0,5) It successfully scanned the partition and recognized the filesystem-type grub> Code:
setup (hd0) That was it. It installed and on reboot I was thrown back into Ubuntu. This might help some people who are having issues so I thought I would post it. PLEASE NOTE: My Ubuntu was installed to /dev/sda6. This may not be the same for everyone. /dev/sdaX means it’s SCSI/SATA/USB/FireWire drive. And it’s partition 6 because I have a weird partitioning scheme in place. –Tosk |
**This set of instruction is a combination of 2 guides I saw before. One was a Mepis grub how to but I never found it again. The other is the grub manual. It’s section explained the find, root, setup process but never mentioned it could be done from a live session.
【江碩涵、楊茲珺╱台北報導】近期法拍市場驚見凶宅,大台北有數戶屋主於屋內自然死亡、或自殺的法拍屋,台中更有1戶法拍屋由於債務人燒炭自殺,屋內還留 有白骨。法拍專家表示,凶宅在法拍市場詢問度極低,但對不信鬼神的買方來說,卻能大撿便宜,拍定價至少是市價打對折,一般民眾避買凶宅要勤做功課,多詢問 當地鄰居、仲介業者或轄區派出所。
小心為上
據《透明房訊》業務部副理吳彣表示,近期法拍市場陸續出現非自然死亡的法拍凶宅,但台中法拍屋內出現「白骨」且紀錄在筆錄內,確實少見也令人毛骨悚然,估計此案至少會歷經3、4拍,價格至少打5折之後,才會標出。
鎖定外國人脫售
104 法拍屋網經紀人江志亮表示,「被標示出來的凶宅,由於多次流標、價格誘人,還是有膽子大的投資客專門收購凶宅。」投資客標得凶宅後,一定會請法師到現場作 法,之後更改格局,「讓原來停留在此的好兄弟認不得」,此外,多裝修成歐洲、或地中海風格,最後賣出時,雖仍得告知買方為凶宅,但由於價格低、且鎖定具宗 教信仰的外國人,仍有獲利空間。
不過,一般民眾因為貪便宜不小心標到凶宅,大多無法克服心理因素,吳彣就說:「曾聽說客人不小心標到,只好捐出來 給宗教團體。」法拍屋由於沒有民法規範的「物的擔保瑕疵」,因此就算標到凶宅也只能認栽。江志亮表示,有些法拍屋公告在債務人一欄加註「遺產管理人」,有 可能是獨居屋主在屋內死亡多日,導致房貸沒繳而被查封,也要小心。
最快得知是否為凶宅的方法,是直接詢問鄰居、當地房仲業者及轄區派出所。
台北市政府警察局信義分局建議,若擔心買到凶宅,可直接到當地警察局分局向偵查隊鑑識小組申請調閱非自然死亡案件的檢察官、法醫相驗紀錄。
除此之外,「台灣凶宅網」是全台最多凶宅情資的網路平台 、台大批踢踢(telnet://ptt.cc)的房屋買賣討論區也有不少資訊。
隱瞞缺失可解約
一般房屋買賣較不擔心凶宅問題,台北縣政府法制局消保官楊舜惠表示,內政部制定的定型化契約中明定,受託人有義務替委託人調查房屋周邊環境,不得隱瞞房屋缺失與瑕疵。
楊舜惠說,依據消保法規定,凶宅屬於重大瑕疵,屋主和仲介業者有義務明確告知買家。若買家被刻意隱瞞,有權要求解約、退款。

