# Problem z grub2-mkconfig

## Zitan

Chce mieć ładny boot loader w moim HTPC i już  :Smile: , więc zainstalowałem grub2 

```
XBMC ~ # emerge grub -va

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R   *] sys-boot/grub-9999  USE="device-mapper nls sdl truetype -custom-cflags -debug -efiemu -libzfs -mount -static" GRUB_PLATFORMS="efi-32 efi-64 emu pc -coreboot -ieee1275 -multiboot -qemu -qemu-mips -yeeloong" 0 kB

Total: 1 package (1 reinstall), Size of downloads: 0 kB

Would you like to merge these packages? [Yes/No] n

Quitting.
```

w wersji 9999 bo mój system plików to btrfs

cat /etc/fstab

```

/dev/sda1               /boot           ext3            noatime,rw      1 2

/dev/sda2               none            swap            sw              0 0

/dev/sda5               /               btrfs           noatime         0 1

/dev/sda6               /home           btrfs           noatime         0 1

/dev/sr0                /mnt/cdrom      auto            noauto,ro       0 0

```

grep -v rootfs /proc/mounts

```
/dev/root / btrfs rw,noatime,nospace_cache 0 0

proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0

tmpfs /run tmpfs rw,nosuid,nodev,relatime,mode=755 0 0

rc-svcdir /lib64/rc/init.d tmpfs rw,nosuid,nodev,noexec,relatime,size=1024k,mode=755 0 0

sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0

debugfs /sys/kernel/debug debugfs rw,nosuid,nodev,noexec,relatime 0 0

cgroup_root /sys/fs/cgroup tmpfs rw,nosuid,nodev,noexec,relatime,size=10240k,mode=755 0 0

openrc /sys/fs/cgroup/openrc cgroup rw,nosuid,nodev,noexec,relatime,release_agent=/lib64/rc/sh/cgroup-release-agent.sh,name=openrc 0 0

cpu /sys/fs/cgroup/cpu cgroup rw,nosuid,nodev,noexec,relatime,cpu 0 0

udev /dev devtmpfs rw,nosuid,relatime,size=10240k,nr_inodes=417440,mode=755 0 0

devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620 0 0

shm /dev/shm tmpfs rw,nosuid,nodev,noexec,relatime 0 0

cachedir /lib64/splash/cache tmpfs rw,nosuid,nodev,noexec,noatime,size=4096k,mode=755 0 0

/dev/sda1 /boot ext3 rw,noatime,errors=continue,user_xattr,acl,commit=5,barrier=1,data=ordered 0 0

/dev/sda6 /home btrfs rw,noatime,nospace_cache 0 0

binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc rw,nosuid,nodev,noexec,relatime 0 0

usbfs /proc/bus/usb usbfs rw,nosuid,noexec,relatime,devgid=85,devmode=664 0 0
```

Instalacja grub-a

```
XBMC ~ # grep -v rootfs /proc/mounts > /etc/mtab

XBMC ~ # cp /proc/mounts /etc/mtab

XBMC ~ # grub2-install /dev/sda

Installation finished. No error reported.
```

cat /etc/default/grub

```
# Copyright 1999-2012 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: /var/cvsroot/gentoo-x86/sys-boot/grub/files/grub.default,v 1.3 2012/02/29 01:52:23 floppym Exp $

#

# To populate all changes in this file you need to regenerate your

# grub configuration file afterwards:

#     'grub2-mkconfig -o /boot/grub2/grub.cfg'

#

# See the grub info page for documentation on possible variables and

# their associated values.

GRUB_DISTRIBUTOR="Gentoo"

GRUB_DEFAULT=0

GRUB_HIDDEN_TIMEOUT=0

GRUB_HIDDEN_TIMEOUT_QUIET=true

GRUB_TIMEOUT=10

GRUB_CMDLINE_LINUX_DEFAULT=""

GRUB_CMDLINE_LINUX=""

# Uncomment to disable graphical terminal (grub-pc only)

GRUB_TERMINAL=console

# The resolution used on graphical terminal.

# Note that you can use only modes which your graphic card supports via VBE.

# You can see them in real GRUB with the command `vbeinfo'.

GRUB_GFXMODE="1024x768x32"

GRUB_GFXPAYLOAD_LINUX="1024x768x32"

# Background image used on graphical terminal.

# Can be in various bitmap formats.

GRUB_BACKGROUND="/boot/grub2/mybackground.png"

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to kernel

GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries

GRUB_DISABLE_RECOVERY=true
```

Polecenie grub2-mkconfig

```

XBMC ~ # grub2-mkconfig -o /boot/grub2/grub.cfg

/usr/sbin/grub2-probe: error: failed to get canonical path of /dev/root.
```

Co ciekawe jak schrootowałem system z płyty Gennto liveDVD

```
swapon /dev/sda2 && mount /dev/sda5 /mnt/gentoo && mount /dev/sda1 /mnt/gentoo/boot && cp -L /etc/resolv.conf /mnt/gentoo/etc/ && mount -t proc none /mnt/gentoo/proc && mount -o bind /dev /mnt/gentoo/dev && chroot /mnt/gentoo /bin/bash
```

tak wiem, leniwy jestem  :Smile: . Komenda "grub2-mkconfig -o /boot/grub2/grub.cfg" działa poprawnie. Co mam zrobić żeby móc modyfikować grub-a z poziomu systemu?.

----------

## SlashBeast

Jezeli chcesz ladny bootloader uzyl bym extlinux z vesamenu.c32. grub2 to jest porazka na calej lini, caaalej.

----------

## Zitan

 *SlashBeast wrote:*   

> Jezeli chcesz ladny bootloader uzyl bym extlinux z vesamenu.c32. grub2 to jest porazka na calej lini, caaalej.

 

A co to jest?

EDIT: ok mam, dzięki.

----------

