[[PageOutline]] = Kernel Boot Options = * https://help.ubuntu.com/community/Grub2 * via [http://blog.jojo.jp/?eid=1424783 grub1 grub2 USBブートメモリ作成 | 作業日報] * [http://manual.aptosid.com/ja/sys-admin-grub2-ja.htm aptosid Manuals - Grub2] GRUB1からとGRUB2に移行するにあったってのGRUB1とGRUB2の主な違い * [http://wikiwiki.jp/disklessfun/?grub2_and_grub1 Tips: grub2とgrub1の扱い方(様々な再セットアップ方法等) - disklessfun’s Wiki*] * [https://forums.ubuntulinux.jp/viewtopic.php?id=4863 Ubuntu日本語フォーラム / 起動時にカーネルメッセージを表示させたい!] * Ubuntu GRUB デフォルトではカーネルメッセージは表示されない[[br]][[Image(ubuntu-GRUB-quiet.png, 33%)]] * これを以下のように変更する (quiestを消す)[[br]][[Image(ubuntu-GRUB-menu-1.png, 33%)]] [[Image(ubuntu-GRUB-menu-2.png, 33%)]] [[Image(ubuntu-GRUB-menu-3.png, 33%)]] * カーネルメッセージが表示されるようになる[[br]][[Image(ubuntu-GRUB-bootlog.png, 33%)]] * [https://wiki.ubuntulinux.jp/UbuntuTips/Others/RecoveryMode リカバリーモードを使うには - Ubuntu Japanese Wiki] {{{ GRUB 2 の場合 起動時に shift キーを押し続ける。 }}} * [http://mypace75.blog92.fc2.com/blog-entry-479.html Winux/Lindows Ubuntu 9.10(Grub2)でスプラッシュに起動過程を表示しようか] > GRUB_CMDLINE_LINUX_DEFAULT="quiet nosplash" にすればOKでした。 * "nosplash"だけでも可 = reduce grub entry = * WindowsとLinuxのマルチブート -> Windowsを消してシングルブート化 1. 元の状態 * fdisk -lu /dev/sda {{{ Disk /dev/sda: 120.0 GB, 120034123776 bytes 255 heads, 63 sectors/track, 14593 cylinders, total 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 Disk identifier: 0x36ea3e05 Device Boot Start End Blocks Id System /dev/sda1 63 524351 262144+ 82 Linux swap / Solaris Partition 1 does not end on cylinder boundary. /dev/sda2 524352 42467392 20971520+ 7 HPFS/NTFS /dev/sda3 42467393 234441647 95987127+ 83 Linux }}} * OSのインストールは、Windows 7 -> Ubuntu 10.04の順 * grep menuentry /boot/grub/grub.cfg | tr \" \' | cut -d\' -f2 {{{ Ubuntu, with Linux 2.6.32-33-generic Ubuntu, with Linux 2.6.32-33-generic (recovery mode) Ubuntu, with Linux 2.6.32-32-generic Ubuntu, with Linux 2.6.32-32-generic (recovery mode) Ubuntu, with Linux 2.6.32-31-generic Ubuntu, with Linux 2.6.32-31-generic (recovery mode) Memory test (memtest86+) Memory test (memtest86+, serial console 115200) Windows 7 (loader) (on /dev/sda2) }}} 1. NTFSパーティションの削除 * root@Microknoppix:~# fdisk /dev/sdb {{{ Device Boot Start End Blocks Id System /dev/sdb1 1 33 262144+ 82 Linux swap / Solaris Partition 1 does not end on cylinder boundary. /dev/sdb2 * 33 2644 20971520+ 7 HPFS/NTFS /dev/sdb3 2644 14594 95987127+ 83 Linux Command (m for help): d Partition number (1-4): 2 Command (m for help): d Partition number (1-4): 3 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (33-14593, default 33): Using default value 33 Last cylinder, +cylinders or +size{K,M,G} (33-14593, default 14593): Using default value 14593 Command (m for help): w }}} {{{ Device Boot Start End Blocks Id System /dev/sdb1 63 524351 262144+ 82 Linux swap / Solaris Partition 1 does not end on cylinder boundary. /dev/sdb2 524352 234436544 116956096+ 83 Linux }}} 1. backupしておいたdisk imageからLinuxパーティションを書き戻し * root@Microknoppix:~# dd if=/media/sda/bb.sda bs=512 skip=42467393 of=/dev/sdb2 {{{ 191974255+0 records in 191974255+0 records out 98290818560 bytes (98 GB) copied, 3223.76 s, 30.5 MB/s }}} 1. 正常には起動しなくなるため、grubから手動でUbuntuを起動する * 以下の様に、grub consoleに落ちる {{{ grub rescue> set prefix=(hd0,3)/boot/grub root=(hd0,3) }}} * [http://d.hatena.ne.jp/syque/20110225/1298618896 Ubuntu で grub rescue -> grub-install を実行して grub を修復 - 新芽の手、ほんとの手] * 上記サイトに倣い、以下のようにしてGRUBメニューを起動する {{{ set prefix=(hd0,2)/boot/grub insmod (hd0,2)/boot/grub/normal.mod normal }}} * これで、以前のGRUB起動メニューが表示される * 通常通り起動 1. grubを修復する * sudo grub-install /dev/sda {{{ Installation finished. No error reported. }}} * sudo update-grub {{{ Generating grub.cfg ... Found linux image: /boot/vmlinuz-2.6.32-33-generic Found initrd image: /boot/initrd.img-2.6.32-33-generic Found linux image: /boot/vmlinuz-2.6.32-32-generic Found initrd image: /boot/initrd.img-2.6.32-32-generic Found linux image: /boot/vmlinuz-2.6.32-31-generic Found initrd image: /boot/initrd.img-2.6.32-31-generic Found memtest86+ image: /boot/memtest86+.bin done }}} 1. GRUBメニュー修復完了 * grep menuentry /boot/grub/grub.cfg | tr \" \' | cut -d\' -f2 {{{ Ubuntu, with Linux 2.6.32-33-generic Ubuntu, with Linux 2.6.32-33-generic (recovery mode) Ubuntu, with Linux 2.6.32-32-generic Ubuntu, with Linux 2.6.32-32-generic (recovery mode) Ubuntu, with Linux 2.6.32-31-generic Ubuntu, with Linux 2.6.32-31-generic (recovery mode) Memory test (memtest86+) Memory test (memtest86+, serial console 115200) }}} 1. 適宜、Filesystemの伸張をする * df -h / {{{ Filesystem Size Used Avail Use% Mounted on /dev/sda2 93G 33G 56G 37% / }}} * sudo resize2fs /dev/sda2 {{{ resize2fs 1.41.11 (14-Mar-2010) Filesystem at /dev/sda2 is mounted on /; on-line resizing required old desc_blocks = 6, new_desc_blocks = 7 Performing an on-line resize of /dev/sda2 to 29239024 (4k) blocks. The filesystem on /dev/sda2 is now 29239024 blocks long. }}} * df -h / {{{ Filesystem Size Used Avail Use% Mounted on /dev/sda2 110G 33G 72G 32% / }}} = Multi CD iso boot with USB flash memory = * [http://norian.blog50.fc2.com/blog-entry-92.html (GRUB2の話) USBメモリ内にある複数isoイメージをGRUB2で起動させる 野利庵日録] * [http://www.panticz.de/MultiBootUSB MultiBoot USB with Grub2 (boot directly from iso files) | panticz.de] * [http://serverfault.com/questions/98950/how-do-i-chain-boot-from-grub-to-syslinux linux - How do I chain boot from grub to syslinux? - Server Fault] > * [http://knowhowbyromiz.blogspot.com/2008/09/grub-chainloads-syslinux-and-back.html Know-How by romiz: Grub chainloads syslinux and back] > > * Chainloading syslinux from GRUB seems not to be possible without a [http://bugs.gentoo.org/show_bug.cgi?id=230905 patch]. I don't know about GRUB2. This could be useful for multi-booting (syslinux-based) partitions. > > * Chainloading GRUB4dos from syslinux is possible, because "grub.exe" can reside on the same FAT partition where syslinux is. Only an entry in "syslinux.cfg" with the "kernel /path_to/grub.exe" directive is needed * mitty@ubuntu64:~$ dpkg -S /usr/sbin/grub-install {{{ grub-pc: /usr/sbin/grub-install }}} * mitty@ubuntu64:~$ aptitude show grub-pc {{{ Version: 1.98-1ubuntu12 }}} == fdisk, format USB flash memory == * mitty@ubuntu64:~$ sudo fdisk -u /dev/sdb {{{ Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel with disk identifier 0x0b19ae9f. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable. Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite) WARNING: DOS-compatible mode is deprecated. It's strongly recommended to switch off the mode (command 'c'). Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First sector (62-3932159, default 62): Using default value 62 Last sector, +sectors or +size{K,M,G} (62-3932159, default 3932159): Using default value 3932159 Command (m for help): t Selected partition 1 Hex code (type L to list codes): b Changed system type of partition 1 to b (W95 FAT32) Command (m for help): p Disk /dev/sdb: 2013 MB, 2013265920 bytes 62 heads, 62 sectors/track, 1022 cylinders, total 3932160 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 Disk identifier: 0x0b19ae9f Device Boot Start End Blocks Id System /dev/sdb1 62 3932159 1966049 b W95 FAT32 Partition 1 does not end on cylinder boundary. Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks. }}} * format[[br]][[Image(format-USB-memory.png)]] == install GRUB2 == * mitty@ubuntu64:~$ sudo mount /dev/sdb1 /mnt/ * mitty@ubuntu64:~$ sudo grub-install --no-floppy --root-directory=/mnt/ /dev/sdb {{{ Installation finished. No error reported. }}} * mitty@ubuntu64:~$ sudo umount /mnt/ == copy iso, image files to USB memory == * *-businesscard.isoは使えないので注意 * E:\>tree /f /a {{{ E:. \---boot | memtest.plus | plpbt.bin | FDOS0138.IMG | +---grub | | 915resolution.mod (snip) | | core.img | | grubenv | | grub.cfg | | | \---locale (snip) | \---iso 10.04-i386.iso 10.04-x86_64.iso 11.10-i386.iso 11.10-x86_64.iso fdbasecd.iso knoppix_v6.7.1CD_20110914-20111018.iso debian-squeeze-i386.iso debian-squeeze-x86_64.iso }}} * iso, image files[[br]][[Image(isofiles.png,33%)]] == edit grub.cfg == * /boot/grub/grub.cfg {{{ menuentry "KNOPPIX 6.7.1 CD JAPANESE (text mode)" { loopback loop /boot/iso/knoppix_v6.7.1CD_20110914-20111018.iso echo 'Loading Linux 3.0.4 i386 ...' linux (loop)/boot/isolinux/linux 3 bootfrom=/*/*/boot/iso/knoppix_v6.7.1CD_20110914-20111018.iso ramdisk_size=100000 lang=ja vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=Asia/Tokyo echo 'Loading minirt.gz ...' initrd (loop)/boot/isolinux/minirt.gz } menuentry "KNOPPIX 6.7.1 CD JAPANESE" { loopback loop /boot/iso/knoppix_v6.7.1CD_20110914-20111018.iso echo 'Loading Linux 3.0.4 i386 ...' linux (loop)/boot/isolinux/linux bootfrom=/*/*/boot/iso/knoppix_v6.7.1CD_20110914-20111018.iso ramdisk_size=100000 lang=ja vt.default_utf8=0 apm=power-off initrd=minirt.gz nomce libata.force=noncq hpsa.hpsa_allow_any=1 loglevel=1 tz=Asia/Tokyo echo 'Loading minirt.gz ...' initrd (loop)/boot/isolinux/minirt.gz } menuentry "memtest86+ 4.20" { linux16 /boot/memtest.plus } menuentry "Plop Boot Manager 5.0.13" { linux16 /boot/plpbt.bin } menuentry "Debian 6.0 (i386) installer" { loopback loop /boot/iso/debian-squeeze-i386.iso echo 'Loading 2.6.32-5-486 ...' linux (loop)/linux vga=788 initrd=initrd.gz echo 'Loading initrd.gz ...' initrd (loop)/initrd.gz } menuentry "Debian 6.0 (x86_64) installer" { loopback loop /boot/iso/debian-squeeze-x86_64.iso echo 'Loading Linux 2.6.32-5-amd64 ...' linux (loop)/linux vga=788 initrd=initrd.gz echo 'Loading initrd.gz ...' initrd (loop)/initrd.gz } menuentry "Ubuntu 10.04 (i386) installer" { loopback loop /boot/iso/10.04-i386.iso echo 'Loading Linux 2.6.32-21-generic i386 ...' linux (loop)/linux vga=normal initrd=initrd.gz echo 'Loading initrd.gz ...' initrd (loop)/initrd.gz } menuentry "Ubuntu 10.04 (x86_64) installer" { loopback loop /boot/iso/10.04-x86_64.iso echo 'Loading Linux 2.6.32-21-generic x86_64 ...' linux (loop)/linux vga=normal initrd=initrd.gz echo 'Loading initrd.gz ...' initrd (loop)/initrd.gz } menuentry "Ubuntu 11.10 (i386) installer" { loopback loop /boot/iso/11.10-i386.iso echo 'Loading Linux 3.0.0-12-generic i386 ...' linux (loop)/linux vga=normal initrd=initrd.gz echo 'Loading initrd.gz ...' initrd (loop)/initrd.gz } menuentry "Ubuntu 11.10 (x86_64) installer" { loopback loop /boot/iso/11.10-x86_64.iso echo 'Loading Linux 3.0.0-12-generic x86_64 ...' linux (loop)/linux vga=normal initrd=initrd.gz echo 'Loading initrd.gz ...' initrd (loop)/initrd.gz } menuentry "FreeDOS/V V01L38" { loopback loop /boot/iso/fdbasecd.iso linux16 (loop)/isolinux/data/memdisk echo 'Loading fdos0138.img ...' initrd16 /boot/fdos0138.img } menuentry "FreeDOS 1.0 Final" { loopback loop /boot/iso/fdbasecd.iso linux16 (loop)/isolinux/data/memdisk echo 'Loading fdboot.img ...' initrd16 (loop)/isolinux/data/fdboot.img } }}} * GRUB2 bootmenu[[br]][[Image(grub2-menu.png,33%)]] == references == * [http://www.memtest.org/ Memtest86+ - Advanced Memory Diagnostic Tool] * [http://www.plop.at/en/bootmanager.html Plop - Boot Manager - Free Boot Manager, builtin usb driver, native usb, boot different operating systems, cdrom, usb, freeware, option rom bios] * ~~[http://www.debian.org/CD/netinst/ Debian -- 最小の CD を使って、ネットワークインストールする]~~ * 起動後最小限のパッケージをCDから読もうとして失敗する[[br]][[Image(debian-fail.png,33%)]] * [http://www.debian.org/distrib/netinst インターネット経由の Debian のインストール] * [http://ftp.jaist.ac.jp/pub/Linux/Debian/dists/stable/main/installer-amd64/current/images/netboot/ amd64] * [http://ftp.jaist.ac.jp/pub/Linux/Debian/dists/stable/main/installer-i386/current/images/netboot/ i386] * [https://help.ubuntu.com/community/Installation/MinimalCD Installation/MinimalCD - Community Ubuntu Documentation] === knoppix === * [http://www.rcis.aist.go.jp/project/knoppix/ KNOPPIX Japanese edition] * [http://www.knoppix.net/wiki/Cheat_Codes Cheat Codes - Knoppix Documentation Wiki] * そのままでは正常に起動しない[[br]][[Image(knoppix-boot.png,33%)]][[br]][[Image(knoppix-boot-fail1.png,33%)]] [[Image(knoppix-boot-fail2.png,33%)]] [[Image(knoppix-boot-fail3.png,33%)]] * bootfromオプションが必要[[br]][[Image(knoppix-boot-with-bootfrom.png,33%)]][[br]][[Image(knoppix-found.png,33%)]] * bootfrom=/*/*/boot/iso/knoppix... としているが、「/*/*」はちょっとアドホックなので、もっとスマートな方法を模索中 === FreeDOS === * [http://www.freedos.org/ FreeDOS | The FreeDOS Project] * [http://baalzephon.dyndns.org/tech/index.php?FreeDOS FreeDOS - PukiWiki Plus!] Bootable FreeDOS USB Stick * [http://ubuntuforums.org/showthread.php?t=1440507 [ubuntu] freedos and grub 2 - Ubuntu Forums] * [http://homepage1.nifty.com/bible/fdos/ FreeDOS/Vページ]