
Ubuntu日本語フォーラム

ログインしていません。
Ubuntu 9.10でgrub2でスクリプトがうまく変更できなく、見た目も以前のgrubの方がよかったのでgrub2を消してgrubに戻しました。
menu.lstを編集してメニューとスクリプトを変更しました。
それで再起動をしました。
うまくいったのですが
grubメニュー選択後に
boot from (hd0,0) ext4 5b...(省略)......
starting up.....
という画面が出て起動します。
この表示を表示しない
もしくは
starting up.....
boot from (hd0,0) ext4 5b...(省略)......
というふうに逆にして映したいです。
どこを編集すればよいでしょうか?
一応menu.lstの中身を書きます。
オフライン
# menu.lst - See: grub(8), info grub, update-grub(8)
# grub-install(8), grub-floppy(8),
# grub-md5-crypt, /usr/share/doc/grub
# and /usr/share/doc/grub-doc/.
## default num
# Set the default entry to the entry number NUM. Numbering starts from 0, and
# the entry number 0 is the default if the command is not used.
#
# You can specify 'saved' instead of a number. In this case, the default entry
# is the entry saved with the command 'savedefault'.
# WARNING: If you are using dmraid do not use 'savedefault' or your
# array will desync and will not let you boot your system.
default 0
# Boot automatically after 30 secs.
timeout 30
# Pretty colours
#color cyan/blue white/blue
## password ['--md5'] passwd
# If used in the first section of a menu file, disable all interactive editing
# control (menu entry editor and command-line) and entries protected by the
# command 'lock'
# e.g. password topsecret
# password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
# password topsecret
#
# examples
#
# title Windows 95/98/NT/2000
# root (hd0,0)
# makeactive
# chainloader +1
#
# title Linux
# root (hd0,1)
# kernel /vmlinuz root=/dev/hda2 ro
#
#
# Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
# Splash image
foreground = ffffff
background = 222222
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
### BEGIN AUTOMAGIC KERNELS LIST
## lines between the AUTOMAGIC KERNELS LIST markers will be modified
## by the debian update-grub script except for the default options below
## DO NOT UNCOMMENT THEM, Just edit them to your needs
オフライン
## ## Start Default Options ##
## default kernel options
## default kernel options for automagic boot options
## If you want special options for specific kernels use kopt_x_y_z
## where x.y.z is kernel version. Minor versions can be omitted.
## e.g. kopt=root=/dev/hda1 ro
## kopt_2_6_8=root=/dev/hdc1 ro
## kopt_2_6_8_2_686=root=/dev/hdc2 ro
# kopt=root=UUID=5b15aae3-7584-41fc-b2b9-0ddadd3c41f1 ro
## default grub root device
## e.g. groot=(hd0,0)
# groot=5b15aae3-7584-41fc-b2b9-0ddadd3c41f1
## should update-grub create alternative automagic boot options
## e.g. alternative=true
## alternative=false
# alternative=true
## should update-grub lock alternative automagic boot options
## e.g. lockalternative=true
## lockalternative=false
# lockalternative=false
## additional options to use with the default boot option, but not with the
## alternatives
## e.g. defoptions=vga=791 resume=/dev/hda5
# defoptions=quiet splash
## should update-grub lock old automagic boot options
## e.g. lockold=false
## lockold=true
# lockold=false
## Xen hypervisor options to use with the default Xen boot option
# xenhopt=
## Xen Linux kernel options to use with the default Xen boot option
# xenkopt=console=tty0
## altoption boot targets option
## multiple altoptions lines are allowed
## e.g. altoptions=(extra menu suffix) extra boot options
## altoptions=(recovery) single
# altoptions=(recovery mode) single
## controls how many kernels should be put into the menu.lst
## only counts the first occurence of a kernel, not the
## alternative kernel options
## e.g. howmany=all
## howmany=7
# howmany=all
## specify if running in Xen domU or have grub detect automatically
## update-grub will ignore non-xen kernels when running in domU and vice versa
## e.g. indomU=detect
## indomU=true
## indomU=false
# indomU=detect
## should update-grub create memtest86 boot option
## e.g. memtest86=true
## memtest86=false
# memtest86=true
## should update-grub adjust the value of the default booted system
## can be true or false
# updatedefaultentry=false
## should update-grub add savedefault to the default options
## can be true or false
# savedefault=false
オフライン
## ## End Default Options ##
title Ubuntu 9.10 start
uuid 5b15aae3-7584-41fc-b2b9-0ddadd3c41f1
kernel /boot/vmlinuz-2.6.31-20-generic root=UUID=5b15aae3-7584-41fc-b2b9-0ddadd3c41f1 ro quiet splash
initrd /boot/initrd.img-2.6.31-20-generic
title Ubuntu 9.10 start
uuid 5b15aae3-7584-41fc-b2b9-0ddadd3c41f1
kernel /boot/vmlinuz-2.6.31-14-generic root=UUID=5b15aae3-7584-41fc-b2b9-0ddadd3c41f1 ro single
initrd /boot/initrd.img-2.6.31-14-generic
title Ubuntu 9.10, memtest86+
uuid 5b15aae3-7584-41fc-b2b9-0ddadd3c41f1
kernel /boot/memtest86+.bin
### END DEBIAN AUTOMAGIC KERNELS LIST
オフライン
sony5614 による投稿:
boot from (hd0,0) ext4 5b...(省略)......
starting up.....
このメッセージは stage2 のバイナリファイルに埋め込まれているようですが
# strings /usr/lib/grub/i386-pc/stage2 | grep -n10 'Start'
# strings /usr/lib/grub/i386-pc/stage2 | grep -n10 'Boot from'
# などとすると確認できるかと思います。
http://www.gnu.org/software/grub/manual/grub.html#Command_002dline-and-menu-entry-commands
http://www.gnu.org/software/grub/manual/grub.html#Menu_002dspecific-commands
など眺めて見ましたが メッセージを 表示しないように設定したり、メッセージが出ない stage2 の作り方等はわかりませんでした。
それらしい項目が見つけられなかったので、少なくとも設定ファイルでどうこう出来る範囲のものではなさそうで、
stage2 でメッセージがが表示されないようにソースコードを改変し、リビルドしたりするしかない様子です。
(難しくて私はわかりかねます・・・)
オフライン
stage2をダンプして
Boot from
Mode 0x%x is not supported.
Switching to Mode 0x%x failed.
Whole file:
Partial read 1:
Partial read 2:
Header1 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x
Header2 = 0x%x, next = 0x%x, next = 0x%x, next = 0x%x
Max is 0x10ac0: i=0x%x, filepos=0x%x
Checking if "%s" exists...
(fd%d)
(hd%d,%d)
(hd%d,%d,%c)
Differ in size: 0x%x [%s], 0x%x [%s]
Differ at the offset %d: 0x%x [%s], 0x%x [%s]
Internal pager is now %s
--name=
--cursor-address=
--clear-screen=
--enter-standout-mode=
--exit-standout-mode=
name=%s
cursor_address=%s
clear_screen=%s
enter_standout_mode=%s
exit_standout_mode=%s
--dumb
--no-echo
--no-edit
--timeout=
--lines=
--silent
(no echo)
(no edit)
(dumb)
%s%s%s%s
Press any key to continue.
Splash image filename too large
Failed to set splash image and/or graphics mode
(%cd%d
--unit=
--speed=
--port=
--word=
--stop=
--parity=
even
fallback
(nd):
(hd%d
(fd%d):
./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
Encrypted: %s
--md5
--type=
netbsd
freebsd
openbsd
biglinux
multiboot
--no-mem-option
0x%x
--force-lba
Warning: the option `d' was not used, but the Stage 1 will be installed on a
different drive than the drive where the Stage 2 resides.
AERMH
%d sectors are embedded.
Running "embed %s"...
%s%s
succeeded
failed (this is not fatal)
--prefix=
/stage1
/boot/grub
/menu.lst
--force-lba
%s%s%s%s %s%s %s p %s %s
Running "install %s"...
succeeded
Done.
No MPS information found or probe failed
--all
%s: %s
blink-
--force
MSWIN
--no-apm
drive 0x%x: C/H/S = %d/%d/%d, The number of sectors = %d, %s
EISA Memory BIOS Interface is present
Address Map BIOS Interface is present
Lower memory: %uK, Upper memory (to first chipset hole): %uK
[Address Range Descriptor entries immediately follow (values are 64-bit)]
Reserved
Usable RAM
%s: Base Address: 0x%x X 4GB + 0x%x,
Length: 0x%x X 4GB + 0x%x bytes
Starting up ...
をhex editorで書き換えると良いかも。
旧grubでは起動できないPCなので検証できませんが、逆にネット環境似ないPCはgrubで起動できるのでUSB等でバイナリエディタを導入出来れば検証してみます。
オフライン
私はまだ足踏みです、環境が作れなくて、、、8.04で2度目の正直で検証を始めた所どうもバイナリが違うので、あれこれ時間を費やした後、、、あっ! Ext4を読めるのと読めないのと2つある事を思いだし9.04.isoを落としてやり直して見ます。
明日の夜以降かな?
上手く言ってもいかなくても報告はしますね。
オフライン
はい、
ありがとうございます。
Ubuntu 9.10 のUSBを作成してやり直したいともいます。
USBへの直接インストールとアップデートに時間がかかるのですぐには返事ができないかもしれませんがよろしくお願いします。
オフライン
取りあえずは形になりました。
「取りあえず形」と言うのは見た目の事で、変更に伴う不具合は考慮していません。
私の環境(通常起動出来る)では、変更後に不具合は出ていませんがシステムの変更(アップデートやパーティション、ファイルシステム)を行った場合に何らかの影響が出る可能性はあります。
得に上記の事を念頭に書く理由は、最初は細かい範囲で変更を加えて再起動を繰り替えしていたのですが、後半は疲れちゃてザクザクデータを削除したので、、、
逆に、ここから戻していくことで細かい範囲(最小限)での変更に止める様にも出来ますが後はお任せします。
以下に内容と、その他を書き残します。小難しい事は抜きで単純に行きます。
hex editor のインストール。
$ sudo apt-get install ghex
stage2の退避
$ sudo mv /boot/grub/stage2 /boot/grub/stage
作業用ファイルをホームに作る
$ sudo cp /boot/grub/stage ~/stage
ghexを起動してホームにコピーしたstageを読み込む。
エディタ左側の17B20 の行を表示させてください、右側の窓に「Boot from」の文字が確認できると思いますので「B」をマウスでクリックして選択してください。
そうすると真ん中の窓の数字に、見えにくいですがカーソルが当たります。 42と言う数時の4ですね。
カーソルは一字ずつ選択していますが、2文字でワンセットです。 42は4と2ではなく、隣の6Fは6とFでは有りません。
42 の位置は17B2Fとなりますがその辺の説明はパスします。
次に反転したカーソルが表示されている数字の4をクリックします。
カーソルが通常表示されて、文字列の「B」の方が反転表示されるのを確認して下さい。
キーボードから半角英数で 「 20 」と入力します、42の4を2に、42の2を0です、文字列の「B」が消えますのでBoot from が消えるまで繰り替えしてください。
deleteキーで消去すると起動出来なくなります、必ず何かと(今回は20)置き換えてください。
間違えた場合はメニューの「編集」から「元に戻す」が使えます
これで「Boot from」が消去されます。
次に17EC8の行の17ED6の位置、文字列では「(hd%d,」を20に書き換えます、作業後は以下の様になります。
,0) ext4 5b...(省略)......
starting up.....
実はここで行き詰まってUUID(5b...(省略)......)の場所を特定できていませんorz,
17F70の行、17F74から始まる「--no-mem-option」から「starting up...」の手前までの中にあるのですが、探さずに全て20に置き換えました。下記の状態のはずです。
,0) ext4
starting up.....
17B20の行の17B1Cにある「saved.,%d.,%c.)%s.」を20に置き換えます。
ここまでの過程で画面最上段右端に「Whole」改行されて左端に「file」と表示されていたので、これも20に置き換えました。
最初のBoot fromの近くでオフセット0x17B79です。
現状は以下になるはずです。
starting up...
0x182DAです。
これは変更を行っていません、再起動に疲れたのでパスしますが普通に置き換えて問題ないと思います。
保存します、出来れば作業途中にでも別名で保存すれば失敗したときのショックは少ないかも。
今回は適当にstage100で保存したとしましょう。
ホームにはノーマルなstageと変更したstage100が存在することになります。
/boot/grubのstageはもしもの時用なので触らずに居てください。
$ sudo cp ~/stage100 /boot/grub/stage2
完了です。
手違いで起動しなくなったときには、インストール時のカーネルのバージョンが/boot に存在することが条件ですが
https://wiki.ubuntulinux.jp/UbuntuTips/Others/RepairMbrWithGrub
で起動できます。
/usr/lib/grub/i386-pc/stage2 も変更しないと何かの拍子(grub-update)に元にもどされるかもしれません。
/boot/geub にあるstage とi386-pc/stage2は同一の物なので元に戻せられるので、念の為に変更を行った方が良いかも。
$ sudo cp -f ~/stage100 /usr/lib/grub/i386-pc/stage2
ぶっちゃけた話、0x17B1C ~ 0x182E4 まで全て置き換えても起動はするみたい
オフライン
20に変更すると
起動時に
oot from (hd0,0) ext4....
というふうに空欄になります。
その分、後ろに文字が一文字追加されてました。
やはり環境のちがいで私はboot fromの場所が17778の行にありました。
コピーしたstageはどこかに添付したほうがよろしいでしょうか?
オフライン
はい、確認しました。
検証は9.04でアップグレードをしたGRUBで行いました。
9.10の(GRUB2でないと起動できない)PCにGRUBをインストールして比較して見たところ、バージョンは同じ(GNU GRUB 0.97)ですが、明らかに内容が違っていました。
この様な通常は行わない作業の場合は実際に確認するしか無いのですが、#10に示した変更の項目は変わらない様なので大丈夫だと思います。
boot fromの場所が17778の行にありました。
はい。9.10で場合、確認が取れました、オフセット 0x17787 に[b]があります。
oot from (hd0,0) ext4....
#10で言う所の「42」を「20」に置き換えられたと思いますが、その後の続く[6F,6F,74,20,66,72,6F,6D]は[20]に置き換えられたでしょうか。
Boot fromは一字ずつ、それぞれ[42=B, 6F=o, 6F=o, 74=t, 20=空白, 66=f, 72=r, 6F=o, 6D=m]
というふうに空欄になります。
その分、後ろに文字が一文字追加されてました。
これは私の検証のミスですね、ピンポイントで探りを入れて変更を加えていたときは気がつきませんでした。
文字の前後を残すか変更するか等の処置がいるかもしれません。
私の場合は、どんどん変更を加えて検証しているうちに偶然に上手くいったのかも。再度確認してみます。
次に17EC8の行の17ED6の位置、文字列では「 (hd%d, 」を20に書き換えます、
17B20行、オフセット0x17B2Eから,,,
17F70の行、17F74から始まる「--no-mem-option」から「starting up...」の手前までの中にあるのですが、探さずに全て20に置き換えました。下記の状態のはずです。
17BC8行、オフセット0x17BCCから始まる「--no-mem-option」から「starting up...」の手前まで、、、
17B20の行の17B1Cにある「saved.,%d.,%c.)%s.」を20に置き換えます。
17760行にあるオフセット0x17774から始まる場所を確答文字数分20に置き換えてみてください。
時間が空いた日にでも細部の確認はしてみます。
オフライン
Startingは
17F28行にありました。17BC8行の「--no-mem-option」から17F28行の「starting up...」の手前までですよね。
それと17B20行、オフセット0x17B2Eから
すべて20に変えてみました。
起動しなくなってしまいました。
もう一つのUbuntuから起動させて
sudo cp ~/stage /media/Ubuntu/boot/grub/stage2
でバックアップをとっておいたものをhomeフォルダに移して上書きさせました。
変更後ですが起動時一瞬、GRUB Lodaing~みたいなのがでてgrubメニュー画面にいかずに再起動がかかり何度も繰り返されます。
PC起動画面
↓
GRUB Loading
↓
PC起動画面
の繰り返しです。
オフライン
失敗した時は#10の参考URLの方法で起動して、ダメなstage2を健康な物と入れ替えてください。
UUIDの部分と細部と詳細は#12に書いたように後日のつもりですが、起動しないとの事で取り急ぎ連絡を。
9.10のGRUBから抜き取ったstage2を9.04に入れた所、問題なく起動しましたので再現しました。
一部変更を試みました[20]ではなく[00]に置き換えることでズレが解消されるかな?と思ったので。
ちなみに[00]だと[0]keyを押しっぱなしでOKなので楽でした。
(starting up....の文字は省略して説明します。)
boot from (hd0,0) ext4 5b...(省略)......
変更前 00017760 | 6f 75 6e 64 20 6f 72 20 73 75 70 70 6f 72 74 65 64 2e 0a 00 73 61 76 65 | ound or supported...save 00017778 | 64 00 2c 25 64 00 2c 25 63 00 29 20 25 73 00 42 6f 6f 74 20 66 72 6f 6d | d.,%d.,%c.) %s.Boot from
(hd0 5b...(省略)......
変更後 00017760 | 6f 75 6e 64 20 6f 72 20 73 75 70 70 6f 72 74 65 64 2e 0a 00 00 00 00 00 | ound or supported....... 00017778 | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0 | ........................
(hd0 5b...(省略)......
変更前 00017b20 | 6c 62 61 63 6b 00 20 28 6e 64 29 3a 00 20 28 68 64 25 64 00 20 28 66 64 | lback. (nd):. (hd%d. (fd
5b...(省略)......
変更後 00017b20 | 6c 62 61 63 6b 00 20 28 6e 64 29 3a 00 20 00 00 00 00 00 00 20 28 66 64 | lback. (nd):. ...... (fd
UUIDは17F2Fまでを[00]で置き換えて見てください隣は[0A 00]で文字列は[..]です、私はそこは残していました。
その隣は[53]で[S]ですね。
今、書きながら[0A 00]を含めて[starting up...]の[p]までを[00]で埋めて再起動した無事に起動できました。
オフライン
[訂正]
現状ではUUIDとstarting up...を含めて、0x17BCC ~ 0x17F3C までを[00]で埋めることになります。
起動後は文字は表示されませんが、確か数秒後に
[loading ホニャララ] と一行表示されてましたね。
これも消すのかな?
任意の文字列を表示させることも可能かもしれませんね、、、
オフライン
hir0さんうまくいきました。
GRUB Loadingは一瞬なので消さなくても大丈夫です。
Starting up...
が
_Starting up....
↑点滅バー
この様に少し右によってしまいますが変更はできています。
もしこれが(Starting up...が)左による方法があったらこだわって教えていただきたいのですが、大変でしたらこれで充分です。
オフライン