引导到( initramfs ) 提示符/busybox

分享于 

6分钟阅读

ubuntu

  繁體

问题

重新引导后,引导到BusyBox shell,并且我最终在提示符下:


BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash)


Enter 'help' for a list of built-in commands.



(initramfs)



mount -t ntfs-3g /dev/sda1 /root -o force


答案1

在initramfs控制台上时,我通过了一个命令出口以退出外壳。


BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash) 


Enter 'help' for a list of built-in commands.



(initramfs) exit



/dev/mapper/ubuntu--vg-root: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.


(i.e., without -a or -p options) 


fsck exited with status code 4. 


The root filesystem on /dev/mapper/ubuntu--vg-root requires a manual fsck. 



BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash)


Enter 'help' for a list of built-in commands.



(initramfs) fsck /dev/mapper/ubuntu--vg-root -y



fsck from util-linux 2.27.1


e2fsck 1.42.13 (17-May-2015)


/dev/mapper/ubuntu--vg-root contains a file system with errors, check forced.



检查完成后,我重启了系统。


BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4) built-in shell (ash)


Enter 'help' for a list of built-in commands.



(initramfs) reboot



回到文件系统后,没有错误了。


答案2

看来,你有一个坏的超级块,要修复这个问题:

首先,引导至live CD或USB

使用下列方法查找分区号


sudo fdisk -l|grep Linux|grep -Ev 'swap'



然后,使用以下命令列出所有超级块:


sudo dumpe2fs /dev/sda2 | grep superblock



将sda2替换为您的驱动器号

你应该得到类似的输出,如下所示


 Primary superblock at 0, Group descriptors at 1-6


 Backup superblock at 32768, Group descriptors at 32769-32774


 Backup superblock at 98304, Group descriptors at 98305-98310


 Backup superblock at 163840, Group descriptors at 163841-163846


 Backup superblock at 229376, Group descriptors at 229377-229382


 Backup superblock at 294912, Group descriptors at 294913-294918


 Backup superblock at 819200, Group descriptors at 819201-819206


 Backup superblock at 884736, Group descriptors at 884737-884742


 Backup superblock at 1605632, Group descriptors at 1605633-1605638


 Backup superblock at 2654208, Group descriptors at 2654209-2654214


 Backup superblock at 4096000, Group descriptors at 4096001-4096006


 Backup superblock at 7962624, Group descriptors at 7962625-7962630


 Backup superblock at 11239424, Group descriptors at 11239425-11239430


 Backup superblock at 20480000, Group descriptors at 20480001-20480006


 Backup superblock at 23887872, Group descriptors at 23887873-23887878



从此列表中选择备用超级块,在本例中为备用超级块#32768

现在,使用备用超级块#32768检查和修复Linux文件系统:


sudo fsck -b 32768 /dev/sda2 -y



-y标志用于跳过所有Fix?问题,并使用yes自动回答它们

你应该得到类似的输出,如下所示:


fsck 1.40.2 (12-Jul-2007)


e2fsck 1.40.2 (12-Jul-2007)


/dev/sda2 was not cleanly unmounted, check forced.


Pass 1: Checking inodes, blocks, and sizes


Pass 2: Checking directory structure


Pass 3: Checking directory connectivity


Pass 4: Checking reference counts


Pass 5: Checking group summary information


Free blocks count wrong for group #241 (32254, counted=32253).


Fix? yes


Free blocks count wrong for group #362 (32254, counted=32248).


Fix? yes


Free blocks count wrong for group #368 (32254, counted=27774).


Fix? yes


..........


/dev/sda2: ***** FILE SYSTEM WAS MODIFIED *****


/dev/sda2: 59586/30539776 files (0.6% non-contiguous), 3604682/61059048 blocks



现在尝试挂载分区


sudo mount /dev/sda2 /mnt



现在,尝试使用以下命令浏览文件系统


cd /mnt


mkdir test


ls -l


cp file /path/to/safe/location



如果能够执行上述命令,你很可能已经修复了错误。

现在,重新启动计算机,你应该能够正常启动。


答案3

实际上,解决方案很简单,只需fsck /dev/sdax命令,如果控制台要求修复某些内容,则回答Y


(initramfs) fsck /dev/sda1




(initramfs) fsck /dev/sdaX



X指定挂载的磁盘部件号。

如果不想每次要求修复时都手动按y,也可以使用-y选项运行命令。


(initramfs) fsck /dev/sdaX -y





BOO  引导  INI  Prompt  
相关文章