Skip to content

Grub

GNU GRUB(대개 GRUB)은 GNU 프로젝트의 부트로더이다. 대부분 운영 체제의 커널을 불러올 수 있으며, 인자를 넘겨 줄 수도 있다. GNU GRUB의 이전 이름은 GRand Unified Bootloader이었고 이는 대통일 이론의 영문 이름의 패러디이다. 대부분 리눅스 배포판에서 부트로더로 사용한다.

List of commands

halt
시스템 종료
normal
메뉴에서 Esc 눌러서 대화형 모드(grub> 프롬프트 상태)로 진입했을 때, 다시 메뉴로 돌아가고 싶다면 normal 라고 치면 된다.

수동으로 부팅하는 방법

GRUB이 리눅스의 커널 이미지를 이용하고, 초기 파일 시스템 이미지를 RAMDISK에 로드하기 위해서는 두 가지 파일이 필요합니다. 한 가지는 vmlinuz이고, 또 다른 한 가지는 initrd.img 파일입니다. 이 두 가지만 설정을 잘 해준다면, 어렵지 않게 리눅스를 수동 부팅시킬 수 있습니다.

grub> ls

먼저 GRUB이 읽고 있는 내 컴퓨터의 디스크 정보를 먼저 확인해봅니다. 여기에서 자신이 어느 쪽에 리눅스를 설치했는지를 알아야 합니다.

잘 모르겠다면, 각 디스크별로, ls 명령어를 사용하는 방법이 있습니다.

grub> ls (hd0,gpt1)/boot

보통 우분투의 경우, /boot 경로에 커널 이미지들이 들어있습니다. 따라서 각 포인트 별로 ls 명령어를 이용해 vmlinuz와 initrd 파일들이 있는지 확인해줍니다.

grub> set root=(hd0,gpt1)

확인이 다 되었다면, root 경로를 해당 디스크로 바꿔줍니다.

grub> linux /boot/vmlinuz root=/dev/nvme0n1p1

리눅스의 커널 이미지 경로를 linux 명령어를 넣어주고, 최상위 마운트 경로가 있는 dev 경로를 입력해줍니다. 만약, 디스크 번호가 잘못 매겨질 경우, 리눅스가 제대로 부팅되지 않고, busybox가 실행될 것입니다.

grub> initrd /boot/initrd.img

마지막으로 리눅스 실제 루트 파일 시스템 마운트를 위해 사용할 초기 마운트 파일 시스템 이미지 경로를 정해줍니다.

grub> boot

이제 boot 명령어를 작동시키면, 수동 부팅이 완료됩니다.

bootloader-id

여러 운영체제 마다 부여하는 ID.

Example

Ubuntu 16.04 및 Ubuntu 18.04가 설치되어 있습니다. 우분투 16.04로 부팅하고 실행합니다.

$ sudo grub-install --bootloader-id=Ubuntu1604

그런 다음 우분투 18.04로 부팅 한 후

$ sudo grub-install --bootloader-id=Ubuntu1804

UEFI 시작. 설정에서 나는 이름으로 새 부트 항목을 참조 Ubuntu1604하고 Ubuntu1804첫 번째 장소에 새 항목 세트 하나에 부팅 순서를 재 배열.

Set older kernel as default grub entry

기본 GRUB 진입점을 변경하는 방법.

/etc/default/grub 파일 열고

GRUB_DEFAULT="1>2"

와 같이 서브 메뉴가 있다면 ">"문자열로 구분하면 된다. 참고로 메뉴 인덱스는 0부터 시작한다.

위와 같이 입력할 경우 index1의 서브메뉴의 index2로 집입한다. 가 된다.

All of the following examples indicate the first menuentry in the first submenu. Titles are easier to use but numbers are also acceptable for either or both values.

Examples: In the following examples, the main menu consists of the current kernel, a recovery mode option, and the submenu "Previous Linux versions" as the third entry. The desired default is the first entry in the first submenu.

  • GRUB_DEFAULT="Previous Linux versions>Ubuntu, with Linux 3.2.0-18-generic-pae"
  • GRUB_DEFAULT="Previous Linux versions>0"
  • GRUB_DEFAULT="2>0"
  • GRUB_DEFAULT="2>Ubuntu, with Linux 3.2.0-18-generic-pae"

Here is a graphic example. Note that the 2 menuentries immediately below the "Previous Linux versions" would not be visible on booting until the "Previous Linux versions" entry was selected.

Grub_submenu-examples.png

nomodeset

The newest kernels have moved the video mode setting into the kernel. So all the programming of the hardware specific clock rates and registers on the video card happen in the kernel rather than in the X driver when the X server starts.. This makes it possible to have high resolution nice looking splash (boot) screens and flicker free transitions from boot splash to login screen. Unfortunately, on some cards this doesnt work properly and you end up with a black screen. Adding the nomodeset parameter instructs the kernel to not load video drivers and use BIOS modes instead until X is loaded.

요약 버전:

최신 커널은 비디오 모드 설정을 커널로 옮겼어. 그래서 비디오 카드의 하드웨어별 클럭 속도와 레지스터를 프로그래밍하는 모든 작업이 X 서버가 시작될 때 X 드라이버가 아닌 커널에서 이루어져. 덕분에 고해상도 멋진 스플래시(부팅) 화면과 부팅 스플래시에서 로그인 화면으로의 깜빡임 없는 전환이 가능해졌지. 안타깝게도, 일부 카드에서는 이게 제대로 작동하지 않아서 검은 화면만 뜨는 경우가 있어. nomodeset 매개변수를 추가하면 커널이 비디오 드라이버를 로드하지 않고 X가 로드될 때까지 BIOS 모드를 사용하도록 지시하는 거야.

Troubleshooting

USB 부팅 안된다면 일반적인 조치 방법

Dd#USB 부팅 안된다면 일반적인 조치 방법 항목 참조.

See also

Favorite site