Re: Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-09 Thread Patrick
On Tue, Mar 8, 2016 at 11:03 AM, 张云  wrote:

>
> You can circumvent the grub-install bug by substituting a USB memory for
> the disk image.
>
> 发自 网易邮箱大师 
>


​Ok, thanks!

-Patrick​
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


回复:Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-08 Thread 张云


You can circumvent the grub-install bug by substituting a USB memory for the 
disk image. 


发自 网易邮箱大师
在2016年03月09日 00:56,Patrick 写道:
The problem is caused by the command below



mkfs -t vfat /dev/loop0


/dev/loop0 is the whole disk, and /dev/loop0p1 is the partition.


The command make a file system on the disk, thus overrides the disk’s partition 
table.  


I guess that it is the partition on which you want to make a filesystem.
The right command is 


  mkfs -t ext2 /dev/loop0p1


We prefer ext2,3,4 to fat32 on linux.




​I see. Thanks! ​I used kpartx to map the partitions in /dev/mapper. If you 
know of a better way of doing what you suggest, could you please let me know?


I was hoping to use ext4, but I wasn't able to grub-install to a loopback 
device. When I try to, I get the error:


> grub-install: error: disk `lvm/loop1p1' not found.



​From a searching around, it looks like this issue has been visited recently by 
the developers:


https://lists.gnu.org/archive/html/grub-devel/2015-05/msg00011.html


So I wasn't able to get it to work. So instead I've been using syslinux, which 
I believe requires FAT, rather than EXT. I read about extlinux, but from my 
reading, I've gotten the impression that syslinux has more history. So I 
figured it would be easier to find useful material for syslinux on message 
boards.


Thanks again for all your help! I hope that at some point I'll be able to do 
more, such as customize the ram disk, the init system, and figure out how to 
get the system switched over to a root file system on a disk.


-Patrick___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-08 Thread Patrick
>
> The problem is caused by the command below
>
> mkfs -t vfat /dev/loop0
>
>
> /dev/loop0 is the whole disk, and /dev/loop0p1 is the partition.
>
> The command make a file system on the disk, thus overrides the disk’s
> partition table.
>
> I guess that it is the partition on which you want to make a filesystem.
> The right command is
>
>   mkfs -t ext2 /dev/loop0p1
>
> We prefer ext2,3,4 to fat32 on linux.
>
>
​I see. Thanks! ​I used kpartx to map the partitions in /dev/mapper. If you
know of a better way of doing what you suggest, could you please let me
know?

I was hoping to use ext4, but I wasn't able to grub-install to a loopback
device. When I try to, I get the error:

> grub-install: error: disk `lvm/loop1p1' not found.

​From a searching around, it looks like this issue has been visited
recently by the developers:

https://lists.gnu.org/archive/html/grub-devel/2015-05/msg00011.html

So I wasn't able to get it to work. So instead I've been using syslinux,
which I believe requires FAT, rather than EXT. I read about extlinux, but
from my reading, I've gotten the impression that syslinux has more history.
So I figured it would be easier to find useful material for syslinux on
message boards.

Thanks again for all your help! I hope that at some point I'll be able to
do more, such as customize the ram disk, the init system, and figure out
how to get the system switched over to a root file system on a disk.

-Patrick
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-07 Thread 张云

> On Mar 8, 2016, at 7:29 AM, Patrick  wrote:
> 
> On Fri, Mar 4, 2016 at 9:09 PM, 张云 > 
> wrote:
> First your must know exactly how linux boot (not at source code level).
> 
> Most recent linux distributions boot as
> 
> grub —> kernel —> initramfs’ /init executable
> 
> All the userspace affair is started by initramfs’ /init. Kernel no longer 
> join the boot process.
> 
> >From you description, I think you were blocked by the initramfs concept. 
> >Initramfs is the first root filesystem and reside in memeory.
> It’s loaded by grub, and the kernel automatically mount it, execute the 
> /init. The /init executable can do some extra initialisation
> and switch to the real root filesystem on disk.
> for detail /Documentaion/filesystems/ramfs-rootfs-initramfs
> 
> Hope that would be useful to your.
> 
> ​Thanks for the response. I was able to get a minimal boot using the files in 
> the mini.iso image from Ubuntu.​ I just copied the kernel and the ramdisk 
> image from that iso, and these have given me enough to start learning some 
> things. It is still just dropping me into the prompt for the ramdisk image, 
> so the kernel hasn't yet made the switch over to root filesystem on a drive, 
> but this is at least enough to get me started.
> 
> One thing I noticed that confused me was the result of the commands pasted 
> below. It looks like the partition table on the disk image might be getting 
> messed up. But, interestingly enough, it still seems to allow me to use the 
> image for booting. In spite of this, fdisk is giving me strange output when I 
> ask it to print out the partition tables after I build a file system on the 
> disk image using mkfs. When I look at the disk image using gparted, on the 
> other hand, it actually looks OK.
> 
> It looks like I might be using mkfs incorrectly. Can anyone see anything 
> obvious that I am doing wrong?
> 
> ==
> 
> dd if=/dev/zero of=./disk.img bs=1M count=1000
> sudo losetup /dev/loop0 ./disk.img
> sudo fdisk /dev/loop0
> (commands in fdisk)
> > n (new partition)
> > p (primary partition)
> > 1 (partition number)
> > (default start and end for partition)
> > t (change type of partition)
> > b (change type of partition to FAT32)
> > a (set boot flag)
> > 1 (set boot flag for first partition)
> > w (write changes)
> ​fdisk -lu /dev/loop0
> ​Disk /dev/loo​p0​
> : 1048 MB, 1048576000 bytes
> 123 heads, 59 sectors/track, 282 cylinders, total 2048000 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: 0x7b9351bf
> 
>   Device Boot  Start End  Blocks   Id  System
> /dev/loop​0​p1   *2048 2047999 1022976b  W95 FAT32
> 

