* Question: Redirect guest kernel's message via serial port to a file on dom0 @ 2015-08-24 3:01 Meng Xu 2015-08-24 8:10 ` Andrew Cooper 0 siblings, 1 reply; 10+ messages in thread From: Meng Xu @ 2015-08-24 3:01 UTC (permalink / raw) To: xen-devel@lists.xen.org [-- Attachment #1.1: Type: text/plain, Size: 1451 bytes --] Hi, I'm trying to use a PV guest VM on Xen to help debug Linux. I was using VirtualBox to help debug Linux kernel by redirecting the output of the serial port of the VM to a file in the host. I can do it in VirtualBox. [Why do I want to achieve this?] It is much faster to reboot a VM than rebooting the physical machine. I don't need another machine to physically connect to the serial port of the development machine. I want to use Xen for as many things as possible. ;-) I tried to google a tutorial or manual about how to configure it, but didn't find any. :-( In my understanding, I need to do the following things: 1) I need to add a line (something like "serial=") in the guest's configuration file to specify the serial port device to the VM; 2) I need some configuration to redirect the output of the serial device to a file in domU; 3) After that, I can configure the kernel command line in the VM to dump the kernel message via the serial port of the VM. (I know how to do this step.) Did anyone have tried this before and have some configuration I can refer to? or Could anyone give me some references that describes how to configure the above three steps? I really appreciate any help or suggestion or comment. Thank you very much! Best, Meng ----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/ [-- Attachment #1.2: Type: text/html, Size: 3100 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-08-24 3:01 Question: Redirect guest kernel's message via serial port to a file on dom0 Meng Xu @ 2015-08-24 8:10 ` Andrew Cooper 2015-08-25 2:48 ` Meng Xu 0 siblings, 1 reply; 10+ messages in thread From: Andrew Cooper @ 2015-08-24 8:10 UTC (permalink / raw) To: Meng Xu, xen-devel@lists.xen.org [-- Attachment #1.1: Type: text/plain, Size: 1655 bytes --] On 24/08/2015 04:01, Meng Xu wrote: > Hi, > > I'm trying to use a PV guest VM on Xen to help debug Linux. > I was using VirtualBox to help debug Linux kernel by redirecting the > output of the serial port of the VM to a file in the host. I can do it > in VirtualBox. > > [Why do I want to achieve this?] > It is much faster to reboot a VM than rebooting the physical machine. > I don't need another machine to physically connect to the serial port > of the development machine. > I want to use Xen for as many things as possible. ;-) > > I tried to google a tutorial or manual about how to configure it, but > didn't find any. :-( > > In my understanding, I need to do the following things: > 1) I need to add a line (something like "serial=") in the guest's > configuration file to specify the serial port device to the VM; > 2) I need some configuration to redirect the output of the serial > device to a file in domU; > 3) After that, I can configure the kernel command line in the VM to > dump the kernel message via the serial port of the VM. (I know how to > do this step.) > > Did anyone have tried this before and have some configuration I can > refer to? or > Could anyone give me some references that describes how to configure > the above three steps? > > I really appreciate any help or suggestion or comment. Configure xenconsoled to log guest consoles to file "--log=guest" at which point anything sent to hvc0 will be logged to files in /var/log/xen/guest/console (configurable with "--log-dir=") There is usually XENCONSOLED_ARGS= in a configuration file somewhere in /etc. ~Andrew [-- Attachment #1.2: Type: text/html, Size: 3874 bytes --] [-- Attachment #2: Type: text/plain, Size: 126 bytes --] _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-08-24 8:10 ` Andrew Cooper @ 2015-08-25 2:48 ` Meng Xu 2015-08-25 7:42 ` Andrew Cooper 0 siblings, 1 reply; 10+ messages in thread From: Meng Xu @ 2015-08-25 2:48 UTC (permalink / raw) To: Andrew Cooper; +Cc: xen-devel@lists.xen.org Hi Andrew, Thank you so much for your suggestion! I tried but have some questions. 2015-08-24 4:10 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: > > On 24/08/2015 04:01, Meng Xu wrote: > > Hi, > > I'm trying to use a PV guest VM on Xen to help debug Linux. > I was using VirtualBox to help debug Linux kernel by redirecting the output of the serial port of the VM to a file in the host. I can do it in VirtualBox. > > [Why do I want to achieve this?] > It is much faster to reboot a VM than rebooting the physical machine. > I don't need another machine to physically connect to the serial port of the development machine. > I want to use Xen for as many things as possible. ;-) > > I tried to google a tutorial or manual about how to configure it, but didn't find any. :-( > > In my understanding, I need to do the following things: > 1) I need to add a line (something like "serial=") in the guest's configuration file to specify the serial port device to the VM; > 2) I need some configuration to redirect the output of the serial device to a file in domU; > 3) After that, I can configure the kernel command line in the VM to dump the kernel message via the serial port of the VM. (I know how to do this step.) > > Did anyone have tried this before and have some configuration I can refer to? or > Could anyone give me some references that describes how to configure the above three steps? > > I really appreciate any help or suggestion or comment. > > > Configure xenconsoled to log guest consoles to file "--log=guest" at which point anything sent to hvc0 will be logged to files in /var/log/xen/guest/console (configurable with "--log-dir=") I set "XENCONSOLED_TRACE=guest" under /etc/default/xencommons , because in /etc/init.d/xencommons, it has: test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" So I think this is what you mean by "--log=guest"; After I set this variable and restart the xencommons by "service xencommons restart" on dom0 (Ubuntu 12.04LTS), I still couldn't find the file in /var/log/xen/guest/console when I reboot the VM. Actually, "find /var -name console" returns no result. **My question is:** Is there anything else I need to configure to get the /var/log/xen/guest/console? I don't see the folder under /var/log/xen. :-( BTW, I also tried "find /etc |grep -i "log-dir"", but find no file has the keyword "log-dir". > > > There is usually XENCONSOLED_ARGS= in a configuration file somewhere in /etc. Yes, I think I found it in /etc/init.d/xencommons. ---I attached the config file for the VM just in case it is helpful:-- name = "vm1" memory = 8192 disk = ['file:/images/vm1.img,xvda,w'] vif = ['bridge=xenbr0'] extra = "debian-installer/exit/always_halt=true --console=hvc0" bootloader = "pygrub" Thank you very much for your help! Best regards, Meng ----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-08-25 2:48 ` Meng Xu @ 2015-08-25 7:42 ` Andrew Cooper 2015-08-25 13:04 ` Meng Xu 0 siblings, 1 reply; 10+ messages in thread From: Andrew Cooper @ 2015-08-25 7:42 UTC (permalink / raw) To: Meng Xu; +Cc: xen-devel@lists.xen.org On 25/08/2015 03:48, Meng Xu wrote: > Hi Andrew, > > Thank you so much for your suggestion! I tried but have some questions. > > 2015-08-24 4:10 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: >> On 24/08/2015 04:01, Meng Xu wrote: >> >> Hi, >> >> I'm trying to use a PV guest VM on Xen to help debug Linux. >> I was using VirtualBox to help debug Linux kernel by redirecting the output of the serial port of the VM to a file in the host. I can do it in VirtualBox. >> >> [Why do I want to achieve this?] >> It is much faster to reboot a VM than rebooting the physical machine. >> I don't need another machine to physically connect to the serial port of the development machine. >> I want to use Xen for as many things as possible. ;-) >> >> I tried to google a tutorial or manual about how to configure it, but didn't find any. :-( >> >> In my understanding, I need to do the following things: >> 1) I need to add a line (something like "serial=") in the guest's configuration file to specify the serial port device to the VM; >> 2) I need some configuration to redirect the output of the serial device to a file in domU; >> 3) After that, I can configure the kernel command line in the VM to dump the kernel message via the serial port of the VM. (I know how to do this step.) >> >> Did anyone have tried this before and have some configuration I can refer to? or >> Could anyone give me some references that describes how to configure the above three steps? >> >> I really appreciate any help or suggestion or comment. >> >> >> Configure xenconsoled to log guest consoles to file "--log=guest" at which point anything sent to hvc0 will be logged to files in /var/log/xen/guest/console (configurable with "--log-dir=") > > I set "XENCONSOLED_TRACE=guest" under /etc/default/xencommons , > because in /etc/init.d/xencommons, it has: test -z > "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" > > So I think this is what you mean by "--log=guest"; After I set this > variable and restart the xencommons by "service xencommons restart" on > dom0 (Ubuntu 12.04LTS), I still couldn't find the file in > /var/log/xen/guest/console when I reboot the VM. > Actually, "find /var -name console" returns no result. > > **My question is:** > Is there anything else I need to configure to get the > /var/log/xen/guest/console? > > I don't see the folder under /var/log/xen. :-( You probably need to mkdir it then, or extend the args list with --log-dir=/var/log/xen ~Andrew ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-08-25 7:42 ` Andrew Cooper @ 2015-08-25 13:04 ` Meng Xu 2015-09-01 10:52 ` Ian Campbell 0 siblings, 1 reply; 10+ messages in thread From: Meng Xu @ 2015-08-25 13:04 UTC (permalink / raw) To: Andrew Cooper; +Cc: xen-devel@lists.xen.org 2015-08-25 3:42 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: > On 25/08/2015 03:48, Meng Xu wrote: >> Hi Andrew, >> >> Thank you so much for your suggestion! I tried but have some questions. >> >> 2015-08-24 4:10 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: >>> On 24/08/2015 04:01, Meng Xu wrote: >>> >>> Hi, >>> >>> I'm trying to use a PV guest VM on Xen to help debug Linux. >>> I was using VirtualBox to help debug Linux kernel by redirecting the output of the serial port of the VM to a file in the host. I can do it in VirtualBox. >>> >>> [Why do I want to achieve this?] >>> It is much faster to reboot a VM than rebooting the physical machine. >>> I don't need another machine to physically connect to the serial port of the development machine. >>> I want to use Xen for as many things as possible. ;-) >>> >>> I tried to google a tutorial or manual about how to configure it, but didn't find any. :-( >>> >>> In my understanding, I need to do the following things: >>> 1) I need to add a line (something like "serial=") in the guest's configuration file to specify the serial port device to the VM; >>> 2) I need some configuration to redirect the output of the serial device to a file in domU; >>> 3) After that, I can configure the kernel command line in the VM to dump the kernel message via the serial port of the VM. (I know how to do this step.) >>> >>> Did anyone have tried this before and have some configuration I can refer to? or >>> Could anyone give me some references that describes how to configure the above three steps? >>> >>> I really appreciate any help or suggestion or comment. >>> >>> >>> Configure xenconsoled to log guest consoles to file "--log=guest" at which point anything sent to hvc0 will be logged to files in /var/log/xen/guest/console (configurable with "--log-dir=") >> >> I set "XENCONSOLED_TRACE=guest" under /etc/default/xencommons , >> because in /etc/init.d/xencommons, it has: test -z >> "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" >> >> So I think this is what you mean by "--log=guest"; After I set this >> variable and restart the xencommons by "service xencommons restart" on >> dom0 (Ubuntu 12.04LTS), I still couldn't find the file in >> /var/log/xen/guest/console when I reboot the VM. >> Actually, "find /var -name console" returns no result. >> >> **My question is:** >> Is there anything else I need to configure to get the >> /var/log/xen/guest/console? >> >> I don't see the folder under /var/log/xen. :-( > > You probably need to mkdir it then, or extend the args list with > --log-dir=/var/log/xen I tried both, but neither of them works. :-( I'm wondering if anyone has some document about how to do this? If there is some document about how to debug this configuration issue, it could also be helpful... But I didn't find it after googling and trying for 2 hours...:-( Below is the detail of what I tried: I tried to mkdir /var/log/xen/guest and restart the xencommons by "service xencommons restart", I still didn't see the console file. I create the console file under /var/log/xen/guest, there is nothing inside console when I reboot the VM. I also tried to specify --log-dir=/var/log/xen by changing the line 98 at /etc/init.d/xencommons to "test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE --log-dir=/var/log/xen"" I output the $XENCONSOLED_ARGS to confirm that its value is --log=guest --log-dir=/var/log/xen. Thank you very much! Best, Meng ----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-08-25 13:04 ` Meng Xu @ 2015-09-01 10:52 ` Ian Campbell 2015-09-01 15:15 ` Meng Xu 0 siblings, 1 reply; 10+ messages in thread From: Ian Campbell @ 2015-09-01 10:52 UTC (permalink / raw) To: Meng Xu, Andrew Cooper; +Cc: xen-devel@lists.xen.org On Tue, 2015-08-25 at 09:04 -0400, Meng Xu wrote: > 2015-08-25 3:42 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: > > On 25/08/2015 03:48, Meng Xu wrote: > > > Hi Andrew, > > > > > > Thank you so much for your suggestion! I tried but have some > > > questions. > > > > > > 2015-08-24 4:10 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: > > > > On 24/08/2015 04:01, Meng Xu wrote: > > > > > > > > Hi, > > > > > > > > I'm trying to use a PV guest VM on Xen to help debug Linux. > > > > I was using VirtualBox to help debug Linux kernel by redirecting > > > > the output of the serial port of the VM to a file in the host. I > > > > can do it in VirtualBox. > > > > > > > > [Why do I want to achieve this?] > > > > It is much faster to reboot a VM than rebooting the physical > > > > machine. > > > > I don't need another machine to physically connect to the serial > > > > port of the development machine. > > > > I want to use Xen for as many things as possible. ;-) > > > > > > > > I tried to google a tutorial or manual about how to configure it, > > > > but didn't find any. :-( > > > > > > > > In my understanding, I need to do the following things: > > > > 1) I need to add a line (something like "serial=") in the guest's > > > > configuration file to specify the serial port device to the VM; > > > > 2) I need some configuration to redirect the output of the serial > > > > device to a file in domU; > > > > 3) After that, I can configure the kernel command line in the VM to > > > > dump the kernel message via the serial port of the VM. (I know how > > > > to do this step.) > > > > > > > > Did anyone have tried this before and have some configuration I can > > > > refer to? or > > > > Could anyone give me some references that describes how to > > > > configure the above three steps? > > > > > > > > I really appreciate any help or suggestion or comment. > > > > > > > > > > > > Configure xenconsoled to log guest consoles to file "--log=guest" > > > > at which point anything sent to hvc0 will be logged to files in > > > > /var/log/xen/guest/console (configurable with "--log-dir=") > > > > > > I set "XENCONSOLED_TRACE=guest" under /etc/default/xencommons , > > > because in /etc/init.d/xencommons, it has: test -z > > > "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" > > > > > > So I think this is what you mean by "--log=guest"; After I set this > > > variable and restart the xencommons by "service xencommons restart" > > > on > > > dom0 (Ubuntu 12.04LTS), I still couldn't find the file in > > > /var/log/xen/guest/console when I reboot the VM. > > > Actually, "find /var -name console" returns no result. > > > > > > **My question is:** > > > Is there anything else I need to configure to get the > > > /var/log/xen/guest/console? > > > > > > I don't see the folder under /var/log/xen. :-( > > > > You probably need to mkdir it then, or extend the args list with > > --log-dir=/var/log/xen > > I tried both, but neither of them works. :-( > > I'm wondering if anyone has some document about how to do this? > If there is some document about how to debug this configuration issue, > it could also be helpful... > But I didn't find it after googling and trying for 2 hours...:-( > > Below is the detail of what I tried: > > I tried to mkdir /var/log/xen/guest The correct (default) path is /var/log/xen/console I think. > and restart the xencommons by > "service xencommons restart", Are you using sysvinit or systemd? If the latter are you using the systemd units of the sysvinit scripts via systemd's LSB compat mode? If you are using the systemd units then I think they might be configured elsewhere. Ian. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-09-01 10:52 ` Ian Campbell @ 2015-09-01 15:15 ` Meng Xu 2015-09-01 15:26 ` Ian Campbell 0 siblings, 1 reply; 10+ messages in thread From: Meng Xu @ 2015-09-01 15:15 UTC (permalink / raw) To: Ian Campbell; +Cc: Andrew Cooper, xen-devel@lists.xen.org 2015-09-01 6:52 GMT-04:00 Ian Campbell <ian.campbell@citrix.com>: > On Tue, 2015-08-25 at 09:04 -0400, Meng Xu wrote: >> 2015-08-25 3:42 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: >> > On 25/08/2015 03:48, Meng Xu wrote: >> > > Hi Andrew, >> > > >> > > Thank you so much for your suggestion! I tried but have some >> > > questions. >> > > >> > > 2015-08-24 4:10 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: >> > > > On 24/08/2015 04:01, Meng Xu wrote: >> > > > >> > > > Hi, >> > > > >> > > > I'm trying to use a PV guest VM on Xen to help debug Linux. >> > > > I was using VirtualBox to help debug Linux kernel by redirecting >> > > > the output of the serial port of the VM to a file in the host. I >> > > > can do it in VirtualBox. >> > > > >> > > > [Why do I want to achieve this?] >> > > > It is much faster to reboot a VM than rebooting the physical >> > > > machine. >> > > > I don't need another machine to physically connect to the serial >> > > > port of the development machine. >> > > > I want to use Xen for as many things as possible. ;-) >> > > > >> > > > I tried to google a tutorial or manual about how to configure it, >> > > > but didn't find any. :-( >> > > > >> > > > In my understanding, I need to do the following things: >> > > > 1) I need to add a line (something like "serial=") in the guest's >> > > > configuration file to specify the serial port device to the VM; >> > > > 2) I need some configuration to redirect the output of the serial >> > > > device to a file in domU; >> > > > 3) After that, I can configure the kernel command line in the VM to >> > > > dump the kernel message via the serial port of the VM. (I know how >> > > > to do this step.) >> > > > >> > > > Did anyone have tried this before and have some configuration I can >> > > > refer to? or >> > > > Could anyone give me some references that describes how to >> > > > configure the above three steps? >> > > > >> > > > I really appreciate any help or suggestion or comment. >> > > > >> > > > >> > > > Configure xenconsoled to log guest consoles to file "--log=guest" >> > > > at which point anything sent to hvc0 will be logged to files in >> > > > /var/log/xen/guest/console (configurable with "--log-dir=") >> > > >> > > I set "XENCONSOLED_TRACE=guest" under /etc/default/xencommons , >> > > because in /etc/init.d/xencommons, it has: test -z >> > > "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE" >> > > >> > > So I think this is what you mean by "--log=guest"; After I set this >> > > variable and restart the xencommons by "service xencommons restart" >> > > on >> > > dom0 (Ubuntu 12.04LTS), I still couldn't find the file in >> > > /var/log/xen/guest/console when I reboot the VM. >> > > Actually, "find /var -name console" returns no result. >> > > >> > > **My question is:** >> > > Is there anything else I need to configure to get the >> > > /var/log/xen/guest/console? >> > > >> > > I don't see the folder under /var/log/xen. :-( >> > >> > You probably need to mkdir it then, or extend the args list with >> > --log-dir=/var/log/xen >> >> I tried both, but neither of them works. :-( >> >> I'm wondering if anyone has some document about how to do this? >> If there is some document about how to debug this configuration issue, >> it could also be helpful... >> But I didn't find it after googling and trying for 2 hours...:-( >> >> Below is the detail of what I tried: >> >> I tried to mkdir /var/log/xen/guest > > The correct (default) path is /var/log/xen/console I think. > >> and restart the xencommons by >> "service xencommons restart", > > Are you using sysvinit or systemd? I'm using sysvinit, since "pidof /sbin/init " shows that init process has pid = 1. > If the latter are you using the systemd > units of the sysvinit scripts via systemd's LSB compat mode? > > If you are using the systemd units then I think they might be configured > elsewhere. Do I have to explicitly configure a virtual serial device to the PV VM, in order to make Xen create the /var/log/xen/console file? Right now, when I ssh into the PV VM and issue the command #echo 1 > /dev/ttyS0, it returns error "echo: write error: Input/output error". I'm guessing maybe it's because the VM has no serial port configured? Thank you very much for your time and help in this issue! Best regards, Meng -- ----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-09-01 15:15 ` Meng Xu @ 2015-09-01 15:26 ` Ian Campbell 2015-09-01 15:47 ` Meng Xu 0 siblings, 1 reply; 10+ messages in thread From: Ian Campbell @ 2015-09-01 15:26 UTC (permalink / raw) To: Meng Xu; +Cc: Andrew Cooper, xen-devel@lists.xen.org On Tue, 2015-09-01 at 11:15 -0400, Meng Xu wrote: > 2015-09-01 6:52 GMT-04:00 Ian Campbell <ian.campbell@citrix.com>: > > On Tue, 2015-08-25 at 09:04 -0400, Meng Xu wrote: > > > 2015-08-25 3:42 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: > > > > On 25/08/2015 03:48, Meng Xu wrote: > > > > > Hi Andrew, > > > > > > > > > > Thank you so much for your suggestion! I tried but have some > > > > > questions. > > > > > > > > > > 2015-08-24 4:10 GMT-04:00 Andrew Cooper < > > > > > andrew.cooper3@citrix.com>: > > > > > > On 24/08/2015 04:01, Meng Xu wrote: > > > > > > > > > > > > Hi, > > > > > > > > > > > > I'm trying to use a PV guest VM on Xen to help debug Linux. > > > > > > I was using VirtualBox to help debug Linux kernel by > > > > > > redirecting > > > > > > the output of the serial port of the VM to a file in the host. > > > > > > I > > > > > > can do it in VirtualBox. > > > > > > > > > > > > [Why do I want to achieve this?] > > > > > > It is much faster to reboot a VM than rebooting the physical > > > > > > machine. > > > > > > I don't need another machine to physically connect to the > > > > > > serial > > > > > > port of the development machine. > > > > > > I want to use Xen for as many things as possible. ;-) > > > > > > > > > > > > I tried to google a tutorial or manual about how to configure > > > > > > it, > > > > > > but didn't find any. :-( > > > > > > > > > > > > In my understanding, I need to do the following things: > > > > > > 1) I need to add a line (something like "serial=") in the > > > > > > guest's > > > > > > configuration file to specify the serial port device to the VM; > > > > > > 2) I need some configuration to redirect the output of the > > > > > > serial > > > > > > device to a file in domU; > > > > > > 3) After that, I can configure the kernel command line in the > > > > > > VM to > > > > > > dump the kernel message via the serial port of the VM. (I know > > > > > > how > > > > > > to do this step.) > > > > > > > > > > > > Did anyone have tried this before and have some configuration I > > > > > > can > > > > > > refer to? or > > > > > > Could anyone give me some references that describes how to > > > > > > configure the above three steps? > > > > > > > > > > > > I really appreciate any help or suggestion or comment. > > > > > > > > > > > > > > > > > > Configure xenconsoled to log guest consoles to file "- > > > > > > -log=guest" > > > > > > at which point anything sent to hvc0 will be logged to files in > > > > > > /var/log/xen/guest/console (configurable with "--log-dir=") > > > > > > > > > > I set "XENCONSOLED_TRACE=guest" under /etc/default/xencommons , > > > > > because in /etc/init.d/xencommons, it has: test -z > > > > > "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" - > > > > > -log=$XENCONSOLED_TRACE" > > > > > > > > > > So I think this is what you mean by "--log=guest"; After I set > > > > > this > > > > > variable and restart the xencommons by "service xencommons > > > > > restart" > > > > > on > > > > > dom0 (Ubuntu 12.04LTS), I still couldn't find the file in > > > > > /var/log/xen/guest/console when I reboot the VM. > > > > > Actually, "find /var -name console" returns no result. > > > > > > > > > > **My question is:** > > > > > Is there anything else I need to configure to get the > > > > > /var/log/xen/guest/console? > > > > > > > > > > I don't see the folder under /var/log/xen. :-( > > > > > > > > You probably need to mkdir it then, or extend the args list with > > > > --log-dir=/var/log/xen > > > > > > I tried both, but neither of them works. :-( > > > > > > I'm wondering if anyone has some document about how to do this? > > > If there is some document about how to debug this configuration > > > issue, > > > it could also be helpful... > > > But I didn't find it after googling and trying for 2 hours...:-( > > > > > > Below is the detail of what I tried: > > > > > > I tried to mkdir /var/log/xen/guest > > > > The correct (default) path is /var/log/xen/console I think. > > > > > and restart the xencommons by > > > "service xencommons restart", > > > > Are you using sysvinit or systemd? > > I'm using sysvinit, since "pidof /sbin/init " shows that init process > has pid = 1. What if systemd were /sbin/init? > > If the latter are you using the systemd > > units of the sysvinit scripts via systemd's LSB compat mode? > > > > If you are using the systemd units then I think they might be > > configured > > elsewhere. > > Do I have to explicitly configure a virtual serial device to the PV > VM, in order to make Xen create the /var/log/xen/console file? > > Right now, when I ssh into the PV VM and issue the command #echo 1 > > /dev/ttyS0, it returns error "echo: write error: Input/output error". > I'm guessing maybe it's because the VM has no serial port configured? > > Thank you very much for your time and help in this issue! Are we talking about HVM guests or PV guests here? I had assumed PV... A PV guest doesn't have /dev/ttyS0, it has no serial devices. Such guests have /dev/hvc0 as their console. An HVM guest needs to be told where the serial device (ttyS0) goes via the guest config, serial = 'pty' is the magic rune to cause it to be logged by xenconsoled. There are other possibilities, check xl.cfg(5). Ian. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-09-01 15:26 ` Ian Campbell @ 2015-09-01 15:47 ` Meng Xu 2015-09-01 16:01 ` Ian Campbell 0 siblings, 1 reply; 10+ messages in thread From: Meng Xu @ 2015-09-01 15:47 UTC (permalink / raw) To: Ian Campbell; +Cc: Andrew Cooper, xen-devel@lists.xen.org 2015-09-01 11:26 GMT-04:00 Ian Campbell <ian.campbell@citrix.com>: > On Tue, 2015-09-01 at 11:15 -0400, Meng Xu wrote: >> 2015-09-01 6:52 GMT-04:00 Ian Campbell <ian.campbell@citrix.com>: >> > On Tue, 2015-08-25 at 09:04 -0400, Meng Xu wrote: >> > > 2015-08-25 3:42 GMT-04:00 Andrew Cooper <andrew.cooper3@citrix.com>: >> > > > On 25/08/2015 03:48, Meng Xu wrote: >> > > > > Hi Andrew, >> > > > > >> > > > > Thank you so much for your suggestion! I tried but have some >> > > > > questions. >> > > > > >> > > > > 2015-08-24 4:10 GMT-04:00 Andrew Cooper < >> > > > > andrew.cooper3@citrix.com>: >> > > > > > On 24/08/2015 04:01, Meng Xu wrote: >> > > > > > >> > > > > > Hi, >> > > > > > >> > > > > > I'm trying to use a PV guest VM on Xen to help debug Linux. >> > > > > > I was using VirtualBox to help debug Linux kernel by >> > > > > > redirecting >> > > > > > the output of the serial port of the VM to a file in the host. >> > > > > > I >> > > > > > can do it in VirtualBox. >> > > > > > >> > > > > > [Why do I want to achieve this?] >> > > > > > It is much faster to reboot a VM than rebooting the physical >> > > > > > machine. >> > > > > > I don't need another machine to physically connect to the >> > > > > > serial >> > > > > > port of the development machine. >> > > > > > I want to use Xen for as many things as possible. ;-) >> > > > > > >> > > > > > I tried to google a tutorial or manual about how to configure >> > > > > > it, >> > > > > > but didn't find any. :-( >> > > > > > >> > > > > > In my understanding, I need to do the following things: >> > > > > > 1) I need to add a line (something like "serial=") in the >> > > > > > guest's >> > > > > > configuration file to specify the serial port device to the VM; >> > > > > > 2) I need some configuration to redirect the output of the >> > > > > > serial >> > > > > > device to a file in domU; >> > > > > > 3) After that, I can configure the kernel command line in the >> > > > > > VM to >> > > > > > dump the kernel message via the serial port of the VM. (I know >> > > > > > how >> > > > > > to do this step.) >> > > > > > >> > > > > > Did anyone have tried this before and have some configuration I >> > > > > > can >> > > > > > refer to? or >> > > > > > Could anyone give me some references that describes how to >> > > > > > configure the above three steps? >> > > > > > >> > > > > > I really appreciate any help or suggestion or comment. >> > > > > > >> > > > > > >> > > > > > Configure xenconsoled to log guest consoles to file "- >> > > > > > -log=guest" >> > > > > > at which point anything sent to hvc0 will be logged to files in >> > > > > > /var/log/xen/guest/console (configurable with "--log-dir=") >> > > > > >> > > > > I set "XENCONSOLED_TRACE=guest" under /etc/default/xencommons , >> > > > > because in /etc/init.d/xencommons, it has: test -z >> > > > > "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" - >> > > > > -log=$XENCONSOLED_TRACE" >> > > > > >> > > > > So I think this is what you mean by "--log=guest"; After I set >> > > > > this >> > > > > variable and restart the xencommons by "service xencommons >> > > > > restart" >> > > > > on >> > > > > dom0 (Ubuntu 12.04LTS), I still couldn't find the file in >> > > > > /var/log/xen/guest/console when I reboot the VM. >> > > > > Actually, "find /var -name console" returns no result. >> > > > > >> > > > > **My question is:** >> > > > > Is there anything else I need to configure to get the >> > > > > /var/log/xen/guest/console? >> > > > > >> > > > > I don't see the folder under /var/log/xen. :-( >> > > > >> > > > You probably need to mkdir it then, or extend the args list with >> > > > --log-dir=/var/log/xen >> > > >> > > I tried both, but neither of them works. :-( >> > > >> > > I'm wondering if anyone has some document about how to do this? >> > > If there is some document about how to debug this configuration >> > > issue, >> > > it could also be helpful... >> > > But I didn't find it after googling and trying for 2 hours...:-( >> > > >> > > Below is the detail of what I tried: >> > > >> > > I tried to mkdir /var/log/xen/guest >> > >> > The correct (default) path is /var/log/xen/console I think. >> > >> > > and restart the xencommons by >> > > "service xencommons restart", >> > >> > Are you using sysvinit or systemd? >> >> I'm using sysvinit, since "pidof /sbin/init " shows that init process >> has pid = 1. > > What if systemd were /sbin/init? I runned #stat /proc/1/exe, and it returns File: `/proc/1/exe' -> `/sbin/init' According to http://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem, if it is systemd, it will returns "File: '/proc/1/exe' -> '/lib/systemd/systemd'" In addition, my dom0 uses Ubuntu 12.04 LTS. According to the above link, [quote] "the init process on my Ubuntu 14.10 box is Upstart. Ubuntu 15.04 uses systemd." [/quote] So I think my dom0 should uses sysVinit. > >> > If the latter are you using the systemd >> > units of the sysvinit scripts via systemd's LSB compat mode? >> > >> > If you are using the systemd units then I think they might be >> > configured >> > elsewhere. >> >> Do I have to explicitly configure a virtual serial device to the PV >> VM, in order to make Xen create the /var/log/xen/console file? >> >> Right now, when I ssh into the PV VM and issue the command #echo 1 > >> /dev/ttyS0, it returns error "echo: write error: Input/output error". >> I'm guessing maybe it's because the VM has no serial port configured? >> >> Thank you very much for your time and help in this issue! > > Are we talking about HVM guests or PV guests here? I had assumed PV... > > A PV guest doesn't have /dev/ttyS0, it has no serial devices. Such guests > have /dev/hvc0 as their console. Yes. I'm using PV VM. If I run inside VM: # echo 1 > /dev/hvc0, it does not report error. If I use "xl console vm1" to attach to the hvc0, I can see the output 1. However, I still cannot find the console file under /var/log/xen. Actually, there is no such file under /var after I run "find /var -name console". I'm wondering if there is any way for me to debug which configuration is incorrect? After I make it work, I can write a wiki to document the working approach. :-) Thank you again for your time and help! Best, meng ----------- Meng Xu PhD Student in Computer and Information Science University of Pennsylvania http://www.cis.upenn.edu/~mengxu/ ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Question: Redirect guest kernel's message via serial port to a file on dom0 2015-09-01 15:47 ` Meng Xu @ 2015-09-01 16:01 ` Ian Campbell 0 siblings, 0 replies; 10+ messages in thread From: Ian Campbell @ 2015-09-01 16:01 UTC (permalink / raw) To: Meng Xu; +Cc: Andrew Cooper, xen-devel@lists.xen.org On Tue, 2015-09-01 at 11:47 -0400, Meng Xu wrote: > > Yes. I'm using PV VM. > > If I run inside VM: # echo 1 > /dev/hvc0, it does not report error. > > If I use "xl console vm1" to attach to the hvc0, I can see the output 1. > > However, I still cannot find the console file under /var/log/xen. > Actually, there is no such file under /var after I run "find /var > -name console". You need to "mkdir /var/log/xen/console", xenconsoled doesn't do it automatically. Once you do that and restart the guest then for a guest named "foo" you should get /var/log/xen/console/guest-foo.log > > I'm wondering if there is any way for me to debug which configuration > is incorrect? > After I make it work, I can write a wiki to document the working > approach. :-) http://wiki.xenproject.org/wiki/Reporting_Bugs_against_Xen_Project#Guest_co nsole_logs isn't the most helpful place for the existing document, that's for sure. I suppose there also ought to be a link from http://wiki.xenproject.org/wiki/Xen_FAQ_Console (quite why there is a separate FAQ when http://wiki.xenproject.org/wiki/Xen_Common_Problems#Console actually has more entries I'm not entirely sure) > > Thank you again for your time and help! > > Best, > > meng > > > > ----------- > Meng Xu > PhD Student in Computer and Information Science > University of Pennsylvania > http://www.cis.upenn.edu/~mengxu/ ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-09-01 16:01 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-08-24 3:01 Question: Redirect guest kernel's message via serial port to a file on dom0 Meng Xu 2015-08-24 8:10 ` Andrew Cooper 2015-08-25 2:48 ` Meng Xu 2015-08-25 7:42 ` Andrew Cooper 2015-08-25 13:04 ` Meng Xu 2015-09-01 10:52 ` Ian Campbell 2015-09-01 15:15 ` Meng Xu 2015-09-01 15:26 ` Ian Campbell 2015-09-01 15:47 ` Meng Xu 2015-09-01 16:01 ` Ian Campbell
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).