ubuntu11.04的 grub2如何配置?

重复贴和参考价值不大的帖子,版主维护
回复
q270638453
帖子: 8
注册时间: 2011-05-02 10:16
送出感谢: 0
接收感谢: 0

ubuntu11.04的 grub2如何配置?

#1

帖子 q270638453 » 2011-05-08 15:28

ubuntu11.04的grub2是不是又改了 以前在10.10里改开机背景都在05_debian_theme下一次成功 现在的不一样了,我改了多处都不能正确显示(更没改一样),哪位高人帮帮忙解读一下05_debian_theme那个文件 :em06
头像
qy117121
论坛版主
帖子: 49891
注册时间: 2007-12-14 13:40
系统: Winbuntu
来自: 志虚国乌由市
送出感谢: 17 次
接收感谢: 335 次
联系:

Re: ubuntu11.04的 grub2如何配置?

#2

帖子 qy117121 » 2011-05-08 15:29

是想加背景图片?
背景的话看这里 viewtopic.php?f=139&t=329777
渠月 · QY    https://vz.rs/u
本人只会灌水,不负责回答问题

无聊可以点一下→ http://u.nu/ubuntu
头像
月下叹逍遥
论坛版主
帖子: 33994
注册时间: 2010-10-07 14:23
系统: Archdows10
来自: 某系某星某洲某国某省某市
送出感谢: 8 次
接收感谢: 63 次
联系:

Re: ubuntu11.04的 grub2如何配置?

#3

帖子 月下叹逍遥 » 2011-05-08 15:38

一般少动grub,否则…………
心似浮云常自在,意如流水任东西。
此事背后一定有个天大的咪咪
广告:
1、走过路过,不要错过,dropbox网盘2.25G大放送
py大法好,退C保平安
java多妖孽,VB本异端
日诵一千遍,快活似神仙
q270638453
帖子: 8
注册时间: 2011-05-02 10:16
送出感谢: 0
接收感谢: 0

Re: ubuntu11.04的 grub2如何配置?

#4

帖子 q270638453 » 2011-05-09 22:26

我是将图片放在了/boot/grub下, 一张没成功我就将每个格式的各放一张并且分辨率都不一样结果还是不行 不论怎么update-grub都是
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
done

并且我的有/boot/grub/还有/boot/boot/grub/ 怎么boot下还有个/boot/grub/而且内容还都一样 今天我又重安装了grub
sudo grub-install --boot-directory=/boot /dev/sda
Installation finished. No error reported.
更新后还是没背景 唉 我是彻底晕了 求解啊
头像
smallapple
论坛版主
帖子: 7867
注册时间: 2009-03-28 15:12
送出感谢: 0
接收感谢: 19 次

Re: ubuntu11.04的 grub2如何配置?

#5

帖子 smallapple » 2011-05-09 23:02

把 05_debian_theme 还原回去再试试
q270638453
帖子: 8
注册时间: 2011-05-02 10:16
送出感谢: 0
接收感谢: 0

Re: ubuntu11.04的 grub2如何配置?

#6

帖子 q270638453 » 2011-05-12 22:01

我想已经注定我的开机背景是出不来了真是有点怀念10.10了 我吧05_debian_theme还原了 就是出不来 我把它贴出来 哪位大侠有时间帮我看看吧
#!/bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2010 Alexander Kurtz <kurtz.alex@googlemail.com>
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# GRUB is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.

# Include the GRUB helper library for grub-mkconfig.
. /usr/lib/grub/grub-mkconfig_lib

# We want to work in /boot/grub/ only.
test -d "${GRUB_PREFIX}"; cd "${GRUB_PREFIX}"

# Set the location of a possibly necessary cache file for the background image.
# NOTE: This MUST BE A DOTFILE to avoid confusing it with user-defined images.
BACKGROUND_CACHE=".background_cache"

set_default_theme(){
# Set a monochromatic theme for Ubuntu.
echo "${1}set menu_color_normal=white/black"
echo "${1}set menu_color_highlight=black/light-gray"

if [ -e /lib/plymouth/themes/default.grub ]; then
sed "s/^/${1}/" /lib/plymouth/themes/default.grub
fi
}

