1、准备一个U盘,将U盘分一个区同时将U盘格式化为ext3文件系统的格式(此文件系统格式是将要移植的linux的文件系统的文件格式)
2、use fdisk to fix the partition type
Step: fdisk /dev/sda
然后按t,接着是按83,因为83是ext3 type
3、打包linux根目录下的所有文件
tar zcvfp linux.tgz /bin/ --exclude=/proc/* /proc -exclude=/sys/* /sys --exclude=/tmp/* /tmp
4、挂在U盘到/mnt
mount /dev/sda1 /mnt
5、将打包好的文件复制到U盘中并进行解压
tar zxvf linux.tgz
6、制作grub MBR
grub-install --root-directory=/mnt /dev/sda
OK,到此为止,理论上U盘上已经有linux,并且可以从U盘启动
验证,Reboot
第一次重启
出现错误如下:
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
Switch:mount failed: No such file or directory
Kernel panic not syncing: Attempted to kill init!
看了一下错误,首先想到的是没有找到文件或者目录,但是文件明明是存在的,那可能是路径的问题。
OK,修改路径,系统重启
出现选择内核的时候,按Enter键,就会出现kernel的路径,按e键选择修改,改的第二行的内容,将root=LABEL=/1改为root=/dev/sda1,按b,启动系统,等待...
第二次重启出现错误
错误如下:
Unable to resolve LABEL
打开linux系统,将此U盘挂载上去,进行修改配置文件
Vim /etc/fstab打开此文件,将LABEL=/1改为/dev/sda1
OK,再一次reboot
第三次重启出现错误
错误如下:
输入账号密码后,弹出一个对话框显示,由于内部错误,无法启动会话。
解决方法,在重启进入系统的时候进入单用户模式
直接进到sh的提示符
1.键入mount -o remount rw /
2.修改selinux的配置文件
vim /etc/sylinux/config
将SELINUX设置为disable关闭selinux
查看LABEL的命令
blkid -s LABLE
设置LABEL的命令
e2abel /dev/sdc1 /1
本文详述了如何使用U盘安装并启动Linux系统,包括格式化U盘为ext3文件系统、打包Linux根目录文件、制作GRUB启动项等步骤。针对启动过程中可能出现的错误,如找不到文件系统、内核路径错误及会话启动失败等问题,提供了详细的解决方案。
224

被折叠的 条评论
为什么被折叠?



