Загрузка инструмента Linux Live из раздела FreeBSD UFS2

408
Keve

Я хотел бы загрузить Live Linux CD, не нуждаясь в CD. Взять, к примеру, GParted или CloneZilla. Который я периодически загружаю с их Live CD. Но я бы хотел исключить использование CD / DVD-носителей, потому что он медленный, шумный и подвержен ошибкам (царапинам на диске). Я бы предпочел загрузить эти инструменты с жесткого диска моего ПК для обслуживания / ремонта, который я использую для двойной загрузки между Win7 (NTFS) и FreeBSD (UFS2), используя Grub2.

Я уже достаточно прогуглил, чтобы понять, что загрузка образов ISO не работает хорошо (и я также понимаю, почему), и способ сделать это - извлечь содержимое Live CD и загрузить эти файлы напрямую.

Вот что мне удалось до сих пор:

  • Скопируйте файлы из образа ISO в папку в разделе UFS2.
  • Переведите записи меню isolinux на Live CD в подменю grub2.

Когда я выбираю один из элементов подменю во время запуска системы, запись начинает загружаться, но после некоторого многообещающего вывода на экран она начинает выплевывать одно и то же разочаровывающее сообщение несколько раз.

modprobe: module unknown not found in modules.dep 

Я почти уверен, где и почему это не удается. Но я не знаю архитектуру и внутреннюю работу этих сборок Live Linux, чтобы сделать следующий шаг. И мой веб-поиск по этому вопросу не давал мне полезных результатов.

В качестве реального примера я буду использовать файлы с GParted Live CD здесь. Соответствующие из них:

  • filesystem.packages
  • filesystem.squashfs
  • initrd.img
  • vmlinuz

Это я поместил в / boot / Gparted / live / на моем разделе UFS2 ada0s2a ("hd0, msdos2, bsd1" в терминах grub2).

Записи grub2, которые я собрал из записей syslinux на Live CD, ...

menuentry "GParted Live" { insmod part_msdos insmod ufs2 set root=(hd0,msdos2,bsd1) linux /boot/Gparted/live/vmlinuz boot=live config noswap ip=frommedia nosplash initrd /boot/GParted/live/initrd.img } 

и запись «GParted Live (to RAM)» со всеми теми же строками, кроме

 linux /boot/GParted/live/vmlinuz boot=live config noswap noprompt toram=filesystem.squashfs ip=frommedia nosplash 

Мне кажется, что файл filesystem.packages не упоминается в этих записях. И снова, я не знаю, как должен работать процесс загрузки Linux, но я убежден, что проблема, с которой я сталкиваюсь, заключается в том, что загруженное ядро ​​+ initrd пытается использовать данные, хранящиеся в filesystem.packages или filesystem.squashfs изображения и он их не находит.

Чтобы решить проблему, я должен помочь ядру, сообщив ему, где находятся эти файлы изображений. Вопрос в том, как мне это сделать? Где мне это сделать?

Ссылка на filesystem.packages может быть где-то внутри initrd.img . И я могу использовать gunzip и cpio, чтобы извлечь содержимое этого файла изображения. Но я до сих пор не знаю, что искать. Кроме того, я не уверен, что загруженное ядро ​​Linux + initrd.img будет иметь доступ к файлам в моей файловой системе UFS2 (не Linux). Может быть, я должен поместить файлы в отдельный раздел Ext2.

Предложения, объяснения и указатели приветствуются!

1

1 ответ на вопрос

1
Keve

SOLUTION FOUND!

The GParted Live on Hard Disk page describes very well what one needs to do in order to boot GParted Live from files copied to a folder on the hard disk. I also found some other questions here on SuperUser similar to my question. And I found references to

http://www.kernel.org/doc/Documentation/kernel-parameters.txt 

and

https://www.kernel.org/doc/Documentation/x86/boot.txt 

which are both excellent documents of their own subject, but were proven to be completely useless for my problem. First, because they contain far too much details to read through, and second, because the arguments I was looking for were NOT included. Hence I deliberately show them here not-as-a-link but as text only.

A couple of important details to note:

  • The Live system could NOT BOOT properly if the files were on my UFS2 partition because the Debian based GParted image cannot access ufs filesystems. This is in contradiction with the fact that when I boot the actual Live CD and open an XTerm, I always could mount my UFS2 partition. Apparently, this ufs handling capability comes at a later stage of the booting process.
  • The Live system CAN boot properly however, if the files are on my NTFS partition. So I did not need to create a separate linux-friendly Ext2, Ext3, Ext4 or FAT partition. I could just use the other (Win7) partition of my dual-boot config.
  • The "GParted Live on Hard Disk" page includes an alternative solution, making grub2 to mount the actual ISO image as a loop device and then booting from that. This possibility was very much to my liking, but I never managed to get it working.
  • The actual way I got everything working was very easy after reading the "GParted Live on Hard Disk" page, took less than 5 minutes. And I applied that to my existing gparted-live-0.16.1-1-i486 version which I downloaded quite some time ago. Once everything was working the way I wanted, I tried the same method with the latest (at the time of writing, 2016-MAY-25) gparted-live-0.26.0-2-i686 version (used the ZIP because I could not mount the ISO), but this keeps failing to properly boot. JUST SAYING! So you may need to try multiple versions to get a working solution.

HERE IS WHAT WORKS:

The four files from the GParted ISO (or ZIP) mentioned in my original post copied to a /GParted/ folder on my NTFS partition. You can name your folder anything you want, just remember to refer to that exact name later. Then create a grub2 menu entry like this:

menuentry "GParted Live" { insmod part_msdos insmod ntfs set root=(hd0,msdos1) linux /GParted/vmlinuz boot=live config union=aufs noswap noprompt ip=frommedia live-media-path=/GParted bootfrom=/dev/sda1 toram=filesystem.squashfs initrd /GParted/initrd.img } 

Hopefully, this will now help others to solve similar issues!