一、问题linux
在尚观培训Linux时,忽然发现主机名消失[I have a no name!@localhost桌面],当时急着用虚拟机觉得是出了什么错误,重启一下应该就能够了。可是结果另人很不愉快,error surface again!错误相似下图
shell
chown: invalid user: `root:root`tcp
init1 rcs post-stop process (1494) terminated with status 1ide
二、分析post
chown: invalid user: `root:root',经查阅资料,其多是无心间改动了/etc/passwd文件,/etc/passwd文件第一行就是root:x:0:0------------,仔细想一想也就etc/passwd文件与root关联最紧密,有多是在实验时不当心改动passwd文件。之后遇到invalid user error相似的问题,第一时间应该联想到的就是/etc/passwd文件。spa
三、解决方法blog
(1)经过镜像进入到救援模式:Rescue installed system--->English---->us---->yes(network interface)---->OK-->Continue--->ok--->shell Start shellget
(2)chroot /mnt/sysp_w_picpath/虚拟机
(3) 先是cat /etc/passwd 并未发现异常,ls /etc/pass* 发现多一个passwd-文件it
[root@localhost Desktop]# ls /etc/pass*
/etc/passwd /etc/passwd- /etc/passwd.bak
rm -rf /etcpasswd- #删除该文件
(4)passwd文件改完后,重启遇到relabel selinux policy。到此界面而且屡次自动重启,后得知多是selinux下的configure文件改动所致。就又从新改了一个模式,而后就能够正常进入系统。
四、正常进入系统后作快照,养成一个BACKUP的好习惯。