microsoft / azserialconsole

Azure Serial Console
17 stars 10 forks source link

For custom Linux images, what is the kernel config to enable serial console? #37

Closed enihcam closed 6 years ago

enihcam commented 6 years ago

For custom Linux images, what is the kernel config to enable serial console? What is the minimum requirement?

cloudbooster commented 6 years ago

Thanks @enihcam for the feedback. ensure that you have serial console enabled https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-generic#general-linux-system-requirements in GRUB based on the distro ensure that getty is running in ttyS0 for login.

enihcam commented 6 years ago

@harijayms yes I know how to enable ttyS0 in GRUB, but for the kernel config, which flags should be enabled?

asinn826 commented 6 years ago

@enihcam - did you get this solved? Let me know if you still have questions.

enihcam commented 6 years ago

@asinn826 Thanks for reply. To enable this feature, I need minimum required config flags for compiling a custom linux kernel. Can you put it into the doc? You can assume all required flags are disabled by default.

More info about kernel config: https://linuxconfig.org/custom-kernels-in-ubuntu-debian-how-when-and-why

asinn826 commented 6 years ago

@enihcam The way I'm interpreting your question is that you're trying to compile a custom kernel ultimately for image upload and usage in Azure, and you need to know how to configure it such that serial console works with your image. Correct me if I'm wrong.

What stage are you at in the process? I assume from the comments above you are aware that you can either pass options to the kernel 1) when building the kernel, 2) starting the kernel (via a bootloader), or 3) at runtime.

If you wanted to pass options to the kernel to enable serial console at runtime, you can do it via the bootloader (e.g. GRUB) and pass in the parameters console=ttyS0,115200n8 earlyprintk=ttyS0,115200 rootdelay=300. My understanding is that passing in kernel options at runtime (i.e. when the bootloader starts the kernel) is the recommended way of doing this.

Is that not feasible for you, and you would prefer to pass the options in at build time? Areyou able to share any more information about your situation? That would help me understand better.

enihcam commented 6 years ago

config.txt You are right, my Azure VM runs my custom (minimized for web service) kernel. Here I attached the kernel config. Please let me know which flags should be enabled for using azure serial console. Thanks.

asinn826 commented 6 years ago

@enihcam - I was digging around an Ubuntu VM on Azure, it looks like the config file is located at /boot/config-*. There are a lot of serial-related flags, some of which are: CONFIG_MAGIC_SYSRQ_SERIAL=y CONFIG_SERIAL_8250=y

Ultimately it might be worthwhile taking a look at the whole list of serial-related flags in the config file and seeing which ones are most relevant to your image. A min set of flags could be the 2 I pasted above, but I am not 100% sure.

enihcam commented 6 years ago

@asinn826 That's helpful. Thank you. Maybe you can document this in public doc?

asinn826 commented 6 years ago

@enihcam glad to hear that helped! Adding to the docs is a good idea, I'll put it in there. Closing for now but feel free to reopen this if any more questions.