USB Boot target device into FOG OS Live (FOSL) for debugging
-
Note: This article has been replaced by a newer document at
https://forums.fogproject.org/topic/7727/building-usb-booting-fos-imageThis newer document doesn't have the details developed in this tutorial. I'm leaving this document in place for historical purposes only. You should follow the instructions in the referenced tutorial to produce a functional FOS boot usb.
I’m documenting this process to help with the target device debugging process (but mainly to see if I could do it). Lately we’ve had many leading edge devices fail to pxe boot into the FOG kernel (at the time of writing this the Surface Pro 4 is being tough to debug. The surface pro 4 boots into the ipxe menu, but as soon as you pick an action it appears to hang). By booting the fog client directly into the debug kernel we can help determine if the issue is ipxe related or fog kernel related.
I have an idea how I can rewrite this for the windows folks, for now this is the linux based instructions
Method #1 (linux path / BIOS boot)
The process steps are not complicated, you will need to acquire these things before you begin
- A 2GB (min) flash drive
- A Linux based computer with internet access (In this case I’ll use a ubuntu laptop)
Steps to create the bootable usb drive drive
- Insert the usb flash drive into your linux computer
- We need to identify which device is the flash drive.
- Open a command shell
- We will use the lsblk command to display the block devices.
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 298.1G 0 disk ├─sda1 8:1 0 294.3G 0 part / ├─sda2 8:2 0 1K 0 part └─sda5 8:5 0 3.8G 0 part [SWAP] sdb 8:16 1 15G 0 disk └─sdb1 8:17 1 15G 0 part /media/jondoe/myflash
From this we can see the flash drive (in my case its a 16GB flash drive) is mounted as /dev/sdb. We must remember this path since we will execute several destructive commands next.
You MUST be sure you correctly identify the flash drive. The next step is to delete all partitions on this flash drive. If you get it wrong something important may be lost forever
5) We’ll use fdisk to delete all partitions on the flash drive. In most cases there will be just a single partition on the flash drive. The lsblk command shows us this too. Key in the following command.
fdisk /dev/sdb
6) Key ind
(if fdisk prompts for a partition number enter 1)
7) Key inn
to create a new partitionp
for primary1
for first partition and thenenter
twice
Key inp
to print the current partition table. You should get a printout similar to thisCommand (m for help): p Disk /dev/sdb: 16.1 GB, 16131293184 bytes 255 heads, 63 sectors/track, 1961 cylinders, total 31506432 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0007f93b Device Boot Start End Blocks Id System /dev/sdb1 63 31506431 15753184+ 83 Linux
Note its important that the partition ID be 83 Linux. This was selected as the default value when I created this partition.
9) If everything looks good pressw
to write the partition table. If fdisk does not exit to the command shell key inq
to quit.
For the rest of this post I’m going to switch to say /dev/sdX to represent the flash drive. I don’t want someone to just blindly copy and paste the commands and wipe out something really important.
10) At this point we have a flash drive that has a linux partition on it. Now we need to format the drive. Key in the following:
sudo mkfs /dev/sdX1
11) Now lets mount it so we can install grub.
sudo mount /dev/sdX1 /mnt
12) Next we’ll tell grub to install its boot loader onto the flash drive. Key the following command in to setup the grub environment on the flash drive:
sudo grub-install --force --no-floppy --boot-directory=/mnt/boot /dev/sdX
13) Next we’ll need to install the FOG boot files on the flash drive. Change into the boot directory that was created by the grub-install command.
cd /mnt/boot
14) Next download the following files from the fog project web site. We’ll use the wget command for this.
sudo wget https://fogproject.org/inits/init.xz
sudo wget https://fogproject.org/inits/init_32.xz
sudo wget https://fogproject.org/kernels/bzImage
sudo wget https://fogproject.org/kernels/bzImage32
15) When all of the image files have been downloaded, we need to tell grub how to use them. For this we need to create the grub configuration file. (note: I’m old school and use the vi editor, you could use any text editor you wish here.)
sudo vi /mnt/boot/grub/grub.cfg
16) Paste in the following section into the grub.cfg file.set timeout=10 set default=0 menuentry "FOG 32-bit Debug Kernel" { linux /boot/bzImage32 loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init_32.xz } menuentry "FOG 64-bit Debug Kernel" { linux /boot/bzImage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init.xz }
The above text will create two menu items in the grub boot menu. The fist will be the 32 bit FOG client operating environment, the second will be the 64 bit FOG client. The default client is the 32 bit version. You have 10 seconds to select the 64 bit version. I selected the 32 bit version as default because the 32 bit will boot on both IA32 an amd64 processors.
17) Now that everything is in place we need to move out of the USB drive and unmount it.
cd /
18) Then issue the unmount command
sudo umount /mnt
19) Remove the usb drive from the setup computer and insert it into the target computer
20) Power on the target computer and press F10 or F12 (depending on the manufacture) to bring up the boot menu and select the USB drive.
21) The grub menu should show up right away.
22) Select either the 32 bit or 64 bit boot images and press enter.
Note: If you select the 32 bit image, there will be an unsettling pause with a flashing cursor in the upper left corner of the screen, after about 8 seconds you will see the kernel boot. If you pick the 64 bit image, you will see text spew across the screen right away then boot the kernel. The only thing I can think is that the 32 bit image blanks the screen while the inits are loading and the 64 bit version does not. -
blank reponse
-
Method #3 (linux path / UEFI/BIOS multi-boot)
Warning: I don't have access to a UEFI computer at the time of writing this document. So I can't say for sure if these instructions work correctly for UEFI booting. I know from the drive structure all of the bits are in the right places. But at this time I can't say absolutely it works as intended.
The process steps are not complicated, you will need to acquire these things before you begin
- A 2GB (min) flash drive with msdos partition (if you are using the same flash drive from this thread, just insert it into a windows computer, delete the partition and recreate the partition and format as fat32, we’ll format it again a little bit later in this guide, but its best to have a partition type of msdos/fat32 [required for efi])
- A Linux based computer with internet access
Steps to create the bootable usb drive drive
- Insert the usb flash drive into your linux computer
- We need to identify which device is the flash drive.
- Open a command shell
- We will use the lsblk command to display the block devices.
$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 298.1G 0 disk ├─sda1 8:1 0 294.3G 0 part / ├─sda2 8:2 0 1K 0 part └─sda5 8:5 0 3.8G 0 part [SWAP] sdb 8:16 1 15G 0 disk └─sdb1 8:17 1 15G
From this we can see the flash drive (in my case its a 16GB flash drive) is mounted as /dev/sdb. We must remember this path since we will execute several destructive commands next.
You MUST be sure you correctly identify the flash drive. The next step is to format the flash drive. If you get it wrong something important may be lost forever
For the rest of this post I’m going to switch to say /dev/sdX to represent the flash drive. I don’t want someone to just blindly copy and paste the commands and wipe out something really important.
5) Since we identified what device our drive letter is, lets format it to ensure its clean and properly formatted for an efi boot. To format the flash drive key in the following commands
sudo mkfs -t vfat -n GRUB /dev/sdX1
6) Once the formatting has completed we need to mount the flash drive. Key in the following command:
sudo mount /dev/sdX1 /mnt
7) Just to ensure your ubuntu environment has the required grub files (both efi and bios) issue the following command:
sudo apt-get install grub-efi-ia32-bin grub-efi-amd64-bin grub-pc-bin grub2-common
Now that the required applications are installed lets get to business. Key in the following command to install the IA32 efi grub files onto the flash drive.
sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=i386-efi
9) Key in the following command to install the amd64 efi grub files onto the flash drive.
sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=x86_64-efi
10) Key in the following command to install the IA32 BIOS grub files onto the flash drive. NOTE: Don’t forget to correct the /dev/sdX to the proper device name
sudo grub-install --removable --no-floppy --boot-directory=/mnt/boot --target=i386-pc /dev/sdX
11) Next we’ll need to install the FOG boot files on the flash drive. Change into the boot directory that was created by the grub-install command.
cd /mnt/boot
12) Next download the following files from the fog project web site. We’ll use the wget command for this.Hint: you can copy and paste this entire block into the command shell and it will download the group in order
sudo wget https://fogproject.org/inits/init.xz sudo wget https://fogproject.org/inits/init_32.xz sudo wget https://fogproject.org/kernels/bzImage sudo wget https://fogproject.org/kernels/bzImage32
- When all of the image files have been downloaded, we need to tell grub how to use them. For this we need to create the grub configuration file. (note: I’m old school and use the vi editor, you could use any text editor you wish here.)
sudo vi /mnt/boot/grub/grub.cfg
- Paste in the following section into the grub.cfg file.
set timeout=10 set default=0 menuentry "FOG 32-bit Debug Kernel" { linux /boot/bzImage32 loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init_32.xz } menuentry "FOG 64-bit Debug Kernel" { linux /boot/bzImage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init.xz }
The above text will create two menu items in the grub boot menu. The fist will be the 32 bit FOG client operating environment, the second will be the 64 bit FOG client. The default client is the 32 bit version. You have 10 seconds to select the 64 bit version. I selected the 32 bit version as default because the 32 bit will boot on both IA32 and x86_x64 processors.
15) Now that everything is in place we need to move out of the USB drive and unmount it.
cd /
16) Then issue the unmount command
sudo umount /mnt
17) DoneYou should now have a single FOG Debug OS boot drive that boots both in BIOS mode and UEFI mode.
.
.
.
For the copy and pasters among us (like me, here are the instructions in a copy block)lsblk sudo mkfs -t vfat -n GRUB /dev/sdX1 sudo mount /dev/sdX1 /mnt sudo apt-get install grub-efi-ia32-bin grub-efi-amd64-bin grub-pc-bin grub2-common # for rhel based systems "yum install grub2-efi*" should give you the required tools. I can't confirm it at this time. sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=i386-efi sudo grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=x86_64-efi sudo grub-install --removable --no-floppy --boot-directory=/mnt/boot --target=i386-pc /dev/sdX cd /mnt/boot sudo wget https://fogproject.org/inits/init.xz sudo wget https://fogproject.org/inits/init_32.xz sudo wget https://fogproject.org/kernels/bzImage sudo wget https://fogproject.org/kernels/bzImage32 sudo vi /mnt/boot/grub/grub.cfg #Paste in the following block set timeout=10 set default=0 menuentry "FOG 32-bit Debug Kernel" { linux /boot/bzImage32 loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init_32.xz } menuentry "FOG 64-bit Debug Kernel" { linux /boot/bzImage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init.xz } # End paste in block cd / sudo umount /mnt
-
I do have to admit this method caused a bit of head scratching. My first challenge was to find a physical windows computer in my house, since I’ve cut over the linux. I was able to locate a crusty old Lenovo T43 and prayed that it would boot. The next hurtle was to try to remember how to use XP, (Oh the good old days). With those issues out of the way I setup to duplicate the linux method with winders (as pronounced with a strong southern US accent).
Method #2 (windows path / BIOS boot)
You will need to acquire these things before you begin
- A 2GB (min) flash drive
- A Linux based computer with internet access
- Download unetbootin from this web site https://unetbootin.github.io/
Steps to create a bootable fog debug client
- Create a new folder on your hard drive to store the files needed to build our boot drive. For this discussion lets use c:\fogdebug
- Download unetbootin and save it into c:\fogdebug. There is nothing to install, the download is an executable. I would only download unetbootin from the sourceforge site to ensure you get an official copy.
- Download the fog kernel and inits from the fogproject site and save them into c:\fogdebug folder. Copy and paste each of the links into your browser to download the required file.
https://fogproject.org/inits/init.xz
https://fogproject.org/inits/init_32.xz
https://fogproject.org/kernels/bzImage
https://fogproject.org/kernels/bzImage32
- We’re almost ready to start. We have to add a command line switch to unetbootin to tell it to display a hidden function. So right click on the unetbootin.exe and pick
create short cut
. - Right click on the short cut you just created and select properties.
- In the Target edit box append
showcustom=y
to the end of the executable after the last double quote.
<insert pictore> - Press OK to exit out of the properties editor
- Insert your flash drive into the usb port of your windows computer.
- Format the drive as fat32 to erase the existing content
Note I used the same flash drive from method #1, in this case you need to delete the partition and then recreate it and format it as as a windows fat32 partition or unetbootin will not be able to see it
- Launch the unetbooting using the short cut
Note: you must launch this shortcut using the Run As... (Administrator) command because unetbooting will write to the boot bocks of the flash drive.
- If you editited the short cut correctly you should see the hidden custom fields. If you don’t see the custom section then review your changes to the short cut.
<insert picture> - We’re almost ready to create our bootable usb drive. Lets start by populating the fields in the custom section
- For the kernel field navigate to where you saved the bzImage that was downloaded in a previous step (Hint: should be in c:\fogdebug)
- For the initrd field navigate to where you saved the init.xz file.
- For the Options field enter in the following:
loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes
Note: I'm only listing this here for clarity, we are going to completely rewrite the cfg file later.
16) At the bottom ensure the drive type is USB and the drive is set properly to your USB flash drive letter
17) When you are sure you have everything set press OK
18) The screen will change and you will see the progress as unetbootin installs syslinux and the kernel files onto the target flash drive.
19) When unetbootin has completed creating your fog debug boot drive, exit out of unetbootin. We are done with that application.
20) If you browse your usb flash drive you should now see these files:
ubninit, menu.c32, syslinux.cfg, ubnkern, and ldlinux.sysNote: If ldlinux.sys is missing, you didn't launch unetbootin as a local administrator.
21) With wordpad edit the syslinux.cfg file on your flash drive.Note: I'm recommending either wordpad or notepad++ to edit this file, notepad has a nasty habit of adding extra carriage returns to text tiles.
22) Erase the current content of the syslinux.cfg file and replace it with the following text:default menu.c32 prompt 0 menu title FOG Debug OS timeout 100 label unetbootindefault menu label Boot FOG Debug Client x64 kernel /ubnkern append initrd=/ubninit loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes
-
Save and exit your editor.
-
Dismount the usb flash drive and take it to your target computer.
-
Power on the target computer and press F10 or F12 (depending on the manufacture) to bring up the boot menu and select the USB drive.
-
The syslinux menu should show up right away.
-
Since there is only one option either press enter or wait 10 seconds and the fog kernel will boot.
-
Done.
-
For extra credit, you could actually copy all of the fog kernels and inits we downloaded earlier to the root of the flash drive. Then with your text editor, edited the syslinux.cfg file to create a second menu item, change the kernel and init commands to the fog kernel and inits real name and have the dual 32/64 boot as method 1 has.
-
Going in the #wiki when complete.
-
@george1421 This is a great idea!! (Wonder why I haven’t come up with this already )
Reading through your posts I thought about building a hybrid ISO file that people could dump onto their USB sticks. Might be a little easier for most users. But it’s not perfect as people still need to use tools like dd/unetbootin/… What do you think? At least it would be a little more straight forward instead of using grub here and syslinux in another case.
Edit: In the grub.cfg the kernel parameter “initrd=init.xz” is missing. Is this still working? Maybe this is only needed with iPXE but I remember we had trouble if we didn’t add this parameter.
-
@Sebastian-Roth said:
Edit: In the grub.cfg the kernel parameter “initrd=init.xz” is missing. Is this still working? Maybe this is only needed with iPXE but I remember we had trouble if we didn’t add this parameter.
Yes its working no problem. Actually I had the opposite luck when I included it in-line. When I did that I got the kernel panic about unable to mount root fs block (1,0). As seen here. https://forums.fogproject.org/topic/6496/hp-compaq-elite-8300-don-t-boot/14
Once I moved it out of the kernel line and into its own parameter then it booted correctly.I’m working on a multi boot version that should work for both bios and efi booting. (what I’ve done thus far only works for bios). I think when that is done and working. The easiest thing for users would be for the devs in the fog program to either use dd or some process to capture a functioning usb and make that available for download for testing (or provide the instructions).
I went this route to completely eliminate the whole pxe part and the chaining and such. If the kernel won’t boot off usb flash, its simply not going to work from a production server. It would allow quick changes of the kernel since all you need to do is replace the OS files on the flash drive and you are running the latest FOG Client OS. Right now I’m not seeing a downside for target debugging. <…> Just thinking a bit, if you needed additional debugging tools, the devs could do something like how the linux router project [LRP] does and build tar packages and overlay the tar packages on the root file system to add additional support files. Because really we can change the size of the virtual hard drive to accommodate these additional (layered on) files by just increasing the size in the grub cfg file. This is only a debug kernel not intended for production.
[Edit] thinking a bit maybe and iso image would work just as well. You would still need unetbootin or dd as you noted to copy the iso to flash media if the user wanted to go that way. [/Edit]
-
@george1421 said:
The easiest thing for users would be for the devs in the fog program to either use dd or some process to capture a functioning usb and make that available for download for testing.
That’s exactly the point why I thought about an ISO image. Sure you can take an image (using dd or other tools) from a good prepared USB stick but to me that seams a bit like putting the cart before the horse (please don’t get me wrong, not meaning to be offensive here!)
Generating an ISO that is multiboot on BIOS and EFI (32bit and 64bit!) is possible without much effort. So Tom can add this step to his kernel compile/upload toolchain and we will have current kernel/init.xz and bootable ISO file ready to download for users all the time.
Hugh advantage would be that we only need one “simple” description of how to dump this ISO onto USB sticks. As well a generated ISO is just big enough to take up all the things needed. Whereas an image file (dd or what) is usually created with a fixed size. Sure you can grow/shrink it to suit your needs but it adds some unnecessary inconvenience to it.Thanks heaps for all the effort you are putting into this and all the tutorials you wrote. I am sure users will find this really helpful even if we end up providing an easy to handle ready to go ISO file!
I’ve played with syslinux (http://www.syslinux.org/wiki/index.php/Isohybrid) for about two hours just to find out that its UEFI support is still kind of young. Does not mean it is impossible to achieve but I found a way easier solution using GRUB2. To generate a FOG debug ISO I downloaded the kernel/init files, wrote a grub.cfg like you have, put it all in a local directory called ISO_root and called
grub-mkrescue -o fog_debug.iso ISO_root/
. This is on Debian Jessie. Out comes a ready to go ISO file which I can boot in qemu! Testing it on USB Stick now…Edit: Sorry, I was wrong. This simple command only generates an ISO usable on BIOS machines - at least on my BIOS machine right now. Might take some extra effort to generate BIOS/UEFI ISOs or just the right packages installed. Reading on…
Edit2: Needed to install grub-efi-amd64-bin and grub-efi-ia32-bin to have grub-mkrescure build a multiboot ISO. Here is a first try which also tries to detect 32/64bit Arch (grub cmd cpuid): https://drive.google.com/folderview?id=0B-bOeHjoUmyMM2c4LV90Z1NyNWc&usp=sharing (wow, 60 MB just for a plain BIOS/EFI 32/64bit debug ISO… may I ask you guys to give this a try on various platforms? Just dump it on USB stick using dd/win32 disk imager/unetbootin etc.)
-
@Sebastian-Roth No offense taken here. In the very first iteration of this document I did say that I didn’t have a use case for doing this. It was more about could I do it vs I need to do this. The idea was to provide a tool were we could boot the fog kernel on new and emerging hardware to be able to collect information necessary to help with the debugging process much like the live boot recommendation. If the fog devs can create a tool with the precise utilities or data collection bits needed to better support fog development then that is a plus too.
I was surprised how small the actual functioning usb is and it actually works. Looking at the next steps the iso image IS the right decision as long as multiboot works as needed. As you noted you can write the iso image to flash, cdrom, or even boot with a virtual machine (not sure of the value with this). With only 60MB being used you have plenty of room to install any missing (i.e. not required for fog capture or deployment) utilities that would make the debugging process easier.
I think a perfect use/test case for your image is for these new UEFI based tablets that seem to be giving the current fog client OS fits. The only problem is if the fog kernel fails to boot via the iso image, how do we fix it?
The one thing that is missing (I think) is once you have your usb flash drive, is a way to refresh the kernels as new kernels are released over time. It could just be a simple update script. When I booted my flash drive (created with my process) the flash drive did not show up using lsblk. At the time it wasn’t important, but if I need to update the kernels I’ll have to do it through a different process.
-
I think having a troubleshooting ISO is an amazing idea.
Just be sure to include “troubleshoot” in the name / menus so that people don’t get the wrong idea and think this is the way to go for every time they wanna use fog.
-
@george1421 said:
The one thing that is missing (I think) is once you have your usb flash drive, is a way to refresh the kernels as new kernels are released over time.
I really hope that we can get this streamlined into Tom’s compile tool chain. So if he builds new kernels and inits and uploads those to the website he could also add a current ISO to https://fogproject.org/isos for example. Self updating process within the ISO is not worth the scripting effort I reckon as we will have lots of trouble with NIC issues and people behind proxies. So if we update the kernel people just need to download the most current ISO again.
@Wayne-Workman said:
Just be sure to include “troubleshoot” in the name / menus so that people don’t get the wrong idea and think this is the way to go for every time they wanna use fog.
Sure we will! But this is still a very early stage and I am not sure how well this will work. Would you mind giving it a try? Just download the ISO, dump it onto an empty stick and try booting it on various machines/architectures. I don’t have access to different machines right now as I am not working at university anymore…
-
@Sebastian-Roth I will, just bumping the link for now: https://drive.google.com/folderview?id=0B-bOeHjoUmyMM2c4LV90Z1NyNWc&usp=sharing
-
@Sebastian-Roth I’ll run into the office and grab one of the newer dells to test the efi booting. I have to run into the office anyways since I forgot my travel computer bag on Friday. I won’t be back in the office until Wed, so I may not have a chance to test it if I don’t have a viable system.
-
Critical review of FOG Debug booting.
Geo image:
This image booted on crusty Lenovo T43 and e6400 in 32 bit bios mode no problem
Booted OK on e6220 in bios mode both 32 and 64 bit
Booted with error on e6220 in EFI mode with both 32 and 64 bit with error “No C<something> No suitable video mode found. Booting in blind mode” The <something> part was due to sloppy hand writing. Since there was no console I can’t tell if the system actually booted or not. I’m suspecting that it was running since it didn’t panic anywhere. There probably needs a kernel parameter passed since the font was really tiny like a 132x56 console resolution, where bios mode had traditional 80x25 resolution.ISO image:
Used unetbootin to “burn” iso image to 16GB usb drive.Issue observed, unetbootin creates an entry called default with a 10 second timeout.
- This default value selected the x64 bit kernel. This fails if the booted device has a 32 bit CPU. I assume it is picking this up from the grub menu. Suggestion make the 32bit kernel default or users will see you have the wrong processor try again message.
- The default option (on a computer with 64 bit processor causes a kernel panic “unable to mount root filesystem”
Dell e6220
BIOS mode:
Default: Resulted in kernel panic
x64 booted to command prompt
x32 booted to command prompt
EFI mode:
Selecting the usb flash drive from the efi boot menu caused a pause then started booting from hard drive. I never got to the grub menu.Lenovo T43
BIOS Mode (only)
Default resulted in kernel panic
32 bit booted to command prompt
64 (not supported)Dell e6400
Bios Mode (only)
Default resulted in kernel panic
32 bit booted to command prompt
64 (not supported)I looked at the syslinux.cfg that unetbootin created. And I can see that the 64 bit kernel does have the lead over the 32 bit kernel. I suggest that this order be changed in the grub menu to make the 32 bit kernel default. I’m not sure what happened. But as you see unetbootin copied the 64 bit bzimage and renamed it to ubnkern and copied init.xz to ubninit. The copied bzImage has the right size, but the copied init.xz is only 2.8MB in size.
label unetbootindefault menu label Default kernel /ubnkern append initrd=/ubninit loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes label ubnentry0 menu label FOG 64-bit Debug Kernel kernel /boot/bzImage append initrd=/boot/init.xz loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes
-
Critial review FOG Debug booting
ISO image:
Burned iso image to flash drive using:dd if=multi.iso of=/dev/sdb
BIOS booting on e6220
Invalid partition table! and will sit there until enter is pressed. Then GRUB menu is displayed but only option is x64 kernel. x64 kernel does boot to command promptUEFI booting on e6220
Grub menu not displayed. Error message displayed: “Error: disk `’ not found. Entering rescue mode… grub>”When I reinsert the flash drive into my computer, ubuntu could not mount it. I assume I did something wrong with either the format or the way dd was used.
For reference this is the structure of the flash drive
sdb 8:32 1 15G 0 disk ├─sdb1 8:33 1 136K 0 part ├─sdb2 8:34 1 2.8M 0 part └─sdb3 8:35 1 56.4M 0 part
In preparation for rebuilding my direct path, when I ran fdisk it reported that the usb flash drive was in GPT mode and it only reported one partition in fdisk. I did see the procedure to go the gpt route but I elected to go the vfat route which only required one partition with MBR. Just saying not implying anything.
-
Working back with my image. For EFI booting when I boot with grub2 in efi mode I get the following error message.
Error: no suitable video mode found.
Booting in blind modeAfter a little research I found I needed to add this to the grub menu then the fog kernel would boot in EFI mode.
insmod efi_gop
insmod efi_uga
insmod fontSo I updated the grub.cfg menu to this:
set timeout=10 set default=0 menuentry "FOG 32-bit Debug Kernel" { linux /boot/bzImage32 loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init_32.xz } menuentry "FOG 64-bit Debug Kernel" { insmod efi_gop insmod efi_uga insmod font linux /boot/bzImage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init.xz }
If I picked the 64 bit kernel it would boot without issue. If I selected the 32 bit kernel it would get the error message.
Now the thing I don’t know, is this error message because of FOG or is it because of something is missing in the kernel itself that grub is inserting? Would this explain why some devices which boot in efi get a black screen?
As a side note, if I leave those settings in place and boot in BIOS mode and select the 64 bit kernel I get warning messages and have to press enter to start booting the kernel, so this is not a viable option for multi booting.
-
Awesome stuff! We are making progress here I reckon. Some of my findings:
- need to add
--modules=part_gpt
to the grub-mkrescue call to make it work with UEFI machines (don’t ask me why!) - updated the - automatic arch selection is not a great idea - using two menu entries like George is better I find
- instead of grub modules
efi_gop
andefi_uga
we probably can useall_video
which is handled a lot better if we are using a multiboot (bios+uefi) ISO - don’t use unetbootin to “burn” the ISO onto a USB stick as it is altering the bootloader (fail!) - use dd, rawwrite, win32diskimager or any other simple tool that does a sector by sector copy (you might need to rename .iso to .img)
Uploaded a new ISO image called debug_v2.iso: https://drive.google.com/folderview?id=0B-bOeHjoUmyMM2c4LV90Z1NyNWc&usp=sharing
- need to add
-
I started testing the debug_v2.iso
To move the iso image to my usb flash drive I used the dd command.
sudo dd bs=4M if=debug_v2.iso of=/dev/sdb
The copy worked as it should. I ejected the usb drive and reinserted it into my ubuntu laptop. This error was thrown when I inserted it and the laptop tried to mount it.
Error mounting /dev/sdb3 at /media/jondoe/ISOIMAGE1: Command-line `mount -t "hfsplus" -o "uhelper=udisks2,nodev,nosuid" "/dev/sdb3" "/media/jondoe/ISOIMAGE1"' exited with non-zero exit status 32: mount: wrong fs type, bad option, bad superblock on /dev/sdb3, missing codepage or helper program, or other error In some cases useful info is found in syslog - try dmesg | tail or so
I’m suspecting this is related to the laptop being in bios mode and using mbr disks. I’m not really concerned about it. Just noting that once you create the usb flash drive its not mountable. I don’t have a efi linux system to confirm if it is a bios vs efi vs gpt issue.
The usb booted correctly in efi mode on an e6220 laptop. It also booted correctly in bios mode. I did note something strange. If I booted in 32bit efi mode, issue a reboot at the command prompt and then rebooted in 64 bit efi mode they kernel would throw an error “Fixing recursion fault but reboot is needed” it waits about 10 seconds then does something similar to a core dump all over the screen. The only seems to be an issue if you switch between 32 bit and 64 bit in efi mode. Rebooting multiple times in 32 bit efi or 64 bit efi works as it should.
Booting in bios mode did thow an error about invalid partition table. I’m not sure if that was an issue with my flash drive from before or not. I’m going to try to fix my flash drive again to make a clean boot then reapply the iso image.
-
Method #4 Create automated multiboot
I revived / revised my attempt at making an automated fog debug kernel boot image.
This image in contrast to what grub-mkrescue makes, creates a vFAT image that can be mounted by both gpt and mbr systems. The issue I had with the grub-mkrescue flash image is that I could not mount it on my BIOS ubuntu computer or my windows XP computer (not a big loss).
The following script creates a complete boot image that can be moved to a flash drive with dd, win32diskimager or any other disk image tool (not unetbootin).
File: mk.fogdebugboot
#!/bin/bash if [ -f /tmp/fogkern.img ]; then echo Nuking old FOG Debug image rm -f /tmp/fogkern.img fi echo Make a blank 128MB disk image dd if=/dev/zero of=/tmp/fogkern.img bs=1M count=128 echo Make the partition table, partition and set it bootable. parted --script /tmp/fogkern.img mklabel msdos mkpart p fat32 1 128 set 1 boot on echo Map the partitions from the image file kpartx -a /tmp/fogkern.img # sleep 2 seconds, wait for kpartx to create the device nodes sleep 2 echo Make an vfat filesystem on the first partition. mkfs -t vfat -n GRUB /dev/mapper/loop0p1 echo Mount the filesystem via loopback mount /dev/mapper/loop0p1 /mnt echo Install GRUB grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=i386-efi grub-install --removable --no-nvram --no-uefi-secure-boot --efi-directory=/mnt --boot-directory=/mnt/boot --target=x86_64-efi grub-install --removable --no-floppy --boot-directory=/mnt/boot --target=i386-pc /dev/loop0 echo Download the FOG kernels and inits wget -P /mnt/boot/ https://fogproject.org/inits/init.xz wget -P /mnt/boot/ https://fogproject.org/inits/init_32.xz wget -P /mnt/boot/ https://fogproject.org/kernels/bzImage wget -P /mnt/boot/ https://fogproject.org/kernels/bzImage32 echo Create the grub configuration file cat > /mnt/boot/grub/grub.cfg << EOF set timeout=10 set default=0 insmod all_video menuentry "FOG 32-bit Debug Kernel" { linux /boot/bzImage32 loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init_32.xz } menuentry "FOG 64-bit Debug Kernel" { linux /boot/bzImage loglevel=7 init=/sbin/init root=/dev/ram0 rw ramdisk_size=127000 pcie_aspm=off consoleblank=0 isdebug=yes initrd /boot/init.xz } EOF echo Unmount the loopback umount /mnt echo Unmap the image kpartx -d /tmp/fogkern.img # Write the file to flash drive # sudo dd bs=1M if=/tmp/fogkern.img of=/dev/sdX
-
@george1421 said:
Booting in bios mode did thow an error about invalid partition table. I’m not sure if that was an issue with my flash drive from before or not.
The error is because on the third partition there is stuff to boot this ISO on Mac OS X. Looks like it is trying to mount it as hfsplus but fails. Not sure why that is.
PS: Great script! Maybe you want to download files first and do a rough size calculation before creating the image file. For example:
... size=$((`du -lsm KERNEL_DIR | cut -f1` + 4)) dd if=/dev/zero of=/tmp/fogkern.img bs=1M count=$size parted --script /tmp/fogkern.img mklabel msdos mkpart p fat32 1 $size set 1 boot on