The problem is caused by the command below

> mkfs -t vfat /dev/loop0

/dev/loop0 is the whole disk, and /dev/loop0p1 is the partition.

The command make a file system on the disk, thus overrides the disk’s partition 
table.  

I guess that it is the partition on which you want to make a filesystem.
The right command is 

  mkfs -t ext2 /dev/loop0p1

We prefer ext2,3,4 to fat32 on linux.


> fdisk -lu /dev/loop0
> ​Disk /dev/loop0: 1048 MB, 1048576000 bytes
> 255 heads, 63 sectors/track, 127 cylinders, total 2048000 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: 0x
> 
>   Device Boot  Start End  Blocks   Id  System​
> 
> ​==
> 
> Thanks,
> Patrick​
> 
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-07 Thread Patrick
On Fri, Mar 4, 2016 at 9:09 PM, 张云  wrote:

> First your must know exactly how linux boot (not at source code level).
>
> Most recent linux distributions boot as
>
> grub —> kernel —> initramfs’ /init executable
>
> All the userspace affair is started by initramfs’ /init. Kernel no longer
> join the boot process.
>
> From you description, I think you were blocked by the initramfs concept.
> Initramfs is the first root filesystem and reside in memeory.
> It’s loaded by grub, and the kernel automatically mount it, execute the
> /init. The /init executable can do some extra initialisation
> and switch to the real root filesystem on disk.
> for detail /Documentaion/filesystems/ramfs-rootfs-initramfs
>
> Hope that would be useful to your.
>

​Thanks for the response. I was able to get a minimal boot using the files
in the mini.iso image from Ubuntu.​ I just copied the kernel and the
ramdisk image from that iso, and these have given me enough to start
learning some things. It is still just dropping me into the prompt for the
ramdisk image, so the kernel hasn't yet made the switch over to root
filesystem on a drive, but this is at least enough to get me started.

One thing I noticed that confused me was the result of the commands pasted
below. It looks like the partition table on the disk image might be getting
messed up. But, interestingly enough, it still seems to allow me to use the
image for booting. In spite of this, fdisk is giving me strange output when
I ask it to print out the partition tables after I build a file system on
the disk image using mkfs. When I look at the disk image using gparted, on
the other hand, it actually looks OK.

It looks like I might be using mkfs incorrectly. Can anyone see anything
obvious that I am doing wrong?

==

dd if=/dev/zero of=./disk.img bs=1M count=1000
sudo losetup /dev/loop0 ./disk.img
sudo fdisk /dev/loop0

(commands in fdisk)

> n (new partition)

> p (primary partition)

> 1 (partition number)

> (default start and end for partition)

> t (change type of partition)

> b (change type of partition to FAT32)

> a (set boot flag)

> 1 (set boot flag for first partition)

> w (write changes)

​fdisk -lu /dev/loop0

​
Disk /dev/loo​p0​

: 1048 MB, 1048576000 bytes
123 heads, 59 sectors/track, 282 cylinders, total 2048000 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: 0x7b9351bf

  Device Boot  Start End  Blocks   Id  System
/dev/loop
​0​
p1   *2048 2047999 1022976b  W95 FAT32


mkfs -t vfat /dev/loop0
fdisk -lu /dev/loop0

​Disk /dev/loop0: 1048 MB, 1048576000 bytes
255 heads, 63 sectors/track, 127 cylinders, total 2048000 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: 0x

  Device Boot  Start End  Blocks   Id  System​