set_background_image(){
# Step #1: Search all available output modes ...
local output
for output in ${GRUB_TERMINAL_OUTPUT}; do
if [ "x$output" = "xgfxterm" ]; then
break
fi
done

# ... and check if we are able to display a background image at all.
if ! [ "x${output}" = "xgfxterm" ]; then
return 1
fi

# Step #2: Check if the specified background image exists.
if ! [ -f "${1}" ]; then
return 2
fi

# Step #3: Search the correct GRUB module for our background image.
local reader
case "${1}" in
*.jpg|*.JPG|*.jpeg|*.JPEG) reader="jpg";;
*.png|*.PNG) reader="png";;
*.tga|*.TGA) reader="tga";;
*) return 3;; # Unknown image type.
esac

# Step #4: Check if the necessary GRUB module is available.
if ! [ -f "${reader}.mod" ]; then
return 4
fi

# Step #5: Check if GRUB can read the background image directly.
# If so, we can remove the cache file (if any). Otherwise the backgound
# image needs to be cached under /boot/grub/.
if is_path_readable_by_grub "${1}"; then
rm --force "${BACKGROUND_CACHE}.jpeg" \
"${BACKGROUND_CACHE}.png" "${BACKGROUND_CACHE}.tga"
elif cp "${1}" "${BACKGROUND_CACHE}.${reader}"; then
set -- "${BACKGROUND_CACHE}.${reader}" "${2}" "${3}"
else
return 5
fi

# Step #6: Prepare GRUB to read the background image.
if ! prepare_grub_to_access_device "`${grub_probe} --target=device "${1}"`"; then
return 6
fi

# Step #7: Everything went fine, print out a message to stderr ...
echo "Found background image: ${1}" >&2

# ... and write our configuration snippet to stdout. Use the colors
# desktop-base specified. If we're using a user-defined background, use
# the default colors since we've got no idea how the image looks like.
# If loading the background image fails, use the default theme.
echo "insmod ${reader}"
echo "if background_image `make_system_path_relative_to_its_root "${1}"`; then"
if [ -n "${2}" ]; then
echo " set color_normal=${2}"
fi
if [ -n "${3}" ]; then
echo " set color_highlight=${3}"
fi
if [ -z "${2}" ] && [ -z "${3}" ]; then
echo " true"
fi
echo "else"
set_default_theme " "
echo "fi"
}

# Earlier versions of grub-pc copied the default background image to /boot/grub
# during postinst. Remove those obsolete images if they haven't been touched by
# the user. They are still available under /usr/share/images/desktop-base/ if
# desktop-base is installed.
while read checksum background; do
if [ -f "${background}" ] && [ "x`sha1sum "${background}"`" = "x${checksum} ${background}" ]; then
echo "Removing old background image: ${background}" >&2
rm "${background}"
fi
done <<EOF
648ee65dd0c157a69b019a5372cbcfea4fc754a5 debian-blueish-wallpaper-640x480.png
0431e97a6c661084c59676c4baeeb8c2f602edb8 debian-blueish-wallpaper-640x480.png
968ecf6696c5638cfe80e8e70aba239526270864 debian-blueish-wallpaper-640x480.tga
11143e8c92a073401de0b0fd42d0c052af4ccd9b moreblue-orbit-grub.png
d00d5e505ab63f2d53fa880bfac447e2d3bb197c moreblue-orbit-grub.png
f5b12c1009ec0a3b029185f6b66cd0d7e5611019 moreblue-orbit-grub.png
EOF

# Include the configuration of desktop-base if available.
if [ -f "/usr/share/desktop-base/grub_background.sh" ]; then
. "/usr/share/desktop-base/grub_background.sh"
fi

# First check whether the user has specified a background image explicitly.
# If so, try to use it. Don't try the other possibilities in that case
# (#608263).
if [ -n "${GRUB_BACKGROUND+x}" ]; then
set_background_image "${GRUB_BACKGROUND}" || set_default_theme
exit 0
fi

# Next search for pictures the user put into /boot/grub/ and use the first one.
for background in *.jpg *.JPG *.jpeg *.JPEG *.png *.PNG *.tga *.TGA; do
if set_background_image "${background}"; then
exit 0
fi
done

# Next try to use the background image and colors specified by desktop-base.
if set_background_image "${WALLPAPER}" "${COLOR_NORMAL}" "${COLOR_HIGHLIGHT}"; then
exit 0
fi

# If we haven't found a background image yet, use the default from desktop-base.
if set_background_image "/usr/share/images/desktop-base/desktop-grub.png"; then
exit 0
fi

# Finally, if all of the above fails, use the default theme.
set_default_theme
回复

回到 “归档贴”