date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,422,548,436,000
In the non-vim implementations of vi I've worked with, it's not possible to delete a line while in insert mode. vim does allows it—but it's my understanding that vim is not POSIX-compliant in its default configuration. Is a POSIX-compliant vi implementation not supposed to allow the deletion of lines in insert mode? P...
No, it is not required. It is up to the implementation to decide, as the behavior is unspecified. In implementations which allow it, the contents of the current line after the newline is erased must be erased as well. The POSIX specification for vi states the following (source): Input Mode Commands in vi In text inpu...
Plain vi (not vim): Can't delete a line in insert mode: Is this behavior required by POSIX?
1,422,548,436,000
For the sake of public record, I'm asking here at SE rather than on the standardization mailing list, so that it'd be more accessible to people. With practically every headers that specify functions (or function-like interfaces), there's the following: The following shall be declared as functions and may also be defi...
The following shall be declared as functions and may also be defined as macros. doesn’t imply that functions can no longer be referenced if they have also been defined as macros. Consider isalnum, which is commonly a macro: #include <ctype.h> #include <stdio.h> int main(int argc, char **argv) { printf("%p\n", isa...
How to interpret "functions ... may also be defined as macros"?
1,422,548,436,000
I see some IEEE standards from https://pubs.opengroup.org/onlinepubs/9699919799/: POSIX.1-2017 is simultaneously IEEE Std 1003.1™-2017 and The Open Group Technical Standard Base Specifications, Issue 7. So basically 3 formats of IEEE standard are involved here: POSIX.1-2017 IEEE Std 1003.1™-2017 The Open Group Tech...
This document set has been ratified by three organisations. Each organisation has its own naming scheme so there are three different standards names for the same text.
How to understand the naming convention of IEEE standards?
1,422,548,436,000
I'm able to get the output of a failing lp command from a remotehost to my local script like below: until ssh -q root@remotehost 'lp -d Brother_HL_L2350DW_series /root/moht/Printed/`basename "$FILE"`' 2>&1 | tee /home/printererror.log do echo "Issue is: `cat /home/printererror.log`" sleep 230 done The issue is the ...
The until is considering the exit status of tee. Looking at your code it's not at all obvious why you should need tee, though, so I'd suggest you just remove it until ssh -q root@remotehost 'lp …' >/home/printererror.log 2>&1 do : … done
Get the output of a remote ssh to local
1,422,548,436,000
While reading the standard, I noticed that bunch of APIs were, Introduced in Issue 5 for alignment with POSIX realtime APIs, Marked for option group membership in Issue 6, and Moved to Base in Issue 7 (SUSv4). Q: Does this mean that all systems conforming to "Unix(R) V7" product standard are realtime systems? Wha...
This is the asker's attempt at guessing. Just like POSIX Threads, the realtime APIs are found useful in regular applications, coupled with the fact that specifications for these APIs being implementable without major obstacle, operating systems supporting these interfaces become more common, so the standard move them ...
Single Unix Specification version 4 (Issue 7) moved bunch of Real-Time APIs to Base, What Next?
1,422,548,436,000
log=/tmp/log.txt the follwing syntax write all standard output and stand art error to log.txt file exec > $log 2>&1 what we want is to write both standard output and stand art error to log.txt but also standard output + standard error to console is it possible ?
There are probably less verbose ways to do this, but the classical solution would be something like: #!/bin/bash trap 'rm $TMP' 0 TMP=$(mktemp) rm $TMP mkfifo $TMP tee < $TMP ${log:-/tmp/log.txt} & exec > $TMP 2>&1 It should go without saying that there are massive security and reliability concerns here, as any othe...
linux + write both standard output and stand error to log and to console
1,422,548,436,000
ERROR: type should be string, got "\nhttps://unix.stackexchange.com/a/227625/386242 explains the myriad benefits of a simpler and more consistent filesystem hierarchy, but also that without any cross-OS standardization, such efforts are as much of a disadvantage as they are an advantage.\nConsequently, is the Linux Foundation drafting a Filesystem Hierarchy Standard 3.1 or 4.0?\n"
Given the lack of activity on the mailing list that would be used to discuss revisions to the standard, I think it’s safe to say the answer is no. Even if a group was working on a revised standard, the standard is supposed to reflect consensus, so I suspect you’d have a hard time getting it updated to follow GoboLinux...
Are any modifications to the FHS being worked on (by the Linux Foundation)?
1,433,515,096,000
When I view the length and width of my terminal emulator with stty size then it is 271 characters long and 71 lines tall. When I log into another server over SSH and execute stty size, then it is also 271 characters long and 71 lines tall. I can even log into some Cisco IOS device and terminal is still 271 characters ...
The telnet protocol, described in RFC 854, includes a way to send in-band commands, consisting of the IAC character, '\255', followed by several more bytes. These commands can do things like send an interrupt to the remote, but typically they're used to send options. A detailed look at an exchange that sends the termi...
How are terminal length and width forwarded over SSH and telnet?
1,433,515,096,000
Let's run cat and then type a then ^D - you will see that cat did not exit. Compare it with cat + a + Enter + ^D - now cat did exit. So, why two ^D presses are necessary to exit cat in the first case and only one ^D in second case?
The answer can be found in the termios(3) man page: VEOF (004, EOT, Ctrl-D) End-of-file character (EOF). More precisely: this character causes the pending tty buffer to be sent to the waiting user program without waiting for end-of-line. If it is the first character of the line,...
Why are two ^D presses necessary to exit `cat`? [duplicate]
1,433,515,096,000
In Ubuntu/gnome-terminal, if I run: $ stty -icrnl Then launch the GHC interactive environment (a Haskell console): $ ghci Then pressing Return does not submit the line; however, Enter does. However, with: $ stty icrnl Both Return and Enter submit the line. I don't really understand the behaviour; surely Return will...
The first step in understanding what's going on is to be aware that there are in fact two “newline” characters. There's carriage return (CR, Ctrl+M) and line feed (LF, Ctrl+J). On a teletype, CR moves the printer head to the beginning of the line while LF moves the paper down by one line. For user input, there's only ...
Understanding Return, Enter, and stty icrlf
1,433,515,096,000
Context Typeahead in bash: good When a bash shell is busy (initializing, running a command), one can type before the next prompt appears. If the shell has launched a program, that program will capture the keys, but if no program is run or if the program does not capture input, what one types gets inserted in the she...
Your Ctrl-r is being intercepted by the kernel-based terminal cookied line processing engine. While sleep is running, the terminal is in cooked mode, which means that the kernel-based tty line editor is working. The tty line editor supports rudimentary command line editing. The erase key (usually set to Ctrl-h (backsp...
How to have type-ahead apply to bash history search (Ctrl-R)?
1,433,515,096,000
If I open up a terminal (xfce4-terminal 0.6.3, but I doubt it matters) and I look at what terminal attributes are set (BASH is running in the terminal), $ stty -a speed 38400 baud; rows 24; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?; eol2 = M-^?; swtch = M-^?; start = ^Q; s...
Bash needs to put the terminal into character-at-a-time mode while it's waiting for you to type in a command line, so that you can edit the command line using emacs or vi-like editing characters. That's the mode you saw when you looked at the terminal's attributes from another terminal in your example. Just before it...
Why do the terminal attributes look different from outside the terminal?
1,433,515,096,000
I have a small LED matrix controlled by a display driver that accepts serial commands to update the display. I'm successfully controlling it via node with the node serial package, however I'd like to be able to update it with echo so that I can control it earlier in the boot up process with a shell script. To start te...
I was able to configure the serial port so echo behaved like screen. Here are my settings: stty -F /dev/ttyUSB0 115200 raw -echo -echoe -echok -echoctl -echoke And to echo: echo -e -n 'command_here\r' > /dev/ttyUSB0
Sending serial commands with echo vs screen session
1,433,515,096,000
I issued a stty -ixon command which enables XON/XOFF flow control. There is a stty -ixoff command but that enables the "sending of start/stop characters". So once XON/XOFF flow control is enabled, how do you disable it? Similarly, how do you disable "sending of start/stop characters?"
stty -ixon disables XON/XOFF output control; stty ixon enables it. In general, stty -flag disables the corresponding termios flag, stty flag enables it.
How do you disable XON/OFF flow control?
1,433,515,096,000
I'd like to save then restore the current stty settings in a script that is also consuming stdin however stty -g is complaining about it: stty: 'standard input': Inappropriate ioctl for device I've tried closing the stdin file descriptor and calling stty in a subshell with overridden FDs. I can't figure out how to s...
@icarus' comment: Maybe saved_tty_settings=$(stty -g < /dev/tty)? is actually pointing to the right direction, but it is not the end of story. You will need to apply the same redirection when restoring stty states too. Or else, you will still get Invalid argument or ioctl failure at the restoring stage... Correct co...
Can current `stty -g` settings be saved when also consuming stdin?
1,433,515,096,000
I was recently running tail -f on a log file of a server that was running, trying to diagnose a bug, when I accidentally bumped the keyboard and typed some characters. They got mixed in with the output of the log, with no way to tell which was which. I have had similarly annoying things happen to me countless times, a...
People usually want to see what they're typing (unless it's a password) :-) The terminal accepts input at any time, and buffers it until an application reads it. More than that, when the tty is in cooked mode, the kernel buffers whole lines at a time and provides some rudimentary line editing functionality that allow ...
Why does the terminal echo keystrokes when commands are running?
1,433,515,096,000
Prerequisites The Linux virtual terminal (tty) is an emulation of VT102 - Virtual terminal subsystem source. The real VT100 (nearly the same as VT102) has the following behavior (I suppose): In the LINE mode all typed characters are first transmitted to the computer and then, returned to the terminal. Nothing is disp...
Firstly, this question was asked on Retrocomputing, but the community found it more suitable for this site. But I got an answer in the comment section, so copy it here: The Linux virtual console emulates a (sort of) VT102 terminal in ON-LINE mode connected to a Linux (serial) tty device. The Linux tty driver does...
Echoed escape sequences doesn't interpreted in Linux tty
1,433,515,096,000
I wish to directly monitor the serial-over-usb connection to my 3d printer, which runs at 250000 baud. e.g I might monitor it with cat /dev/ttyUSB0 However first I need to set the baud rate, e.g stty -F /dev/ttyUSB0 115200 But if I try and set the baud rate to 250k, it fails: stty -F /dev/ttyUSB0 250000 gives result:...
There are some undocumented ioctls you can use to set non-standard speeds, provided the driver implements them. A simple way to call them is with a small piece of python. Eg put in file mysetbaud.py and chmod +x it: #!/usr/bin/python # set nonstandard baudrate. http://unix.stackexchange.com/a/327366/119298 import sys,...
How to monitor a serial connection @ 250000 baud?
1,433,515,096,000
I just set up a new computer, and as usual had to alter the settings in xterm in order to make the delete keys work properly. (Ctrl-H sends ^H, backspace sends ^?, delete sends ^[[3~. This is, of course, the objectively correct way to do it.) While the default xterm settings are problematic, in this setup everything w...
There are a lot of ways to do it. The way you mention could be one. xterm is a program that runs another one - it wraps another program in a pty - usually your shell - and channels the input you feed it to the wrapped programs. The thing about pseudo-terminals is they are just emulated devices - and so xterm takes a g...
stty settings are pathologically altered
1,433,515,096,000
You can type characters literally by using the "lnext" functionality (often ^V per default) in your tty driver However, I bind Ctrl+v to "paste" in my terminal emulator. (Since I don't use control flow) I'd like to rebind lnext to Ctrl+q. I tried the following in ~/.zshrc setopt noflowcontrol # Don't use ^s and ^q ...
stty lnext only affects the terminal device line discipline internal editor (the very limited one you get when running applications like cat that don't have their own line editor). For zsh's editor, you'd need to use bindkey (zle does not do like readline (bash's line editor) that queries the tty LD setting to do the ...
How can I rebind stty lnext to ^q?
1,433,515,096,000
In the stty documentation, the following is mentioned: [-]icrnl translate carriage return to newline [-]inlcr translate newline to carriage return * [-]ocrnl translate carriage return to newline * [-]onlcr translate newline to carriage return-newline Notice how the "cr" in icrnl and inlcr ...
It is not a typo, it is in fact what POSIX also says: onlcr (-onlcr) Map (do not map) NL to CR-NL on output. This shall have the effect of setting (not setting) ONLCR in the termios c_oflag field, as defined in XBD General Terminal Interface. The fact that the mode isn't called "onlcrnl" is probably just to keep th...
Confused about the "onlcr" stty flag
1,433,515,096,000
Sometimes I just need to read from a serial device, so I skip the complexities of minicom or screen and just cat. However, this only works if I first set the baud rate of the terminal using stty <baud> before attempting to open the file. This data is likely already (or can be) buffered in the kernel and, in this case...
It looks like you might be a bit confused about how this all works. First, /dev/ttyACM0 does not represent the USB link, or even the USB endpoint for whatever serial adapter you have connected, it represents the UART inside the adapter that handles the serial communications. Data you read from it will not include ...
What are the implications of setting the baud rate of a terminal from userspace?
1,433,515,096,000
I like my background processes to freely write to the tty. stty -tostop is already the default in my zsh (I don't know why, perhaps because of OhMyzsh?): ❯ stty -a |rg tostop isig icanon iexten echo echoe echok -echon...
A process can be sent that SIGTTOU signal (which causes that message), when it makes a TCSETSW or TCSETS ioctl() for instance (like when using the tcsetattr() libc function) to set the tty line discipline settings while not in the foreground process group of a terminal (like when invoked in background from an interac...
zsh: Why do I get suspended background processes even when I have `stty -tostop`?
1,433,515,096,000
I am having trouble understanding the purpose of trap and the multiple stty invocations in the snippet below. I was hoping someone could give me a rundown of what is happening. getkey() { local stty="$(stty -g)" trap "stty $stty; trap SIGINT; return 128" SIGINT stty cbreak -echo local key while true; do ...
local stty="$(stty -g)" Save the current terminal settings. stty $stty, which is executed both when the function returns normally and on SIGINT, restores these settings. trap "stty $stty; trap SIGINT; return 128" SIGINT If the function is interrupted by SIGINT (the signal sent by pressing Ctrl+C), restore the te...
Reading keypresses in shell using trap and Unix signals
1,433,515,096,000
A particularly large (~10^6 LOC) program causes my stty settings to change from echo ixon icanon to -echo -ixon -icanon and I would like to find the function in this massive program that causes this change. I obviously would not like to trace execution through this mess of OOP spaghetti code. How can I monitor stty se...
If you think that you can cause the event by a specific action or interaction, by far the simplest method is something like: watch -d -n1 "stty -F /dev/pts/106 -a | grep -Eo '.(icanon|ixon)'" Run this on a new terminal, the option to -F is the terminal you will run the program on (run tty to see what it is before st...
Monitor and alert user when stty settings change?
1,433,515,096,000
I can disable XON/XOFF flow control: stty -ixon So I put this in my "~/.profile". However I have started making my own terminal with "terminfo" and "tic", and I noticed these options: xon_xoff xon xo terminal uses xon/xoff handshaking exit_xon_mode rmxon RX turn off xon/xoff handshakin...
short: no long: terminfo describes the features of a terminal. Those particular capabilities likely were added to AT&T's list of possible terminal capabilities in the late 1980s to describe some long-forgotten terminal that didn't use ^S and ^Q. curses in general (ncurses specifically) doesn't pay any attention to th...
terminfo disable XON/XOFF
1,433,515,096,000
I have vim setup with NerdTree on a remote machine. I have two local machines. When I ssh to remote machine from one of the local machines (say A), it displays all the symbols in NerdTree correctly. However, when I ssh from the other local machine (say B) to remote machine, those symbols show up as some garbled charac...
I figured this out. This looks like font problem. As soon as I installed the fonts from machine A to machine B, it started working fine. To install fonts, I copied everything from /usr/share/fonts from machine A to machine B and then ran fc-cache /usr/share/fonts as described here
Terminal shows garbled characters with same settings as other terminal showing correct characters
1,433,515,096,000
Open two consoles / X terminals. From one, which is attached to say /dev/tty1 (Linux console) or /dev/pts/0 (X terminal), run $ stty -echo. (Now echoing to keyboad is turned off.) Then from the other, run $ stty --file=/dev/tty1 echo. Now type something in the first terminal. It echoes, ok, the last stty took effect....
Your shell does this, to help you edit command-lines. bash's readline library saves/restores terminal modes. You can see this in the rl_prep_terminal and rl_deprep_terminal functions, called indirectly from edit_and_execute_command.
The effect of `stty --file=<terminal> <flag>` is only temporary for consoles in bash. Why?
1,433,515,096,000
As I understand it, when typing characters in a terminal emulator they appear because they are "echoed". We imagine that the terminal is a separate device communicating with the computer via a two-way channel, and each key typed doesn't update the screen immediately, but appears when it is sent back from the computer....
The terminal emulator sends the x character, and the terminal driver sees that this has been configured as the erase character. So instead of echoing it back to the emulator, it sends the appropriate sequence to erase the previous character (e.g. backspace-space-backspace). Even when the erase character is set to Back...
How is the display updated when the erase character is typed in a terminal emulator?
1,433,515,096,000
Yesterday I was fed up with being forced to type Caps+Backspace to erase character in Putty, because a Backspace was printing a ~. I found some info on internet saying you should type stty erase ~, or at least that how I understand it. Since then when I type on / it send a ← to the terminal and I'm not even capable to...
An unquoted ~ expands to /path/to/your/home/dir in most shells. The stty man page doesn't say what it does when the argument to erase is something other than a single character or undef or ^ followed by a character, but it looks like your stty uses the first character of the argument string. Type stty erase '~' (with ...
Since I execute 'stty erase ~' I can't type / anymore in Putty
1,433,515,096,000
The puzzle I am trying to solve for is where larger outputs of text eventually fall apart into scrambled text. For context I am working on an older machine (EPSON PX-8) connected to Pi3 over RS232 using terminal emulation software on the PX-8 called TEL TEL Settings - Baud: 9600, Char Bits: 8, Parity: NONE, Stop Bits:...
I presume you have something like a serial-to-usb adapter on the pi, and have setup a getty so you can login to this tty from your PX-8. Once logged in, an stty ixon from the shell will enable xon/xoff flow control for output from the pi. If you now ssh from the shell to login to some remote, the flow control is inade...
Does XON/XOFF flow control transmit through multiple terminal session hops?
1,433,515,096,000
How I can use the ctrl+e keyboard combination in emacs mode to go to the end of the line, but also be able to use the End key to do the same? How do I set that with stty? I have tried this combination copied from linux terminal: stty eol M-^? but when I press End I get F on keyboard. The system is old ATT System V on...
That eol setting is not for the key that would take you to the end of some line-editing buffer, that's a setting of the tty line discipline. It is for its very basic line editor, the one used when entering input for applications (like cat, sed) that don't have their own line editor. That editor doesn't have cursor pos...
stty on old AT&T unix: how to add End-key for "end of line"?
1,433,515,096,000
I am trying to write a bash script that is able to interpreter data coming from a serial device. I configure the port in raw and then I am able to do a simple cat of /dev/ttyUSB0 and see the data. My issue is how to get the single line of data that the device sends in a bash variable so I can freely manipulate it. I ...
Untested! #!/bin/bash ETX=$'\003' STX=$'\002' # Open /dev/ttyUSB0 open on FD9 exec 9< /dev/ttyUSB0 # do any stty stuff needed on fd9 # e.g. # stty 9600 < /proc/self/fd/9 > /proc/self/fd/9 # now loop, reading from the device, while IFS= read -rd "$ERX" -u 9 wibble do wibble=${wibble#"$STX"} printf 'G...
Interpreting serial data via bash
1,433,515,096,000
Hardware PHYTEC Mira Board with i.MX6 Processor Operating System Yocto Image created using the BSP provided by PHYTECSource with minimal packages in it. The board has an UART board called UART3 and its software interface within the OS is /dev/ttymxc2 Hardware Manual. The only thing available to check/set serial port o...
You could try using UART1 or UART2 on the Mira board. According to the manual they use TTL level signals. The GPS module outputs 3 V, but tolerates 5 V on input. The +3 V should be enough to be interpreted as a "1" on a TTL input. The RS-232 signals are not suitable without a buffer, because RS-232 specifies +3..+12 V...
troubleshooting serial settings through stty
1,433,515,096,000
This is related to a previous thread I created about a month ago and which was answered. Today I am attempting to setup a serial console login prompt on a laptop running Ubunutu 20 with a Belkin F5U409 USB serial adapter. I have run into the same issue where larger text output will eventually fall apart into scrambled...
The Belkin F5U109 seems to be a device of fairly old design, so perhaps the F5U409 with the same usb vendor:device id is similar. In this case the Linux driver chosen because of the id is the mct_u232.c. We can read in the .h file for Flow control: no flow control specific requests have been realized apart from DTR/R...
Serial flow control issue with ttyUSB0
1,433,515,096,000
I ran stty --all on a terminal which had been reconfigured by a badly behaved process which exited before putting my terminal back to its original settings. Part of the output reads: eol = M-^?;. What is this encoding? What does that sequence of characters mean? The man page has this elucidating remark, presumably for...
The M- means the high bit is set, so add "0x80" to the character encoding. The ^? means the "DEL" character so 0x7F. Add the two together and we get 0xFF. We can test this: $ stty -a | grep -w eol | sed 's/.*; //' eol = <undef>; $ stty eol 0xff $ stty -a | grep -w eol | sed 's/.*; //' eol = M-^?; A full list of co...
How are characters encoded in stty's output?
1,433,515,096,000
ECHO setting is enabled on stdin and stdout by default. But why if we disable ECHO on stdin, it is also disabled on stdout? They have two separate descriptors - 0 and 1, so why they are changed simultaneously as if they had one and the same file descriptor? The following program demonstrates this: #include <termios.h>...
You are changing attributes of the device, not the file descriptor. The file descriptor is just a way of identifying which device you're talking about. If both stdin and stdout are the same tty (/dev/pts/0 for example) then it doesn't matter which one you use for tcgetattr and tcsetattr. Since echoing by definition in...
Why changing tty settings on one file descriptor affects another?
1,433,515,096,000
When running Screen, I can use Ctrl+ac to create a new window and run vim in each window. Also from Screen, I can run the command screen vim multiple times to open new windows with vim already running. These work as expected. However... If I put the command multiple times in a script, such as: #!/bin/bash screen vim s...
I believe I found that the problem is caused by the script running all commands (except the first) in the background. I can force the first command to have the same problem by forking it with &. After not being able to find a way to have the script run each command in the foreground, one-after-the-other, I have found ...
Starting multiple Screen windows from shell script uses wrong configuration
1,433,515,096,000
In my decades of experience of *n?x based OSes, I have never seen this before: It happens during SSH commands. Regardless of terminal or terminal emulator, pressing the number 2 within SSH sends a ^W (ie: stty werase). Troublesome since I need to do ^V prior to the pressing 2. Note: this occurs within a password pr...
facepalm I seem to have a mistake in a startup file: stty werase 2> /dev/null
ssh: 2 acts like ^w regardless of terminal
1,433,515,096,000
FYI I am running busybox. I am able to send data to my ttyS1 using the following command: stty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo echo -en 'data here' > /dev/ttyS1 But when I try to read, I do this: stty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo cat /dev/ttyS1 But program ends without a...
So found answer in another forum. I will put it here, basically just add timeout timing and a while loop to constantly read the port. stty -F /dev/ttyS1 speed 115200 cs8 -cstopb -parenb -echo time 3 min 0 while [ true ]; do cat /dev/ttyS1 done That's all.
Reading data from serial port
1,561,068,298,000
I have a bash script that columnizes a list of items. By default it will guess at the number of columns to output, based on the terminal width as reported by stty size. But when the script is in a pipeline, stty reports "Inappropriate ioctl for device". What I want is to allow my script, when being executed as a comma...
You can try things out with a script such as #!/bin/sh for fd in 0 1 2; do if [ -t $fd ]; then echo $fd is a TTY; fi done Running this I see that: if the script is run on its own, all three FDs are TTYs if the script is run at the start of a pipeline, stdin and stderr are TTYs if the script is run in the middle...
Can a command in a shell pipeline determine the tty characteristics of its context?
1,561,068,298,000
I've successfully disabled Ctrl+S in terminal using instructions here. However, if I launch a terminal programs (namely terminal vim) from "outside the terminal", Ctrl+S still freezes the screen. What I mean by "outside the terminal": Using a keyboard shortcut to run something like kitty -e vim to open vim in termina...
Add this to your ~/.vimrc: silent !stty -ixon If that creates problems with a non-tty vim like gvim (no idea, not able to test it), try this: silent !test -t 0 && stty -ixon It looks like they decided to make -ixon the default in recent versions of vim, so this is soon going to stop being an issue with vim (notice ...
How to disable Ctrl+S in terminal applications started from file manager or via shortcut?
1,561,068,298,000
Recently, more and more GUI applications (okular and inkscape, among others) started disabling terminal echo while they are active. This seems unnecessary at best (if you don't background the process, you wouldn't type in it anyway and if you did, who cares? And if you background it, it has no effect anyway). But what...
echo is a setting of the terminal device (the discipline part in the tty kernel driver), termcap is about controlling the terminal (real or emulator) via escape sequences, it's two separate things. Here you want to prevent the application to do a specific ioctl. One way could be by detaching it from the terminal. soca...
Prevent application to tamper with terminal settings?
1,561,068,298,000
While running some program (Configure), my terminal will be messed up. My typing is not shown. I can use "stty sane" to fix it but I notice that whenever I click my mouse on the terminal (I use PuTTY), strange characters appear. e.g. # O:#O: O:#O: 7-#7- BE#BE ... They seem to be 5 character sequences and if I click o...
Those are xterm-style "mouse" events. You could in principle turn off those using a suitable printf or echo, but reset does it already as part of the rs1 or rs2 string in the terminal description (see output of "infocmp"). reset uses this for instance: rs1=\Ec, ...
strange 5-characters-sequence appear in PuTTY terminal with mouse click
1,561,068,298,000
Open xterm, run tty and see pseudo terminal slave file (let's say it is /dev/pts/0). Then open another xterm and run $ stty -F /dev/pts/0 speed 38400 baud; line = 0; lnext = <undef>; discard = <undef>; min = 1; time = 0; -brkint -icrnl -imaxbel iutf8 -icanon -echo Then run /bin/sleep 1000 in first xterm. Then run the...
That's the readline(3) line-editing library, which is usually statically built as part of bash, but is also used by other programs. Every time it starts reading a command from the user, readline saves the terminal settings, and puts the terminal into "raw" mode [1], so it could be able to handle moving the insertion p...
How bash sets tty attributes before and after running a command?
1,561,068,298,000
I have Ubuntu 16.04.04 LTS server. I was doing some work in tty1 and then took a lunch break. In the meantime, my desktop monitor went asleep. When I came back, I pressed Esc and my screen awoke and I was at the tty1 prompt, exactly where I left off. However, when I began typing, I noticed that the characters I en...
The character-based console (tty1, tty2 etc.) is a terminal emulator: it mimics the operation of a serial-port connected terminal, with some Linux-specific extensions. This emulation includes support for XON/XOFF handshaking... and the characters used for this type of handshaking can be easily produced on a keyboard, ...
key press not displaying in tty1
1,561,068,298,000
I have an app that expects to do I/O over a full-duplex serial line. That is: char buf[4]; write(fd, "ping", 4); read(fd, buf, 4); ... expects to end up with whatever four bytes the remote device transmitted in response to the "ping" string. But I'm running on a half-duplex RS485 line, so every byte that gets transm...
Pragmatically, if what you have seems to work, and you are not expecting any change in the setup, or it is a one-off hack, then stay with your solution. However, Linux has an API for rs485 for appropriate hardware, that you can try. Some hardware has a built-in half-duplex mode that will work if you put the serial por...
How to inhibit serial reception during serial writes for a RS485 (half-duplex) serial line
1,561,068,298,000
I'd like to swap Ctrl & Super so that I can use the physical super/meta key for copy/paste/select-all/find/etc. without application-specific configuration, which often doesn't exist. However, I'd like to keep SIGINT, EOF, suspend, and the like on the physical control key. I've tried setting URxvt.keysym.M-c: ^C, and I...
The conversion of certain keystrokes into a signal is performed at a very low level: it's done by the generic terminal driver in the kernel, when it relays between the terminal emulator process or physical terminal hardware and the program running in the terminal. This driver only understands characters (and by charac...
Key other than Control to send SIG*?
1,561,068,298,000
I want to bind C^w to a non-default action in bash, but it requires disabling werase in the terminal. This, unfortunately, affects other programs launched by bash, especially my ssh sessions: when I type C^w there it echoes ^W. Is there a way to enable some non-default terminal setting only in interactive mode in bash...
There is a readline option to stop it taking up the current stty settings. Add to your ~/.inputrc set bind-tty-special-chars Off then you will be able to bind Control-w as you wish. Interactively, you can try: $ bind 'set bind-tty-special-chars Off' $ bind -ps | grep C-w "\C-w": unix-word-rubout $ bind -x '"\C-w": d...
disable terminal werase setting only in interactive mode in bash
1,561,068,298,000
I would like to disable TTY echoing for all users that are connecting via SSH. The Linux command stty -echo does the trick, however instead of users having to execute this command on their TTY I would like to give them a TTY that by default has echoing disabled from the start. how can I achieve this? thanks in advance...
One simple way is to add the line stty -echo to a file in /etc/profile.d where the filename ends in .sh. For example, a file named /etc/profile.d/disable-tty-echo.sh. This works because, at least on Ubuntu, each /etc/profile.d/*.sh file will be sourced by /etc/profile, and the latter file will be read and executed (al...
force stty -echo for all ssh users
1,561,068,298,000
I have a connection from my debian computer to a device with debian linux on it. If I type the reset command on the serial commandline the clocal will be set to -clocal. I search the internet why, but I couldn't find out why. The problem is that some commands, like sudo -i hang if -clocal is set but working if clocal ...
Because that's what reset does. Its manual tells you that it "sets the terminal modes to 'sane' values". Sanity in this case involves turning off CLOCAL.
reset command over serial connection setting clocal to -clocal
1,561,068,298,000
I customized the root file system using Busybox, and its version is 1.36.1. I don't know why my device cannot be terminated by ctrl+c when typing ping an IP on the monitor keyboard. However, when I connect to the device through SSH, the ping an IP can be terminated by ctrl+c? The same goes for ctrl+u. I referred to si...
On the "monitor keyboard" stty -a output, there is -isig -icanon -iexten, while the SSH session has these features enabled (no - sign in the front). And the man stty describes these as follows: [-]icanon enable special characters: erase, kill, werase, rprnt [-]iexten enable non-POSIX special characters [-]isig enable...
Customized Linux systems cannot use crtl+c to terminate ping commands?
1,561,068,298,000
TLDR - I have onlcr configured in my terminal, but I don't see the \r getting added If plug two FTDI serial converters together, and plug them both into my computer, I get two ports called /dev/ttyUSB0 and /dev/ttyUSB1 If I open them both with picocom in different terminals, I can make sure they are connected, proper...
Your stty shows -opost which switches off all output processing, so the onlcr has no effect.
why doesn't the stty setting onlcr add a carriage return?
1,561,068,298,000
From an answer to one my previous question I learned that shells (such as bash) have an ability not to follow the rules of terminal input processing set by stty(1). In particular, they can operate in raw mode while there is a setting enabled that turns on canonical mode (stty icanon) (with line discipline editing rule...
Any process can use tcsetattr to change the terminal driver characteristics (see man -s 3 termios for the complete 608-line story). The terminal itself only preserves the last state it saw -- it keeps no other history. The polite usage is to nest any changes: any process that changes them should first read and save th...
Why can bash not to follow stty settings?
1,561,068,298,000
Among the stty -a settings on my machine there are such as erase = ^?; kill = ^U;. The man page reports that erase CHAR CHAR will erase the last character typed kill CHAR CHAR will erase the current line But I found out the corresponding keyboard shortcuts effectively do the same thing, i.e...
I just tested this at my shell prompt and got similar results. However, closer examination shows an error. ctrl+/ (which you might think is ctrl-?) actually produces ctrl-_ which is typically bound to "undo". If you want ctrl-? you need to press ctrl+shift+?. You can test this by typing ctrl+v ctrl+/ Note that the...
Why erase and kill characters do the same thing?
1,561,068,298,000
stty -echo; cat -v; stty echo is a technique to see what key you send to terminal. But I just wonder how this command work? When I remove stty -echo it will print twice what you typed in. I know stty -echo is disabling terminal printing you type. More specifically, my quest is "why can I use ';' connect commands to ac...
; just separates commands so they are run one after the other. Here, if you enter that at the prompt of an interactive shell, the terminal device local echo will have been disabled and reenabled by the time you you get back to the prompt as long as you exit cat normally (with Ctrl+D twice, or on an empty line). If cat...
How does `stty -echo; cat -v; stty echo` work to echo special keys?
1,561,068,298,000
I have a sama5d36 device running Debian jessie (kernel 4.1.10) with a DMA USART. To get the DMA USART to output correctly I had to turn off ECHO and ONLCR. stty -F /dev/ttyS2 -echo -onlcr speed 115200 If I do a test where I send a bunch of bytes, I will receive 2048 bytes and then it stops receiving until I restart....
Upgrade your kernel to a newer kernel. There were issues with this driver in the earlier kernels.
serial DMA pausing after 2048 bytes
1,561,068,298,000
bind -x '"\C-j": backward-kill-word' says, backward-kill-word: command not found As mikeserv quoted here, i am able to do backward-kill-word using Ctrl-w. However this is the same key i use in emacs for select/cut text, causing confusion. I am trying to bind backward-kill-word to a different key sequence, C-j and go...
bind -x expects a shell command. Just do bind '"\C-j": backward-kill-word'
Bind C-j to backward-kill-word, says command not found
1,432,735,924,000
As I understand, Linux kernel logs to /proc/kmsg file(mostly hardware-related messages) and /dev/log socket? Anywhere else? Are other applications also able to send messages to /proc/kmsg or /dev/log? Last but not least, am I correct that it is the syslog daemon(rsyslog, syslog-ng) which checks messages from those two...
Simplified, it goes more or less like this: The kernel logs messages (using the printk() function) to a ring buffer in kernel space. These messages are made available to user-space applications in two ways: via the /proc/kmsg file (provided that /proc is mounted), and via the sys_syslog syscall. There are two main ap...
Understand logging in Linux
1,432,735,924,000
we would like to understand copytruncate before rotating the file using logrotate with below configuration: /app/syslog-ng/custom/output/all_devices.log { size 200M copytruncate dateext dateformat -%Y%m%d-%s rotate 365 sharedscripts compress postrotate /app/syslog-ng/sbin/syslog-ng-ctl reload endscript ...
Truncating a logfile actually works because the writers open the files for writing using O_APPEND. From the open(2) man page: O_APPEND: The file is opened in append mode. Before each write(2), the file offset is positioned at the end of the file, as if with lseek(2). The modification of the file offset and the wr...
How copytruncate actually works?
1,432,735,924,000
I have a freshly installed version on CentOS 7 once which I have installed syslog-ng from the EPEL repositories. ~: yum list | grep syslog syslog-ng.x86_64 3.5.6-1.el7 @epel When I try to start it via systemctl, it fails as follows : /usr/lib/systemd/system: systemctl start s...
We had the same problem on Debian 8.1, but fixed it by changing our syslog-ng local configuration to use unix-dgram instead of unix-socket. I was clued in by this comment at RedHat Bugzilla: Note about custom syslog-ng configurations files People with custom syslog-ng configurations will most likely face upgrade p...
syslog-ng service not starting with systemd but command works fine
1,432,735,924,000
I installed syslog-ng to use on my desktop (Gentoo 64bit, upgraded to systemd i.e. was OpenRC before, with Openbox and Slim only) with my normal user to log all commands I type in the shell (bash first, then eventually zsh). I've explored different solutions, and different ways of setting this up, old and new and ofte...
You have a lot going on there..... My best answer to this is to explain simply how I have seen session logging done in the past. Hopefully that will give you some options to explore. As you have already mentioned, pulling the bash history from the user accounts. This only works after the session has ended. Not reall...
Log every command typed in any shell: output (from logger function to syslog-ng/journald) contains duplicate entries for commands?
1,432,735,924,000
I need to exclude a given line in the messages file: Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=ifeth4 OUT= MAC=ff:ff:ff:ff:ff:ff:AA:AA:AA:AA:AA:AA:AA:AA SRC=192.168.202.4 DST=192.168.202.255 LEN=238 TOS=0x00 PREC=0x00 TTL=64 ID=0 DF PROTO=UDP SPT=32776 DPT=705 LEN=218 Oct 25 04:09:23 SERVERNAME PFILTER-DROP: IN=if...
BEFORE: SERVER:/etc/syslog-ng # tail -3 syslog-ng.conf # # log { source(src); destination(/var/log/messages); }; SERVER:/etc/syslog-ng # EDIT THE syslog-ng.conf FILE: vi /etc/syslog-ng/syslog-ng.conf AFTER: SERVER:/etc/syslog-ng # tail -3 syslog-ng.conf #log { source(src); destination(/var/log/messages); }; filter...
How to exclude given lines in syslog-ng?
1,432,735,924,000
Is there a common way of distinguishing between the messages of multiple processes in syslog-ng beside setting different facilities? +1 if filtering and therefore logging in different files would be possible. I have a system setup with two running sshd instances. One is running in a chrooted environment. Since syslog ...
Change the name of the executable (note that that also affects PAM configuration). ln /path/to/sshd /path/to/sshd-whatever Start as /path/to/sshd-whatever. And define PAM configuration in /etc/pam.d/sshd-whatever. Log entries will show as sshd-whatever instead of sshd.
Separate messages of multiple sshds in syslog-ng
1,432,735,924,000
Just rebooted my system to this warning :: Starting Syslog-NG [BUSY] WARNING: Configuration file format is too old, please update it to use the 3.2 format as some constructs might operate inefficiently; WARNING: the expected message format is being ...
Its probably related to this change in 3.2: syslog-ng traditionally expected an optional hostname field even when a syslog message is received on a local transport (e.g. /dev/log). However no UNIX version is known to include this field. This caused problems when the application creating the log message has ...
Converting syslog-ng 3.0? format to 3.2 format
1,432,735,924,000
I'm moving from a syslog-ng central log host to rsyslog. I can't even seem to find syslog-ng in the CentOS repos these days. I want to filter logs by hostname and facility. Here is how I do it in syslog-ng destination std { file("/var/log/HOSTS/$HOST/$YEAR/$MONTH/$DAY/$FACILITY_$HOST_$YEAR_$MONTH_$DAY" ...
This is done via templates, like this: $template HostDynFile,"/var/log/HOSTS/%HOSTNAME%/%$YEAR%/%$MONTH%/%$DAY%/%syslogfacility-text%_%HOSTNAME%_%$YEAR%_%$MONTH%_%$DAY%" This template can then be used when defining an output selector line, e.g.: *.* -?HostDynFile More info is available here: Building A Central Logho...
Rsyslog Central Log Host
1,432,735,924,000
Is it possible to set up a failover mechanism with Syslog-NG opensource edition? I want that the syslog-ng Daemon logs to a remote Loghost and switches to an other server if the first would go down for some reason...
Syslog-ng itself does not do this. However, here are a few ways to achieve high-availability logging, sorted in increasing levels of complexity/cost: Simply adding both servers and always write to both is the easiest one. Have a backup syslog config around with the second servername. Have a cronjob or something to ch...
Failover with Syslog-ng?
1,432,735,924,000
According to the documentation I can execute a program somewhat like so: destination knotifier { program('/path/to/executable'; }; And it will send the log to the stdin of the executable. But what if the program I'm executing would need the input as an argument to an option? Is there a way to do that? Or do I have to...
For most commands a wrapper will have to be written because Syslog-ng will only execute the command when it starts. This means that the command has to effectively be a daemon itself always accepting input from stdin. That's simple though... #!/bin/dash while read line do /execute/my/app $line done unfortunately ...
Can I send the ouput of a log to a command as an argument to an option in syslog-ng?
1,432,735,924,000
I have installed syslog-ng 3.5 on RasperryPi Debian Jessie. When I try to start the service, it fails -- Unit syslog.socket has begun starting up. Feb 10 12:29:28 blackbox systemd[1]: Socket service syslog.service not loaded, r Feb 10 12:29:28 blackbox systemd[1]: Failed to listen on Syslog Socket. -- Subject: Unit sy...
The Syslog-ng daemon was not booting properly here. Albeit it was configured for being a remote syslog server, port 514/UDP was also not showing in netstat. Debugging the problem with the command: /usr/sbin/syslog-ng -d We saw the error: Error opening file for writing; filename='\xe2\x80\x9c/var/log/cisco/cisco.log\x...
Syslog service fails to start
1,432,735,924,000
syslog-ng has the option to include a config snippet: @include "`scl-root`/system/tty10.conf" and many examples on-line include that file; but I can't understand what it's for? The entire included file consists of: @define tty10 "/dev/tty10"
By default, at least in the Debian version of syslog-ng, console output goes to tty10, which is supposed to be the tenth virtual console. The reason tty10 is configured in a separate configuration file is that its value depends on the system; on Linux-based systems, it’s /dev/tty10, on kFreeBSD-based systems, it’s /de...
What is `tty10` used for in syslog-ng
1,432,735,924,000
I have installed syslog-ng v3.5.6 to the Debian GNU/Linux 8.7 (jessie): # syslog-ng --version syslog-ng 3.5.6 Installer-Version: 3.5.6 Revision: 3.5.6-2+b1 [@416d315] (Debian/unstable) Compile-Date: Oct 1 2014 18:23:11 Available-Modules: confgen,basicfuncs,afstomp,afsocket-tls,csvparser,syslogformat,affile,cryptofunc...
Try destination d_netsrv { network( "10.3.2.1" port(601) transport(tcp) so-keepalive(yes) keep-alive(yes) flags(syslog-protocol) ); }; or if it not works: destination d_netsrv { network( "10.3.2.1" port(601) transport(tcp) flags(syslog-protocol) ); }; The destination address does not have ip(), and you do not ...
syslog-ng network() destination doesn't like transport("tcp")
1,432,735,924,000
I'm receiving a lot of Mongodb logs with my Syslog-ng. below is the sample of logs parsed and stored like this: 2016-10-18 19:01:08 f:local1.p:info h:10.133.126.81 prog:sharmongo-log m:sharmongo-log 2016-10-18T19:01:02.439+0330 I COMMAND [conn71796] command CLM.TroubleTicket command: find { find: "TroubleTicket", fil...
that's a tricky one. The problem imho is, that there are JSON objects intermixed with plain text fields. I think you have the following options (note that you'll need a recent syslog-ng version to use the json and the k-v parsers, I'd go for version 3.8): If you can, configure mongodb to log into pure json, and pars...
parse Mongodb logs with syslog-ng
1,432,735,924,000
Where I work, we have a site-to-site VPN tunnel set up between our main data center and a third party data center that does some Oracle PaaS for us. Since they charge per-VM, we're monitoring the Oracle audit logs on a local VM that is running the analytics for the Security and Audits department. The third party (or r...
Sounds like rsyslog queueing might do what you want. Messages can also be stored for transmission during off-peak hours. Specifically, the following: The "$QueueDequeueSlowdown" directive allows to specify how long (in microseconds) dequeueing should be delayed.
Syslog TLS Compression and Message Buffering
1,432,735,924,000
Installed an application as root owner but not as non-root. why? Because we had to install this application in custom location(/app) So, after installing an application(Syslog-NG), below are the files with current ownership: # ls -l /app/syslog-ng/etc/syslog-ng.conf -rw-r--r-- 1 root root 938 Aug 20 12:43 /app/syslog-...
Simply create a new user and a new group: sudo adduser foo Then, change the group of the file: sudo chgrp foo /app/syslog-ng/etc/syslog-ng.conf And add the write permission: sudo chmod 664 /app/syslog-ng/etc/syslog-ng.conf Executing /app/syslog-ng/sbin/syslog-ng should, according to the permissions, be already poss...
Changing group ownership of files - User management
1,432,735,924,000
I've found a nice feature of the syslog-ng: if I use the logger to log things from the user process, I get the logging user name. Around so: peterh$ echo test log message|logger then I get this in /var/log/messages: Oct 12 16:38:29 thehost peterh: test log message Where "thehost" is the hostname of the server, and "...
I don't know if this is still on going for you, but for reference for anyone else trying to filter by username, this is how I was able to do it. I created the following filter. filter sampleUserFilter { facility (user) and match ("myUser" value ("PROGRAM")); }; That allowed me to route messages from a specifi...
How can I make syslog-ng to filter for a user name?
1,432,735,924,000
Building latest syslog-ng (3.17.2, rather than the packaged version in EPEL, which is 3.5.6, built 30-Dec-2015) from https://github.com/balabit/syslog-ng/releases Amidst ./configure --prefix=/app/syslog-ng, it gives error: configure: error: Cannot find OpenSSL libraries with version >= 0.9.8 it is a hard dependency ...
configure is looking for the relevant openssl development files and cannot find them. On your RHEL 7 system, easiest way to achieve this is to yum install openssl-devel and then retry.
syslog-ng configure on RHEL 7 fails with OpenSSL version 0.9.8 dependency
1,432,735,924,000
I have systems running syslog and rsyslog across my environment and I would like to have similar outputs. I have created a template in rsyslog that looks like the following: $template TraditionalFormatWithPRI,"%TIMESTAMP:::date-rfc3339% %HOSTNAME% %pri-text%:%syslogtag%%msg:::drop-last-lf%\n" I would like to create ...
I believe you need the ${PRIORITY} or the ${LEVEL} macros, see https://www.balabit.com/documents/syslog-ng-ose-latest-guides/en/syslog-ng-ose-guide-admin/html/reference-macros.html
syslog-ng equivilent of pri-test of rsyslog
1,432,735,924,000
What is the difference between these two?: filter f_avc { not message(something); }; and: filter f_avc { not match(something); }; it's hard to google for these types of questions :D
From the Documentation (my boldface): Match a regular expression to the headers and the message itself (i.e., the values returned by the MSGHDR and MSG macros). Match a regular expression to the text of the log message, excluding the headers (i.e., the value returned by the MSG macros).
syslog-ng difference between "not message(something)" and "not match(something)"?
1,432,735,924,000
I am building an embedded Linux board with Buildroot (user manual here). I have syslog-ng running on the board. It's config file is specified in buildroot here: https://github.com/buildroot/buildroot/blob/master/package/syslog-ng/syslog-ng.conf: @version: 3.37 source s_sys { file("/proc/kmsg" program_override("ke...
Solved! You must force syslog-ng to reopen its target log files after each log rotation So, I figured it out. Thanks to @Murray Jensen for the hint about it here. Whenever logrotate rotates my /var/log/messages file, it renames it to /var/log/messages.1. However, syslog-ng is writing to the file pointed to by the orig...
Buildroot: syslog-ng logs into the "/var/log/messages.1" file instead of "/var/log/messages"
1,432,735,924,000
I am running syslog-ng on debian. How do I check which conf file was loaded upon startup? Neither systemctl status syslog-ng nor systemctl show syslog-ng tell me.
By default, syslog-ng loads the configuration from a hard-coded default configuration path (you can check that path with the syslog-ng --help command, it's next to the --cfgfile option. This can be changed via the command line with the mentioned option. If you want to see all the configuration files loaded recursively...
How do I check which conf file was loaded by syslog-ng when starting?
1,432,735,924,000
I am new to syslog-ng, and want to test writing to a syslog from an external device. The external device shows that it is "connected" to my syslog on port 516. However, on my CentOS7 host nothing is being written to the log file (and now errors in /var/log/messages). I tried telneting to localhost:516 and dumping i...
Several errors are present. For one the system() and internal() need to be terminated with ; source s_test { system(); internal(); syslog(ip(0.0.0.0) port(516) transport("tcp")); }; destination d_test { file("/var/log/test"); }; log { source(s_test); destination(d_test); }; This yields new errors and warn...
syslog-ng not writing to file
1,432,735,924,000
I am trying to install syslog-ng-3.13.2 from source code on embedded linux. The ./configure command worked without any error. When I do make, I get the following error: In file included from /source/lib/cfg-grammar.y:41:0, from modules/native/native-grammar.y:39: ./lib/logthrdestdrv.h:33:16: fatal ...
iv.h comes from libivykis. You don’t specify which distribution you’re using; on Debian and derivatives you’ll need to install libivykis-dev.
syslog-ng make error - iv.h: No such file or directory
1,432,735,924,000
Below is the current configuration for Syslog-NG logging, locally, source s_network { udp( flags(syslog_protocol) keep_hostname(yes) keep_timestamp(yes) use_dns(no) use_fqdn(no) ); }; destination d_all_logs { file...
If you want to combine multiple match statements, use or: filter send_remote { match("01CONFIGURATION\/6\/hwCfgChgNotify\(t\)", value("MESSAGE")) or match("01SHELL\/5\/CMDRECORD", value("MESSAGE")) or match("10SHELL", value("MESSAGE")) or match("ACE-1-111008:", ...
SyslogNG-How to optimise filter and log statements? [closed]
1,432,735,924,000
I've recently rebooted one of my machines after a long time and a now I'm having a lot of problems with configuration changes. syslog-ng service is not working anymore with the following error from journactl: -- Unit syslog-ng.service has begun starting up. Oct 01 17:13:48 SIEM-ConnLinuxLR systemd[1]: syslog-ng.servic...
Solved! As @Alexander pointed the problem was that SELinux was blocking the port but I'm receiving the logs in 515 so i cannot change it. The solution was to set SELinux from enforcing to permissive with setenforce 0. Additionally, I've changed the config file to apply this configuration after restart by changing the ...
syslog-ng won't start because error binding socket with permission denied
1,432,735,924,000
Scenario is to receive all incoming messages and store all of those messages in /app/syslog-ng/custom/output/all_devices.log, but forward only certain messages(by filtering). filter tag is used to filter incoming messages to Syslog-NG, which is not the right usage, in this scenario. For example: filter f_warn { level(...
You can combine multiple directives in your configuration file. As an example, based on your code, you define a filter: filter f_warn { level(warn); }; then a destination: destination remote_log_server { udp("192.168.0.20" port(25214)); }; and put them all together with something like: log { source(src); filter(f_w...
Forwarding messages with certain filter
1,525,798,884,000
I'm connected to local area network with access to the Internet through gateway. There is DNS server in local network which is capable of resolving hostnames of computers from local network. I would like to configure systemd-resolved and systemd-networkd so that lookup requests for local hostnames would be directed (r...
In the configuration file for local network interface (a file matching the name pattern /etc/systemd/network/*.network) we have to either specify we want to obtain local DNS server address from DHCP server using DHCP= option: [Network] DHCP=yes or specify its address explicitly using DNS= option: [Network] DNS=10.0.0...
How to configure systemd-resolved and systemd-networkd to use local DNS server for resolving local domains and remote DNS server for remote domains?
1,525,798,884,000
I'm currently working on a project that has required some DNS troubleshooting. However I am fairly new to the wonderful world of networking and I'm at a bit of a loss as to where to begin. My specific problem probably belongs on the Raspberry Pi Stack Exchange, so I'll avoid crossposting. Just looking for information ...
When you run a command such as ping foobar the system needs to work out how to convert foobar to an ip address. Typically the first place it looks is /etc/nsswitch.conf. This might have a line such as: hosts: files dns mdns4 This tells the lookup routine to first look in "files", which is /etc/hosts. If tha...
What is the difference between resolvconf, systemd-resolve, and avahi?
1,525,798,884,000
TL;DR sudo cp -p /etc/network/if-up.d/resolved /etc/network/if-up.d/.resolved.broken-orig #Edit /etc/network/if-up.d/resolved and take out the extraneous quotes on lines 48 and 52 #The fix looks like: diff /etc/network/if-up.d/.resolved.broken-orig /etc/network/if-up.d/resolved 48c48 < "$DNS"="$NEW_DNS" --- > $DNS="$...
I bumped my Ubuntu server 18.04->22.04 and ran into this issue. As you clearly stated (thank you!) updating /etc/network/if-up.d/resolved and removing 2 quoted variables in such a way: sudo vim /etc/network/if-up.d/.resolved.broken-orig Old: "$DNS"="$NEW_DNS" --> New: $DNS="$NEW_DNS" Old: "$DOMAINS"="$NEW_DOMAINS" -...
DNS broken when using ifupdown and systemd-resolved after upgrade to Ubuntu 22.04
1,525,798,884,000
I'm using a local BIND9 server to host some local dns records. When trying to dig for a local domain name I can't find it if I don't explicitly tell dig to use my local BIND9 server. user@heimdal:~$ dig +short heimdal.lan.se user@heimdal:~$ dig +short @192.168.1.7 heimdal.lan.se 192.168.1.2 Ubuntu 17.04 and systemd-r...
So, changing my wired eth0 interface to be managed solved this issue for me. Changing ifupdown to managed=true in /etc/NetworkManager/NetworkManager.conf [ifupdown] managed=true Then restart NetworkManager sudo systemctl restart NetworkManager After this it works flawlessly.. This was not 100%. I also applied theses...
Why doesn't systemd-resolved use my local DNS server?
1,525,798,884,000
I have read about systemd-resolved.service https://www.freedesktop.org/software/systemd/man/systemd-resolved.service.html and learnt four modes of handling /etc/resolv.conf. /run/systemd/resolve/stub-resolv.conf /usr/lib/systemd/resolv.conf /run/systemd/resolve/resolv.conf /etc/resolv.conf may be managed by other pac...
My guess is that you are getting your IP configuration from DHCP, which overrides the DNS information in your resolved.conf file (from systemd.network(5)): [DHCP] SECTION OPTIONS [...] UseDNS= When true (the default), the DNS servers received from the DHCP server will be used and take precedence over any statically...
Clarifying four modes of handling /etc/resolv.conf in systemd-resolved
1,525,798,884,000
I looked into the systemd-networkd and systemd-resolved: systemd.network(5) on manpages.ubuntu.com systemd-resolved.service(8) on manpages.ubuntu.com and I am confused by some words: systemd-resolved.service(8) Single-label names are routed to all local interfaces capable of IP multicasting, using the LLMNR protoc...
This issue gets very long to explain. The short (imprecise) description is: where will the single-label lookup requests go? Single label? (not localhost et al.): Always to the LLMNR system. Multi-label?: To the DNS servers of each interface. On failure (or if not configured), to the global DNS servers. Yes, the gener...
How single-label dns lookup requests are handled by systemd-resolved?
1,525,798,884,000
So I was testing a router and it added some random IPv6 addresses to all the machines on my network, including my DNS server. Somehow those IPs were broadcasted around as valid DNS servers (not sure how as only the real router sends IPv6 RA packets) but long story short, now all my machines are sending DNS queries to...
After some investigation and a systemd bug report, here is what I discovered. systemd-resolved gets all its DNS information from systemd-networkd, so focus on systemd-networkd as fixing the rogue server there will flow on into systemd-resolved. The data is stored in /var/run/systemd/netif/ with one file per interface....
How do you remove bad DNS server IPs from systemd-resolved?
1,525,798,884,000
I'd like to start using systemd-resolved on Oracle Linux 7.6. I've installed systemd-networkd and systemd-resolved. I've enabled these services and I've disabled network and NetworkManager. From the possible working modes I'd like to use systemd-resolved as a local resolver and for the compatibility reasons I'd like t...
Sorry, i am late to the party, but maybe this will help others. I had the same problem, and actually, the /run/systemd/resolv directory was missing. Then I realized that systemd-resolved.service was not running. For some reason, it got disabled. So I had to simply just bring it up again. sudo systemctl enable --now s...
Why is my stub-resolve.conf missing?
1,525,798,884,000
I have been doing an effort to go full on DNSSEC on my system with the following setup: dnscrypt-proxy installed, up and running on 127.0.0.1 with require_dnssec = true systemd-resolved running, with DNSSEC=yes and DNS=127.0.0.1 only nameserver 127.0.0.1 in /etc/resolv.conf connected through NetworkManager to a WiFi ...
If both dnscrypt-proxy and systemd-resolved are using 127.0.0.1:53, this should not be the case. You need to disable systemd-resolved as recommended by dnscrypt-proxy wiki, and also lock /etc/resolv.conf for possible changes made by your Network Manager. So, here are the steps: Disable systemd-resolved: sudo systemc...
Going all-in on DNSSEC
1,525,798,884,000
When I connect to my phone hotspot I would expect systemd-resolved to use the DHCP-provided DNS list. For some reason it seems to not be the case for me. I am using Ubuntu 22.04.1 LTS /etc/systemd/resolved.conf is empty When I connect to my phone WiFi I get the results below: IP-Address: ip a show wlp3s0 3: wlp3...
The reason was statically configured list of IP addresses in /etc/NetworkManager/system-connections/name.nmconnection.
Systemd-resolved setting unexpected DNS list
1,525,798,884,000
I'm trying to use the DNS over at /etc/systemd/resolved.conf in their capacity as DNS over TLS providers, but NetworkManager somehow manages to set ~. as search domain on the connections it sets up. That causes all the DNS queries to be funneled over the specific interface's DHCP-resolved DNS instead of the global DNS...
I am not sure which version of NetworkManager implemented the change, but the problem has since been fixed with the current versions of NM.
Prevent NetworkManager from setting ~. search domain per-link on systemd-resolved
1,525,798,884,000
Problem: Running Ubuntu 17.10 I have been trying to resolv (hehe) this issue for about a week now and despite countless Google searches and about 20 different attempts, I can not stop dnsmasq from periodically causing my CPU to spike for about a minute with the following offenders: systemd-resolved systemd-journald d...
It looks like you may have dnsmasq process in 127.0.0.1 and systemd-resolved process in 127.0.0.53 passing queries back and forth between each other, causing a loop. Even dnsmasq alone might be capable of looping, as by default it looks into /etc/resolv.conf to find the real DNS servers to use for the names it does no...
dnsmasq & systemd Causing Intermittent CPU Spikes
1,525,798,884,000
I'm creating a custom distribution where I need a DNS responder. I'm already using systemd so I would like to use systemd-resolved to manage mDNS (the device should announce itself as capable of a couple of services); I'm not sure whether or not this is possible, but the systemd-resolved documentation pages reports s...
The capability of using mDNS should be enabled in the /etc/systemd/resolved.conf file, in the [Resolve] section, by setting MulticastDNS=yes. Moreover, it should be enabled in the [Network] section of each interface configuration file (the one for systemd-network) by setting MulticastDNS=yes. The status of the Multica...
systemd-resolved as mDNS responder
1,525,798,884,000
Why does systemd-resolved from systemd version 219 listen on one random UDP port? One of my machines listens on port 58557 (CentOS 7 with systemd version 219). sudo netstat -tunlp|grep -P '^Active|^Proto|systemd' Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/...
As I mentioned in a comment to the question, I ran systemd-resolved in strace, while watch[ing] netstat -tunlp. I noticed that the port is only opened once I make the first request to resolve a DNS name. I captured the traffic using tcpdump -i eth0 -nn -w capture_file, noted down the port I see in netstat and looked a...
systemd version 219 from CentOS 7 listening on random UDP port
1,525,798,884,000
Is there a way I can permanently set the DNS preference of my Ubuntu laptop for specific network interfaces? I am relying on a wifi network that is not that predictable. I don't have access to the edit-mode of the wifi router management console, and every now and then the wifi connection drops off and then comes back ...
You haven't indicated if this is a Desktop or Server installation. Either way, I'll try to explain. First, let's look at the contents of /etc/resolv.conf: nameserver 127.0.0.53 options edns0 trust-ad search lan This is showing 127.0.0.53 as the nameserver, which is expected and is the local caching stub resolver. In ...
How do I permanently configure the DNS resolution in Ubuntu for ALL programs/layers for specific interfaces