KaewGB

November 18, 2009

Introduction to GRUB2

Filed under: Linux — Tags: , , , , — KaewGB @ 10:24 pm

I just installed Ubuntu 9.10 ‘Karmic Koala’ in my notebook, which already had Windows XP and Fedora Core 10 installed, and the new GRUB2 boot menu created by Ubuntu only consisted of boot entries for itself and Windows XP — FC10’s entry is missed as expected. So I need to take care of it a little bit to get my FC10 back.

The problem is, GRUB2 doesn’t have our familiar configuration file, /boot/grub/menu.lst, anymore! And it took me more than half an hour to learn configuring GRUB2. Most of the time I got lost in some random webboards with too little details about GRUB2 (my bad, maybe I used the wrong keywords = =”), until I found this very useful web page: https://help.ubuntu.com/community/Grub2 — it contains everything I want! But it’s a bit too detailed so I decided to make some quick reference here:

  • /boot/grub/menu.lst has been replaced by /boot/grub/grub.cfg
  • /boot/grub/grub.cfg does not meant to be edited by any user (even root), it should be generated from the scripts in /etc/grub.d/
    • In each (re)generation of grub.cfg, all scripts in /etc/grub.d/ are executed.
    • The default scripts names are lead with a 2-digit number. The lower the number, the sooner it will be executed.
    • We can add arbitrarily any scripts of any names as well.
  • Some scripts worth mentioning in /etc/grub.d:
    • 10_linux: generates entry for the current OS. (Ubuntu 9.04 in this case)
    • 30_os-prober: generates entry for the other OSes it detects. (Windows XP in this case)
    • 40_custom: free space for us to add our custom entries = the new /boot/grub/menu.lst

So… what to do?

  • Copy the entry template from the file /boot/grub/grub.cfg, such as
    • menuentry “Ubuntu, Linux 2.6.31-14-generic” {
      set root=(hd0,7)
      search –no-floppy –fs-uuid –set 3259f467-9dab-45c2-9896-d9963b0629fc
      linux    /boot/vmlinuz-2.6.31-14-generic root=UUID=3259f467-9dab-45c2-9896-d9963b0629fc ro   quiet splash
      initrd    /boot/initrd.img-2.6.31-14-generic
      }
  • Paste it in 40_custom and then modify. (The text in green above is what should be edited)
    • Some keywords/modifiers are changed
      • title -> menuentry
      • root -> set root =
      • kernel -> linux
    • Be careful with the partition numbers, GRUB2 start the count at 1.
    • Device numbers still start at 0.

    The text in orange -> I think it’s not necessary so I commented it out (using #) and it still works, still haven’t searched what it means yet. (If anyone knows please tell me, thank you ^^)

  • If you want to change the order the custom entries appear, then just change the file name (split in to many files too if needed)
    • Every custom files should begin with these 2 lines (to make the system write the contents in all lines below to grub.cfg):
      • #!/bin/sh
      • exec tail -n +3 $0
  • run sudo update-grub to cause all the scripts to be executed :)

May 27, 2009

Barcamp Bangkok #3 – Day 2

Filed under: BarcampBangkok — Tags: — KaewGB @ 12:28 pm

FYI: Barcamp Bangkok 3 was held on Saturday 23th- Sunday 24th May 2009 at Sripatum University (SPU), read more details at http://barcampbangkok.org/

วันอาทิตย์ คนมาน้อยลงมาก (ตามคาด) วันนี้ก็ฟังอย่างเดียวอีกเช่นเคย ด้วยข้ออ้างที่ว่าเมื่อวานไม่ค่อยสบาย ไม่ได้แก้สไลด์ (จริงๆ ก็คือปอด ไม่อยากพูด ยังรู้ไม่เยอะพอด้วย 555) แต่โอกาสหน้าคงได้พูดแน่ เพราะยังทำโปรเจคเรื่องนี้ต่อ ถึงตอนนั้นคงเชี่ยวกว่านี้มาก — ลืมบอกไป จะพูดเรื่องสถาปัตยกรรม Cell BE

ไปถึง 10 โมงกว่าๆ เดินเข้ามาเจอนนท์ (SKE) ขอเสื้ออยู่ เพราะเมื่อวานลืมเอา ก็เลยเข้าไปขอเสื้ือให้อาไฉด้วย เพราะอาไฉ register สายไป เืมื่อวานเค้าไม่ยอมให้เสื้อ วันนี้เป็นอีกคนนึง เค้ายอมให้แฮะ แต่เหลือแต่ size XXL …ตายแน่อาไฉ 55555

มาสรุปเนื้อหาแต่ละเซสชั่นต่อดีกว่า จะพยายามให้สั้น

(more…)

May 26, 2009

Barcamp Bangkok #3 – Day 1

Filed under: BarcampBangkok — Tags: — KaewGB @ 1:56 pm

FYI: Barcamp Bangkok 3 was held on Saturday 23th- Sunday 24th May 2009 at Sripatum University (SPU), read more details at http://barcampbangkok.org/

ตอนบาร์แคมป์ 2 ว่าจะบล็อกแล้ว แต่สุดท้ายก็ยุ่งและผัดวันประกันพรุ่งจนไม่ได้เขียน คราวนี้ยังพอมีเวลาว่าง เพิ่งจบบาร์แคมป์ก็รีบๆ เขียนซะ (ยกให้เป็นเอนทรี่แรกของบล็อกใหม่เลย)

เช้าวันเสาร์รู้สึกไม่ค่อยสบายเท่าไหร่  (ไม่ใช่หวัดค่า) แต่มีหรือจะพลาดวันแรกของบาร์แคมป์ได้  (ถ้าพลาดนี่เสื้อไซส์ S, M ไม่มีเหลือแน่นอน 55) บวกกับเพิ่งชวนพ่อ กะเพื่อนอีก 2 คน (อาไฉ กะโอ๊ต) ไปบาร์แคมป์เพิ่มได้ คนถูกชวนอุตส่าห์ไปแต่คนชวนไม่ไปมันก็กระไรอยู่ สุดท้ายก็ถ่อไปถึงจนได้ ประมาณเกือบ 11 โมง โชคดีที่เค้ายังโหวตๆ กันอยู่ ก็ไปรับเสื้อ รับ wi-fi โหวตๆ เรื่องที่อยากฟัง แล้วก็เริ่มฟังเซสชั่นดังต่อไปนี้

*หมายเหตุ: เซสชั่นที่คนพูดเป็น N/A คือเข้าไปไม่ทันคนพูดแนะนำตัว หรือคนพูดไม่ได้แนะนำตัว หากใครทราบช่วยบอกด้วยค่ะ จะได้ใส่เป็น credit

(more…)

Blog at WordPress.com.