grup centos centos 7开机进入grub
大家好,grup centos相信很多的网友都不是很明白,包括centos 7开机进入grub也是一样,不过没有关系,接下来就来为大家分享关于grup centos和centos 7开机进入grub的一些知识点,大家可以关注收藏,免得下次来找不到哦,下面我们开始吧!
linux误删/bin目录怎么办
解决思路:
1、找一台操作系统环境相同的机器,拷贝目录到该机器。
2、估计的重新安装内核,因为找不到内核映射了。
详细解决步骤如下:
1、重新启动机器,插入光盘,进入带网络环境的救援模式。
2、把另外一个系统的bin目录的压缩包拷贝过来,然后解压。
3、因为系统内核丢失了,所以我们需要先安装内核,在安装内核时会自动生成initrd
a、cd/mnt/
b、mkdir cd
c、mount-t iso9660-o ro/dev/hda/mnt/cd/(注意,使用dmesg命令详细查看光驱挂载的设备,我的是/dev/hda)
d、rpm-Uvh--force kernel-2.6.18-164.el5.i686.rpm
4、安装grub
a、grup-install/dev/sda
5、编辑grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a/boot partition. This means that
# all kernel and initrd paths are relative to/boot/, eg.
# root(hd0,0)
# kernel/vmlinuz-version ro root=/dev/sda7
# initrd/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS(2.6.18-164.el5)
root(hd0,0)
kernel/vmlinuz-2.6.18-164.el5 ro root=LABEL=/dev/VolGroup00/LogVol00 rhgb quiet
initrd/initrd-2.6.18-164.el5.img
注意,如果你是逻辑卷需要修改根目录的标签,我的是逻辑卷。
6,重新启动系统
重新启动系统未成功,出现以下错误:
mount: could not find filesystem'/dev/root'
setuproot: moving/dev failed: No such file or directory
setuproot: error mounting/proc: No such file or directory
setuproot: error mounting/sys: No such file or directory
switchroot: mount failed: No such file or directory
Kernel panic- not syncing: Attempted to kill init!
经过搜索后,发现此类问题多集中在逻辑卷管理的情况,具体原因是我们在重新安装内核的时候,没有加载一些逻辑卷,解决方法如下:
1) Boot with the rescue CD
2) Type'chroot/mnt/sysimage'
3)'cd/boot'
4)'mkdir newinit'
5)'cd newinit'
6)'gunzip-c../initrd-2.6.18-164.el5.img| cpio-idmv'
7)'vi init'
8) Find'mount/sysroot'
9) Delete or comment this out
10) Replace with'mount-o defaults--ro-t ext3/dev/VolGroup00/LogVol00/sysroot' where/dev/VolGroup00/LogVol00 is the mount point for/
11)':wq' out of vi
12)'find.| cpio--quiet-c-o>../newinitrd'
13)'cd..'- you are now in/boot
14)'mv initrd-2.6.18-164.el5.img initrd-2.6.18-164.el5.img.bak'- backup current initrd img file
15)'gzip-9< newinitrd> initrd-2.6.18-164.el5.img'
16) Reboot the computer without the CD
再次重新启动系统,OK,问题解决。
7、尝试进行远程连接,因为远程服务器不允许root直接连接,可以用普通用户进行登录,登录后执行 su- root命令,输入密码总是提示密码错误,但是在终端直接用root是可以登录的,奇怪,后来发现问题出在 su命令上,是文件权限粘贴位的问题,因为拷贝过来的su命令权限如下:
[root@localhost~]# ll/bin/su
-rwxr-xr-x 1 root root 23960 Oct 18 21:46/bin/su
正确如下:
[root@localhost~]# ll/bin/su
-rwsr-xr-x 1 root root 23960 Oct 18 21:46/bin/su
这样就简单了,设置粘贴位如下:
[root@localhost~]# chmod u+s mount
除了su命令外,还有另外几个需要设置粘贴位,mount,ping,ping6,traceroute,traceroute6,umount。
另外还要注意一些软连接。
如何修复centos引导
试了多种方法均不能重建MBR,安装GRUB引导,差点就想重装CentOS系统了,最后想在用CentOS LiveCD修复,但是用LiveCD进入图形界面后也无法修复。摸索多次后,最后用LiveCD的文本模式才将硬盘的MBR重建OK,现记录过程以便以后查阅。
1、用LiveCD进入文本模式,用mount查看硬盘挂载情况;
2、建立boot文件夹 mkdir/mnt/sda1/boot
3、将引导分区挂载到/mnt/sda1/boot,用mount/dev/sda1/mnt/sda1/boot-o rw重新挂载为可读写,因当默认挂载是只读;
4、用/mnt/sda1为主文件夹安装GRUB引导 grub-install--root-directory=/mnt/sda1/dev/sda;
5、重启OK。
如果不把引导分区挂载到boot中重建MBR后将会在sda1下建立一个boot文件夹,但是在boot\grub\文件夹中会丢失grup.conf而导致启动时出现grub>的提示不能正常启动。可能原因估计是linux系统会自动将引导分区挂载到/boot中,所以当你指--root-directory=/mnt/sda1时会自动查找sda1下的boot文件夹,如果没有boot文件夹就会自动创建。