​==

Thanks,
Patrick​
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-05 Thread Patrick
>
> What filesystem is on the /dev/sda image that qemu is using?  You'll need
> to
> ​​
> ​
> either build your kernel with the support for that built into the kernel,
> or an initrd that modprobes the filesystem module, and then mounts the
> filesystem (then there's a few fun and games involved in pivoting from
> the ram filesystem the initrd is using as root, to the disk image
> filesystem
> that you want as the root filesystem after boot).
>


​Thanks for the response. This is helpful. I copied the vmlinuz and initrd
image from my host, and that seemed to get me further.

Now blkid says:

/dev/sda: ​SEC_TYPE="msdos" UUID="6815-7325" TYPE="vfat"

The mount command indicates that it mounted successfully at /root.

​The contents of /root are just:

​vmlinuz syslinux.cfg initrd.img ldlinux.c32 ldlinux.sys

I realize that isn't enough to get the system up, so I would like to try to
figure out what I need to drop in there to get the system going. I think
that the other responses that people have so kindly sent to my question
might help me further, since they talk about init.

Although I copied vmlinuz and initrd from the host to get this far, I hope
to eventually figure out how to do something less hacky. I am able to build
the kernel, but I don't really know what's involved with building initrd
for the guest. (It seems I was able to build one on the host using
initramfs, but I'd like to figure out how to build one for the host. I'd
also like to better understand the "fun and games" you were talking about
with pivoting from the ram filesystem to the disk image filesystem. ...but
I'll take it one step at a time, I guess.)

By the way, I'm a double alum (BS and MS) from VT. Go Hokies!

Thanks again,
Patrick
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-04 Thread 张云
First your must know exactly how linux boot (not at source code level).

Most recent linux distributions boot as

grub —> kernel —> initramfs’ /init executable

All the userspace affair is started by initramfs’ /init. Kernel no longer join 
the boot process.

From you description, I think you were blocked by the initramfs concept. 
Initramfs is the first root filesystem and reside in memeory. 
It’s loaded by grub, and the kernel automatically mount it, execute the /init. 
The /init executable can do some extra initialisation 
and switch to the real root filesystem on disk.
for detail /Documentaion/filesystems/ramfs-rootfs-initramfs

Hope that would be useful to your.  

> On Mar 5, 2016, at 2:38 AM, Patrick  wrote:
> 
> Hello,
> 
> I was able to install SYSLINUX on a disk image and get the kernel I built to 
> start booting Linux with QEMU pointing to a loopback device associated with 
> the disk image. However, at some point far into the boot process, I get a 
> kernel panic. I can't read the beginning of the error messages that the 
> kernel prints, because the errors run off the screen.
> 
> I copied the bzImage onto the disk image, and I'm not sure where to go from 
> there. Is the next step to build the initrd image? I don't yet know how to 
> get the kernel to mount a device so it can find the root file system.
> 
> Any help is appreciated.
> 
> Patrick
> ___
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-04 Thread Patrick
On Fri, Mar 4, 2016 at 3:56 PM, Kristof Provost  wrote:

>
> On 04 Mar 2016, at 23:50, Patrick  wrote:
> ​Thanks for the response.​ I had seen that StackOverflow post and done
> that a couple of days ago. I was hoping there was another answer, since I
> wouldn't be able to do that if I weren't using QEMU.
>
> If you weren’t using Qemu I’d point you at netconsole. The first step in
> debugging panics is always to figure out what the panic is.
>
> When I looked at the output from QEMU a couple of days ago, the kernel was
> saying that it couldn't find a device to mount with the root filesystem. So
> I generated an initrd image on the host Linux system, and I used that on
> the guest which got me to a BusyBox prompt. But this was totally a hack,
> since I didn't even know if getting an initrd image was really the next
> thing I needed to do. I was hoping someone might be able to point me to
> something that might explain what to do to get the kernel to mount a device
> with the root filesystem.
>
> You want to pass the ‘root=/dev/foo’ option to your kernel. Obviously
> change /dev/foo into whatever device you’re booting from.
>
> Regards,
> Kristof
>

Ok, thanks. I will try to look into netconsole.​

I had tried changing the "root" option. I had noticed that the QEMU output
showed the kernel printing out this:

[4.312088] VFS: Cannot open root device "(null)" or unknown-block(0,0):
error -6
[4.322029] Please append a correct "root=" boot option; here are the
available partitions:
[4.327850] 0100   65536 ram0  (driver?)
[4.337399] 0101   65536 ram1  (driver?)
[4.345170] 0102   65536 ram2  (driver?)
[4.345691] 0103   65536 ram3  (driver?)
[4.346251] 0104   65536 ram4  (driver?)
[4.346825] 0105   65536 ram5  (driver?)
[4.347442] 0106   65536 ram6  (driver?)
[4.350055] 010a   65536 ram10  (driver?)
[4.352624] 010b   65536 ram11  (driver?)
[4.353597] 010c   65536 ram12  (driver?)
[4.354517] 010d   65536 ram13  (driver?)
[4.354977] 010e   65536 ram14  (driver?)
[4.358393] 010f   65536 ram15  (driver?)
[4.359420] 0b00 1048575 sr0  driver: sr
[4.360499] 0800  102400 sda  driver: sd
[4.367898] Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(0,0)

I hadn't noticed "sda" before. So I tried pointing root at this. Then I got
this:

[4.375721] List of all partitions:
[4.383491] 0100   65536 ram0  (driver?)
[4.386418] 0101   65536 ram1  (driver?)
[4.388736] 0102   65536 ram2  (driver?)
[4.390931] 0103   65536 ram3  (driver?)
[4.391266] 0104   65536 ram4  (driver?)
[4.391726] 0105   65536 ram5  (driver?)
[4.392812] 0106   65536 ram6  (driver?)
[4.393340] 0107   65536 ram7  (driver?)
[4.393932] 0108   65536 ram8  (driver?)
[4.394906] 0109   65536 ram9  (driver?)
[4.396283] 010a   65536 ram10  (driver?)
[4.399212] 010b   65536 ram11  (driver?)
[4.400067] 010c   65536 ram12  (driver?)
[4.401832] 010d   65536 ram13  (driver?)
[4.402775] 010e   65536 ram14  (driver?)
[4.403572] 010f   65536 ram15  (driver?)
[4.404046] 0800  102400 sda  driver: sd
[4.412148] 0b00 1048575 sr0  driver: sr
[4.413323] No filesystem could mount root, tried:  ext3 ext2 ext4 vfat
fuseblk
[4.415310] Kernel panic - not syncing: VFS: Unable to mount root fs on
unknown-block(8,0)

So, I think maybe now the kernel is missing some things it needs on
/dev/sda. Right now, I don't think there is anything on it other than the
bootloader. Do you happen to know where I can find what the kernel needs to
proceed?

Thanks,
Patrick

>
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-04 Thread Kristof Provost

> On 04 Mar 2016, at 23:50, Patrick  wrote:
> ​Thanks for the response.​ I had seen that StackOverflow post and done that a 
> couple of days ago. I was hoping there was another answer, since I wouldn't 
> be able to do that if I weren't using QEMU.
> 
If you weren’t using Qemu I’d point you at netconsole. The first step in 
debugging panics is always to figure out what the panic is.

> When I looked at the output from QEMU a couple of days ago, the kernel was 
> saying that it couldn't find a device to mount with the root filesystem. So I 
> generated an initrd image on the host Linux system, and I used that on the 
> guest which got me to a BusyBox prompt. But this was totally a hack, since I 
> didn't even know if getting an initrd image was really the next thing I 
> needed to do. I was hoping someone might be able to point me to something 
> that might explain what to do to get the kernel to mount a device with the 
> root filesystem.
> 
You want to pass the ‘root=/dev/foo’ option to your kernel. Obviously change 
/dev/foo into whatever device you’re booting from.

Regards,
Kristof

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-04 Thread Kristof Provost
On 2016-03-04 11:38:33 (-0700), Patrick  wrote:
> I was able to install SYSLINUX on a disk image and get the kernel I built
> to start booting Linux with QEMU pointing to a loopback device associated
> with the disk image. However, at some point far into the boot process, I
> get a kernel panic. I can't read the beginning of the error messages that
> the kernel prints, because the errors run off the screen.
> 
You should be able to persuade qemu to be a bit more helpful.
'-nographic' turns off graphical output and redirects the serial port to
the console (or just use '-serial'). You can then configure your kernel
to log to the serial port.

This should get you started:
http://stackoverflow.com/questions/19565116/redirect-qemu-window-output-to-terminal-running-qemu

Regards,
Kristof

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Booting with SYSLINUX on Loopback Device: Kernel Panic - Where to Start?

2016-03-04 Thread Patrick
Hello,

I was able to install SYSLINUX on a disk image and get the kernel I built
to start booting Linux with QEMU pointing to a loopback device associated
with the disk image. However, at some point far into the boot process, I
get a kernel panic. I can't read the beginning of the error messages that
the kernel prints, because the errors run off the screen.

I copied the bzImage onto the disk image, and I'm not sure where to go from
there. Is the next step to build the initrd image? I don't yet know how to
get the kernel to mount a device so it can find the root file system.

Any help is appreciated.

Patrick
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies