Enable serial system console in runtime
There is Linux kernel boot option to enable system console, the console=
, for example, console=ttyS0,115200
or console=ttyS0,115200n8
http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/re01.html
After passing this option, linux kernel will print all (or some) kernel messages to the console, which is useful for debugging.
Is there a way of changing system console in Linux in runtime, without rebooting (with some special sysctls/ioctls/or in /proc
or /sys
filesystems)?
First case: I had no console=
option in current booting (checked in /proc/cmdline) and I want to enable dmesg printing to /dev/ttyS0 serial port to debug the situation.
Second case: I had wrong settings in my console=ttyS0,9600
and want to change speed without reboot (remove old console setting, add new console with good 115200 setting; or just change speed).
(Where console=
option is parsed, where in /sys
or /proc
current settings are stored?)
console linux-kernel serial-port
add a comment |
There is Linux kernel boot option to enable system console, the console=
, for example, console=ttyS0,115200
or console=ttyS0,115200n8
http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/re01.html
After passing this option, linux kernel will print all (or some) kernel messages to the console, which is useful for debugging.
Is there a way of changing system console in Linux in runtime, without rebooting (with some special sysctls/ioctls/or in /proc
or /sys
filesystems)?
First case: I had no console=
option in current booting (checked in /proc/cmdline) and I want to enable dmesg printing to /dev/ttyS0 serial port to debug the situation.
Second case: I had wrong settings in my console=ttyS0,9600
and want to change speed without reboot (remove old console setting, add new console with good 115200 setting; or just change speed).
(Where console=
option is parsed, where in /sys
or /proc
current settings are stored?)
console linux-kernel serial-port
did you ever figure this out? I would love to have an answer.
– jdizzle
Jan 30 at 6:45
@jdizzle, I had some ideas of searching for special files of console in/sys
fs (and for searching in linux kernel source), but I did not get this question to the full answer yet. We should check kernel.org/doc/Documentation/console/console.txt kernel.org/doc/Documentation/fb/fbcon.txt and kernel.org/doc/Documentation/networking/netconsole.txt. netconsole may be enabled in runtime - wiki.archlinux.org/index.php/Netconsole.
– osgx
Jan 30 at 14:37
add a comment |
There is Linux kernel boot option to enable system console, the console=
, for example, console=ttyS0,115200
or console=ttyS0,115200n8
http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/re01.html
After passing this option, linux kernel will print all (or some) kernel messages to the console, which is useful for debugging.
Is there a way of changing system console in Linux in runtime, without rebooting (with some special sysctls/ioctls/or in /proc
or /sys
filesystems)?
First case: I had no console=
option in current booting (checked in /proc/cmdline) and I want to enable dmesg printing to /dev/ttyS0 serial port to debug the situation.
Second case: I had wrong settings in my console=ttyS0,9600
and want to change speed without reboot (remove old console setting, add new console with good 115200 setting; or just change speed).
(Where console=
option is parsed, where in /sys
or /proc
current settings are stored?)
console linux-kernel serial-port
There is Linux kernel boot option to enable system console, the console=
, for example, console=ttyS0,115200
or console=ttyS0,115200n8
http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/re01.html
After passing this option, linux kernel will print all (or some) kernel messages to the console, which is useful for debugging.
Is there a way of changing system console in Linux in runtime, without rebooting (with some special sysctls/ioctls/or in /proc
or /sys
filesystems)?
First case: I had no console=
option in current booting (checked in /proc/cmdline) and I want to enable dmesg printing to /dev/ttyS0 serial port to debug the situation.
Second case: I had wrong settings in my console=ttyS0,9600
and want to change speed without reboot (remove old console setting, add new console with good 115200 setting; or just change speed).
(Where console=
option is parsed, where in /sys
or /proc
current settings are stored?)
console linux-kernel serial-port
console linux-kernel serial-port
asked Aug 24 '17 at 19:36
osgxosgx
3,36954160
3,36954160
did you ever figure this out? I would love to have an answer.
– jdizzle
Jan 30 at 6:45
@jdizzle, I had some ideas of searching for special files of console in/sys
fs (and for searching in linux kernel source), but I did not get this question to the full answer yet. We should check kernel.org/doc/Documentation/console/console.txt kernel.org/doc/Documentation/fb/fbcon.txt and kernel.org/doc/Documentation/networking/netconsole.txt. netconsole may be enabled in runtime - wiki.archlinux.org/index.php/Netconsole.
– osgx
Jan 30 at 14:37
add a comment |
did you ever figure this out? I would love to have an answer.
– jdizzle
Jan 30 at 6:45
@jdizzle, I had some ideas of searching for special files of console in/sys
fs (and for searching in linux kernel source), but I did not get this question to the full answer yet. We should check kernel.org/doc/Documentation/console/console.txt kernel.org/doc/Documentation/fb/fbcon.txt and kernel.org/doc/Documentation/networking/netconsole.txt. netconsole may be enabled in runtime - wiki.archlinux.org/index.php/Netconsole.
– osgx
Jan 30 at 14:37
did you ever figure this out? I would love to have an answer.
– jdizzle
Jan 30 at 6:45
did you ever figure this out? I would love to have an answer.
– jdizzle
Jan 30 at 6:45
@jdizzle, I had some ideas of searching for special files of console in
/sys
fs (and for searching in linux kernel source), but I did not get this question to the full answer yet. We should check kernel.org/doc/Documentation/console/console.txt kernel.org/doc/Documentation/fb/fbcon.txt and kernel.org/doc/Documentation/networking/netconsole.txt. netconsole may be enabled in runtime - wiki.archlinux.org/index.php/Netconsole.– osgx
Jan 30 at 14:37
@jdizzle, I had some ideas of searching for special files of console in
/sys
fs (and for searching in linux kernel source), but I did not get this question to the full answer yet. We should check kernel.org/doc/Documentation/console/console.txt kernel.org/doc/Documentation/fb/fbcon.txt and kernel.org/doc/Documentation/networking/netconsole.txt. netconsole may be enabled in runtime - wiki.archlinux.org/index.php/Netconsole.– osgx
Jan 30 at 14:37
add a comment |
1 Answer
1
active
oldest
votes
Not a full real hardware console added in runtime, but something better for some cases: meet a "netconsole". It is kernel console emulation over udp in Ethernet networks, one-way, only for collecting kernel logs. No more usb-uart adapters or null-modem cables or overpriced com-over-ethernet "console server" devices. And no more transmit (You may want to use classic kernel console to send magic SysRq, but not with netconsole).
Documentation: https://www.kernel.org/doc/Documentation/networking/netconsole.txt
Examples:
- https://wiki.archlinux.org/index.php/Netconsole
- https://wiki.ubuntu.com/Kernel/Netconsole
Netconsole should be enabled (or built as module) in the kernel configuration to work. (Sometimes it may be possible to build netconsole module for running kernel and modprobe it into linux without reboot).
To enable with linux command line (with reboot), add:
netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
Everything need to be specified: source udp port, source ipv4 address, network interface name like "eth0" (will it work with udev renaming the eth0 into something position-related?), target udp port and ipv4, and also target macaddress in format of six bytes 00:13:32:20:r9:a5.
Receiver is nc -u -l $tgt_port
.
Example of runtime configuration from the Arch wiki - https://wiki.archlinux.org/index.php/Netconsole
# set log level for kernel messages
dmesg -n 8
modprobe configfs
modprobe netconsole
mount none -t configfs /sys/kernel/config
# 'netconsole' dir is auto created if the module is loaded
mkdir /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/netconsole/target1
# set local IP address
echo 192.168.0.111 > local_ip
# set destination IP address
echo 192.168.0.17 > remote_ip
# set local network device name (find it trough ifconfig, examples: eth0, eno1, wlan0)
echo eno1 > dev_name
# find destination MAC address
arping -I $(cat dev_name) $(cat remote_ip) -f | grep -o ..:..:..:..:..:.. > remote_mac
echo 1 > enabled
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1244102%2fenable-serial-system-console-in-runtime%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Not a full real hardware console added in runtime, but something better for some cases: meet a "netconsole". It is kernel console emulation over udp in Ethernet networks, one-way, only for collecting kernel logs. No more usb-uart adapters or null-modem cables or overpriced com-over-ethernet "console server" devices. And no more transmit (You may want to use classic kernel console to send magic SysRq, but not with netconsole).
Documentation: https://www.kernel.org/doc/Documentation/networking/netconsole.txt
Examples:
- https://wiki.archlinux.org/index.php/Netconsole
- https://wiki.ubuntu.com/Kernel/Netconsole
Netconsole should be enabled (or built as module) in the kernel configuration to work. (Sometimes it may be possible to build netconsole module for running kernel and modprobe it into linux without reboot).
To enable with linux command line (with reboot), add:
netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
Everything need to be specified: source udp port, source ipv4 address, network interface name like "eth0" (will it work with udev renaming the eth0 into something position-related?), target udp port and ipv4, and also target macaddress in format of six bytes 00:13:32:20:r9:a5.
Receiver is nc -u -l $tgt_port
.
Example of runtime configuration from the Arch wiki - https://wiki.archlinux.org/index.php/Netconsole
# set log level for kernel messages
dmesg -n 8
modprobe configfs
modprobe netconsole
mount none -t configfs /sys/kernel/config
# 'netconsole' dir is auto created if the module is loaded
mkdir /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/netconsole/target1
# set local IP address
echo 192.168.0.111 > local_ip
# set destination IP address
echo 192.168.0.17 > remote_ip
# set local network device name (find it trough ifconfig, examples: eth0, eno1, wlan0)
echo eno1 > dev_name
# find destination MAC address
arping -I $(cat dev_name) $(cat remote_ip) -f | grep -o ..:..:..:..:..:.. > remote_mac
echo 1 > enabled
add a comment |
Not a full real hardware console added in runtime, but something better for some cases: meet a "netconsole". It is kernel console emulation over udp in Ethernet networks, one-way, only for collecting kernel logs. No more usb-uart adapters or null-modem cables or overpriced com-over-ethernet "console server" devices. And no more transmit (You may want to use classic kernel console to send magic SysRq, but not with netconsole).
Documentation: https://www.kernel.org/doc/Documentation/networking/netconsole.txt
Examples:
- https://wiki.archlinux.org/index.php/Netconsole
- https://wiki.ubuntu.com/Kernel/Netconsole
Netconsole should be enabled (or built as module) in the kernel configuration to work. (Sometimes it may be possible to build netconsole module for running kernel and modprobe it into linux without reboot).
To enable with linux command line (with reboot), add:
netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
Everything need to be specified: source udp port, source ipv4 address, network interface name like "eth0" (will it work with udev renaming the eth0 into something position-related?), target udp port and ipv4, and also target macaddress in format of six bytes 00:13:32:20:r9:a5.
Receiver is nc -u -l $tgt_port
.
Example of runtime configuration from the Arch wiki - https://wiki.archlinux.org/index.php/Netconsole
# set log level for kernel messages
dmesg -n 8
modprobe configfs
modprobe netconsole
mount none -t configfs /sys/kernel/config
# 'netconsole' dir is auto created if the module is loaded
mkdir /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/netconsole/target1
# set local IP address
echo 192.168.0.111 > local_ip
# set destination IP address
echo 192.168.0.17 > remote_ip
# set local network device name (find it trough ifconfig, examples: eth0, eno1, wlan0)
echo eno1 > dev_name
# find destination MAC address
arping -I $(cat dev_name) $(cat remote_ip) -f | grep -o ..:..:..:..:..:.. > remote_mac
echo 1 > enabled
add a comment |
Not a full real hardware console added in runtime, but something better for some cases: meet a "netconsole". It is kernel console emulation over udp in Ethernet networks, one-way, only for collecting kernel logs. No more usb-uart adapters or null-modem cables or overpriced com-over-ethernet "console server" devices. And no more transmit (You may want to use classic kernel console to send magic SysRq, but not with netconsole).
Documentation: https://www.kernel.org/doc/Documentation/networking/netconsole.txt
Examples:
- https://wiki.archlinux.org/index.php/Netconsole
- https://wiki.ubuntu.com/Kernel/Netconsole
Netconsole should be enabled (or built as module) in the kernel configuration to work. (Sometimes it may be possible to build netconsole module for running kernel and modprobe it into linux without reboot).
To enable with linux command line (with reboot), add:
netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
Everything need to be specified: source udp port, source ipv4 address, network interface name like "eth0" (will it work with udev renaming the eth0 into something position-related?), target udp port and ipv4, and also target macaddress in format of six bytes 00:13:32:20:r9:a5.
Receiver is nc -u -l $tgt_port
.
Example of runtime configuration from the Arch wiki - https://wiki.archlinux.org/index.php/Netconsole
# set log level for kernel messages
dmesg -n 8
modprobe configfs
modprobe netconsole
mount none -t configfs /sys/kernel/config
# 'netconsole' dir is auto created if the module is loaded
mkdir /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/netconsole/target1
# set local IP address
echo 192.168.0.111 > local_ip
# set destination IP address
echo 192.168.0.17 > remote_ip
# set local network device name (find it trough ifconfig, examples: eth0, eno1, wlan0)
echo eno1 > dev_name
# find destination MAC address
arping -I $(cat dev_name) $(cat remote_ip) -f | grep -o ..:..:..:..:..:.. > remote_mac
echo 1 > enabled
Not a full real hardware console added in runtime, but something better for some cases: meet a "netconsole". It is kernel console emulation over udp in Ethernet networks, one-way, only for collecting kernel logs. No more usb-uart adapters or null-modem cables or overpriced com-over-ethernet "console server" devices. And no more transmit (You may want to use classic kernel console to send magic SysRq, but not with netconsole).
Documentation: https://www.kernel.org/doc/Documentation/networking/netconsole.txt
Examples:
- https://wiki.archlinux.org/index.php/Netconsole
- https://wiki.ubuntu.com/Kernel/Netconsole
Netconsole should be enabled (or built as module) in the kernel configuration to work. (Sometimes it may be possible to build netconsole module for running kernel and modprobe it into linux without reboot).
To enable with linux command line (with reboot), add:
netconsole=[src-port]@[src-ip]/[<dev>],[tgt-port]@<tgt-ip>/[tgt-macaddr]
Everything need to be specified: source udp port, source ipv4 address, network interface name like "eth0" (will it work with udev renaming the eth0 into something position-related?), target udp port and ipv4, and also target macaddress in format of six bytes 00:13:32:20:r9:a5.
Receiver is nc -u -l $tgt_port
.
Example of runtime configuration from the Arch wiki - https://wiki.archlinux.org/index.php/Netconsole
# set log level for kernel messages
dmesg -n 8
modprobe configfs
modprobe netconsole
mount none -t configfs /sys/kernel/config
# 'netconsole' dir is auto created if the module is loaded
mkdir /sys/kernel/config/netconsole/target1
cd /sys/kernel/config/netconsole/target1
# set local IP address
echo 192.168.0.111 > local_ip
# set destination IP address
echo 192.168.0.17 > remote_ip
# set local network device name (find it trough ifconfig, examples: eth0, eno1, wlan0)
echo eno1 > dev_name
# find destination MAC address
arping -I $(cat dev_name) $(cat remote_ip) -f | grep -o ..:..:..:..:..:.. > remote_mac
echo 1 > enabled
edited Jan 30 at 14:59
answered Jan 30 at 14:51
osgxosgx
3,36954160
3,36954160
add a comment |
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1244102%2fenable-serial-system-console-in-runtime%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
did you ever figure this out? I would love to have an answer.
– jdizzle
Jan 30 at 6:45
@jdizzle, I had some ideas of searching for special files of console in
/sys
fs (and for searching in linux kernel source), but I did not get this question to the full answer yet. We should check kernel.org/doc/Documentation/console/console.txt kernel.org/doc/Documentation/fb/fbcon.txt and kernel.org/doc/Documentation/networking/netconsole.txt. netconsole may be enabled in runtime - wiki.archlinux.org/index.php/Netconsole.– osgx
Jan 30 at 14:37