date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,418,256,754,000
My first question on this site, I come quickly. I'm a fan of command line tools and text-based application. I use tmux with a minimalist tiling wm is qtile, I can not change the environment. I'm a developer, I mainly use Python and Perl. My first question is about mutt a great client. I use the sidebar to be able to d...
It's a little hard to see what you are trying to do, but are you by any chance looking for the $spoolfile variable/configuration setting in a global context? I'm not sure how it interacts with Mutt's IMAP support, but it allows you to set the folder which will be opened by default when Mutt is started. It looks like y...
Mutt imap multiple account
1,418,256,754,000
I have offlineimap running on a cron job with */10 * * * * offlineimap -q -u quiet. Every once in a while it seems to get interrupted, and when that happens I can't restart it. If I try to run it from the terminal I get an error indicating that it is locked: OfflineIMAP 6.5.5 Licensed under the GNU GPL v2+ (v2 or an...
This seems to be resolved in OfflineIMAP 6.6.1.
How do I restart offlineimap?
1,598,552,100,000
I've used OAUTHBEARER authentication to use mutt with GMail for a while, but I've run into a an issue that I can't figure out. When I launch mutt I get OAUTHBEARER authentication failed. Here is .muttdebug0: [2020-08-27 10:38:59] TLSv1.3 connection using TLSv1.3 (TLS_AES_256_GCM_SHA384) [2020-08-27 10:39:00] Connected...
I figured this out. I had a change in my oauth2.py that printed the json response instead of just the access_token. mutt was passing the base64-encoded json as the bearer token which is not correct. Thanks to @jakub-jindra for pointing me toward the --quiet option. I figured this out by running mutt -d 5 which shows t...
OAUTHBEARER authentication fails in mutt
1,598,552,100,000
I want to find all emails in my IMAP folders that contain a certain text (namely: that are sent to a certain email address). I already found out I can do so by using grep like so: grep -rnw '~/users/example' -e "[email protected]" This returns either the matched text or the name of the file (with -l). But what I real...
Using formail (shipped with procmail): find ~/users/example -type f -exec sh -c ' for email do formail -x to -x cc < "$email" | grep -qF [email protected] && formail -cx subject < "$email" done' sh {} + That is, for each email file extract the To and Cc headers search for [email protected] in the...
Find files containing text, but report different part of it as result
1,598,552,100,000
After reinstalling the email client Thunderbird and configuring my email account using IMAP, Thunderbird starts to download all old messages. Judging from the time it takes it seems like entire messages are downloaded instead of only the message headers. Right now the status bar says [email protected]: Downloading me...
It's all there in the account configuration. You can even decided to synchronize just the recent messages (you specify what recent is). This is the screen: Taken from: https://support.mozilla.org/en-US/kb/imap-synchronization, where you will find the rest of the options and even a list of synchronization benefits and...
Prevent Thunderbird from downloading old messages
1,598,552,100,000
I have a mail server I'm trying to setup to service 6 domains. I will have multiple mail users accessing the server via POP3S or IMAPS. Currently in MS Outlook, they are receiving an unverified SSL cert warning because I'm using a self-signed SSL certificate. I would like to purchase a SSL cert which would stop this w...
I have used multiple domain certificates, but only in cases where the names are variant domains the same organization. Ownership of the names trace back to the same corporation. If I were a certificate authority, I would not want to provide the same service for unrelated organizations. For SMTP, it is not unusual ...
Dovecot POP3S & IMAPS SSL Certificate that works for all user domains
1,598,552,100,000
I've succesfully set up Postfix and Dovecot at my home server to use Maildir as the mailbox storage format. However after I tried out a couple of different mail clients like Thunderbird and Outlook and connected through Dovecot's IMAP server, I found out that they're all a bit inconsistent in the way they make use of ...
Unfortunately at present there's no strict standard on IMAP folder/flag usage, and no easy way to unify behaviors of all IMAP clients. Most clients, including Outlook and many mobile device apps, are incapable of changing behavior other than its default settings. The best bet might be to configure most flexible one (...
Mail clients' inconsistent use of Maildir through IMAP
1,598,552,100,000
I have IMAP folders like this: A A/A A/B B B/A C When I save (s in mutt) a mail and use ?, I'm presented with a view like this: A + B + C It works perfectly until I want to move to A or B. If I click on A, it automatically expands A and presents me with its children (A and B). Is there a way to do that? Or is ther...
In the ? view, you can cursor to the folder you want to pick and press Space. If you're in a place where you can just type the name (e.g. in the plain s view), you can just type the name of the folder preceded by =.
How to select an expandable folder when saving?
1,598,552,100,000
I have configured dovecot to use Client certificate authentication. I have used CA.pl (openssl wrapper) to create CA cert and sign client and server certs with that.(no certificate chain, CA cert is trusted in client) I have set the certificate as CA certificate in dovecot for client auth. Dovecot correctly asks IceDo...
I found the answer so I thought I should post it here too. (precisely @behrad-eslamifar did :) you should append the CRL to the CA certificate given to dovecot EVEN IF YOU HAVE SET ssl_require_crl = no like this way : openssl ca -gencrl -out crlfile cat crlfile >> cacert.pem service dovecot restart thanks everyone fo...
Dovecot rejecting client certificate
1,598,552,100,000
I am using offlineimap to fetch mail from several IMAP servers. This used to work but today offlineimap has been unable to fetch mail, producing the following errors: *** Processing account example Establishing connection to imap.gmail.com:993 ERROR: Unknown SSL protocol connecting to host 'imap.gmail.com' for repo...
The problem started when I installed Homebrew's version of python rather than the Apple version. The error was resolved by running brew uninstall python I discovered this was the solution by reading about a similar error produced by another Python program on OS X.
Offlineimap unknown SSL protocol error
1,598,552,100,000
I have a Perl script that uses NET::IMAPClient and MIME::Parser which simply reads new emails from an IMAP server and saves any attachments to disk. My question is: what is the best way to run this script as soon as there's new email? I can use cron to periodically run the script, I could check every few seconds even...
In general you keep checking for e-mail unless, as mentioned by @JoelDavis, the server can be extended with some push command. Further if your e-mail server supports it one can make use of the IDLE extension for IMAP4: https://www.rfc-editor.org/rfc/rfc2177 http://en.wikipedia.org/wiki/IMAP_IDLE The IMAPClient has n...
Receiving emails over IMAP and parsing with a script with minimal delay
1,598,552,100,000
I am using cyrus imapd on Fedora The mailbox of a user is presenting a deep tree of nested INBOXes: user.foo user.foo.Apple Mail To Do user.foo.Archives user.foo.Archives.2011 user.foo.Deleted Messages user.foo.Drafts user.foo.INBOX.Deleted Messages user.foo.INBOX.INBOX.Deleted Messages user.foo.INBOX.INBOX.INBOX.Dele...
It seems to be some kind of bug. Which version of cyrus imap you are using? As a quick fix, I think following should work. Using cyradm delete those rogue mailboxes. You can find how to use cyradm here. localhost> sam user.foo.INBOX.* cyrus d localhost> dm user.foo.INBOX.*
cyrus impad and recursive 'INBOX' directories
1,598,552,100,000
Trying to setup a simple automation system has proved exceedingly complicated for me. Using scripts, I want to use email to perform remote tasks. The script outline: Send an empty body email with the header as "Pattern1 (number)" Read the last 50 email headers. Find latest header matching "Pattern2 (number)". Save (e...
It can all be done with only curl. Send email MSG="From: [email protected] To: Receiver Subject: Test" echo "$MSG" | curl --url 'smtps://smtp.gmail.com:465' --ssl-reqd \ --mail-from "[email protected]" --mail-rcpt "[email protected]" \ --upload-file - --user "[email protected]:password" --insecure To read mail, firs...
Setup simple Automation system using Email
1,598,552,100,000
I have an email server with public dns entry that sends and receives fine. I am trying to add it to outlook as imap account but it keeps failing. Server error shows Oct 30 15:29:04 mail.example.local dovecot[17250]: imap-login: Disconnected (auth failed, 1 attempts in 4 secs): user=<[email protected]>, method=PLAIN, ...
I have solved the issue, after following this guide http://xmodulo.com/enable-user-authentication-postfix-smtp-server-sasl.html It still didn't work, but turns out it was because my password had a '£' in which was causing the issue.
imap-login: Disconnected
1,598,552,100,000
I'm trying to sync my emails from an old server "server2" with a new one "server1" imapsync \ --host1 imap.server1.com --user1 [email protected] --password1 fdsfdsfsfd \ --host2 imap.server2.com --user2 [email protected] --password2 fdsfdsfds \ --debugimap1 --debugimap2 \ --tls1 --tls2 --de...
Replace --tls1 --tls2 by --ssl1 --ssl2
Unable to sync email using imapsync
1,598,552,100,000
I want to download my emails via IMAP from email account and upload them to another. I want to do that manually in Python. I know how to retrieve my emails via IMAP, but how can I actually "upload" them to my another email account? Is there a standard way or does that depend on my 2nd email server?
You can upload with python as well: import imaplib # an alternative for IMAP4_SSL is IMAP4 if you're doing this locally imap = imaplib.IMAP4_SSL(your_2nd_server, its_imap_portnumber) imap.login(user_name, password) and then for each message you downloaded: imap.append(mailbox, [], delivery_time, message) You have...
How to upload my emails to another email server I've downloaded via IMAP from my 1st one?
1,598,552,100,000
I'm running Ubuntu 14.10 installed postfix dovecot vimbadmin and roundcube. Everything works except dovecot. When I restart dovecot I get this: stop: Unknown instance: dovecot start/running, proccess 6580 In my var/log/dovecot.log file I get this: Fatal: service(auth) Group doesn't exist: postifx (See service auth ...
You presumably have a typo, postifx should be postfix. Search the dovecot config files for postifx and fix those.
Dovecot (imap) not starting
1,598,552,100,000
I know this is theoretically possible, but I'm trying to avoid reinventing the wheel. I'm using Ubuntu Linux, with Maildir mailbox format. I want to put something in my .login that will parse the ~/Maildir contents and display a summary of my unread email messages. I'm running Ubuntu 13.04 (Raring Ringtail), and I us...
I found a shorter and simpler way to implement with Python. Sample code below. #!/usr/bin/python import mailbox import email.utils import os mbox = mailbox.Maildir(os.environ['HOME'] + "/Maildir" ) mbox.lock() spam = mbox.get_folder('INBOX.junk') print "INBOX:" for message in mbox: print "- [%s] %s: \"%s\"" % (...
How can I print a summary of Maildir contents when logging into a shell?
1,598,552,100,000
I'm running into a weird issue setting up Postfix and Courier IMAP on a clean Ubuntu 13.04 install. I'm using this tutorial, and am currently Testing Courier IMAP. When I try to login with root, everything's fine (this is part of a netcat connection): a login root my-pass a OK LOGIN Ok. a logout * BYE Courier-IMAP ser...
It appears that Courier IMAP's architecture does not support Maildirs outside of $HOME.
Courier IMAP cannot find my Maildir but can find root's Maildir
1,598,552,100,000
Where can I find configuration file for uw-imapd on debian? Is there even one?
From what I can tell, there is no configuration file for uw-imapd. It is known for needing very little configuration. But according to this link, you should be able to change some settings by modifying xinetd.d configs.
Where can I find configuration file for uw-imapd on debian?
1,598,552,100,000
I have installed mail server with postfix and dovecot. My clients use The Bat email client software. While sending mails, they use tcp port 587 with STARTTLS. And I disabled tcp port 25 for sending mails in firewall (in server). Now, they receive mails via tcp port 110 POP3 protocol. I want to use IMAP or IMAPS fo...
Make sure your dovecot configuration is done right. (how to) Depending on a version check if you have imap protocol enabled in: /etc/dovecot.conf /etc/dovecot/dovecot.conf OR /etc/dovecot/conf.d/10-master.conf Than check if dovecot is listening on 143 Than check it from outside, that the port is really opened. ...
How to configure and force users to use IMAP?
1,598,552,100,000
Picture a mail store for virtual users. Arriving mail is managed by Postfix (creating new files); access to mail is provided by Courier IMAP (moving files around, deleting files, creating sent mail); and periodically, off-site backups are taken (reading files without changing anything). Obviously this will all work if...
After further research, I've come to the conclusion that this isn't possible; it's a form of file giveaway (because the postfix user would need to create files owned by backup). Looks like the backup program will simply have to run with group access to the mailstore, and thus be depended on to not change anything.
Postfix, Courier, and backups - appropriate file permissions?
1,459,270,251,000
I'm currently trying to set up Postfix with Dovecot, but something does not seem to work the way it should be. For some reason, mails I sent to my mail account appear in the logs, but do not become relocated into the respective mailbox. The logs are not displaying any error, so I am pretty much left without a clue whe...
You probably have the default local_transport = local as the log says delivered to mailbox. You need to tell postfix to use dovecot as the transport for local deliveries. you can do this as follows: Edit your main.cf file and modify it to have the following lines: local_transport = virtual virtual_transport = dovecot ...
Postfix / Dovecot Mail appears in logs, but not in its respective folder
1,459,270,251,000
To automate the command line creation of hundreds of directories in IMAP maildirs, I would need to be able to convert UTF-8 strings to UTF-7-IMAP on the fly. In php, I found a way to do it with a string passed as an argument, but it's not very practical, and it requires installing php. <?php echo mb_convert_encoding($...
iconv (or at least the 2.36 version available on Debian 12) knows about the encoding you need: $ iconv -l | grep -i imap UTF-7-IMAP// So: $ printf '%s\n' 'Santé' | iconv -f UTF-8 -t UTF-7-IMAP; echo '' Sant&AOkACg- $ printf '%s' 'Santé' | iconv -f UTF-8 -t UTF-7-IMAP; echo '' Sant&AOk- Note that both outputs lack a ...
I need to create a pipe to convert string from UTF-8 to UTF-7-IMAP
1,459,270,251,000
I'm developing an email client and need a IMAP server without ssl to test with. I have a bare Ubuntu 16.04 install with DigitalOceans I would like to setup as a simple imap server. It doesn't need to be able to accually send emails, I just need to be able to connect to it using the imap protocal. What's the bare mini...
dovecot should work more or less out of the box. You may need to enable plaintext auth on insecure connections. Uncomment the disable_plaintext_auth line and change yes to no disable_plaintext_auth = no Install the package with the command sudo apt-get install dovecot-imapd.
Simplest IMAP configuration without SSL
1,459,270,251,000
I have set up Icedove (Thunderbird) to use my gmail account with IMAP. I would like to have my IMAP folder structure gmail.com - Inbox - Drafts - Sent - Trash However, the actual folder structure loos like this: With Inbox being displayed correctly, but the rest of the folders nested inside subfolder...
I don't think that thunderbird displays it incorrectly. Gmail uses a special implementation of IMAP. In this implementation, Gmail labels become Thunderbird folders. When you apply a label to a message in Gmail, Thunderbird creates a folder with the same name as the label and stores the message in that folder. Simila...
Thunderbird displays IMAP folders incorrectly (gmail account)
1,459,270,251,000
Problem: When starting cyrus imap with the following line in /etc/cyrus.conf: SERVICES { ... lmtp cmd="lmtpd -a" listen="[192.168.50.100]:lmtp" prefork=1 proto=tcp4 } to enable lmtp via tcp socket, the socket is not opened. In the logfile the following message appears: Servname not supported for ai_sockty...
Answer: Servname not supported for ai_socktype, disabling lmtp means that no entry for lmtp could be found in /etc/services. Either add a line like: lmtp 2003/tcp # Lightweight Mail Transport Protocol service to /etc/services (and make sure the file is world-readable/mode 644) or change the cyrus config file s...
cyrus imap does not start lmtp tcp socket, error message: Servname not supported for ai_socktype, disabling lmtp
1,459,270,251,000
Classic email setup: [REAL-MAIL-SERVER] [IMAP/POP3 >] ---------> [EMAIL-CLIENT] [Storage] Is there any server application (open source) that would permit to store emails and act like a rely/proxy between the client and the mail server ? [REAL-MAIL-SERVER] [PROXY-RELY-SERVER] [IMAP/...
I assume everything is captured by the 'proxy-rely-server' (as you named it) serving all clients (the easy way) and it's the common client. You probably need a couple of MRA and MDA installed on your 'proxy-rely-server'. The MDA will act as POP/IMAP server (for local use + other clients). The MRA (some kind of special...
Is there any IMAP/POP3 rely and archiving server application?
1,459,270,251,000
I've currently got Neo/Mutt configured alongside iSync for a few different accounts. Everything syncs up and I've got the Mutt client configured roughly how I want it. However, I run into issues when using <save-message> to move a message to an Archive folder. It's different depending on the type of account: In my tw...
I figured out how to get this working with the ProtonMail account. It turns out it is possible to save-message directly to an IMAP directory. However, while mbsync was interfacing with the ProtonMail Bridge's IMAP just fine, NeoMutt would get stuck on "Logging in..." While trying to debug the overall issue, I had a lo...
Mixing local and remote IMAP folders in Neo/Mutt and iSync?
1,459,270,251,000
I noticed a recurring error in the mail.log as well as when I run service dovecot status on a server I 'inherited' for my job (used for our production website). We have our MX records pointed to/email hosted by Gmail. imap-login: Fatal: Couldn't parse private ssl_key: error:0906D06C:PEM routines:PEM_read_bio:no start...
Dovecot is an IMAP and POP3 server. If you don't need to serve out email received locally then you don't need Dovecot.
Do I need Dovecot on server if Gmail is hosting our email?
1,459,270,251,000
I can't find any information about the status of IMAP version 4 and how widely it's used nowadays and how widely other versions, 1, 2 and 3 are used. So is IMAP version 4 common these days? What about other the versions 1, 2 and 3?
Restricting this to the commonly used Linux servers: Courier Cyrus Dovecot They all support IMAP4, since the IMAP4rev1 RFC was defined more than 10 years ago, I don't think you'll find the older version still being used.
IMAP -- what are the most popular versions used these days?
1,459,270,251,000
I have a laptop running KMail 5.7.3 on Bionic Beaver. I just got a new computer with Eoan Ermine and am trying to set up Kmail 5.11.3 to use the same IMAP server. I set up the IMAP account, tried to view my email, and got this error: The server for account "IMAP Account 1" refused the supplied username and password. D...
SASL is just a set of authentication mechanisms, which are common to many protocols. It is the modern alternative to protocol specific authentication mechanisms (the LOGIN command in the case of IMAP) and is not the culprit here. Dovecot has a configuration variable, which disables both LOGIN (you can see the LOGINDIS...
How do I disable SASL in KMail?
1,459,270,251,000
On a mail server running postfix and dovecot with imap, mails are stored plain on the disk. Within those mails, we have discovered that mails are stored in 2 ways. The image is embedded as a base64 code block The image is linked via an url such as imap://[email protected]/inboxname Which one is the correct way to s...
The image is embedded as a base64 code block This is the current standard way to actually store an image within an email. You should read about Multipurpose Internet Mail Extensions, or MIME for short. The image is linked via an url such as imap://[email protected]/inboxname This is not so much storing an imag...
How are images in imap mails supposed to be stored?
1,459,270,251,000
I used fetchmail to access my Hotmail/Outlook mailbox. It downloaded every message inside Inbox, but now that folder is empty at the server. Now I see that fetchmail deletes messages by default: -k | --keep : Keep retrieved messages on the remote mailserver. Normally, messages are deleted from the folder on the m...
Solved using Thunderbird: Install Thunderbird Link Hotmail account to Thunderbird using the same IMAP settings as in fetchmail In Thunderbird install ImportExportTools extension Create new folder in Local Folders, right click on the new folder, select ImportExportTools and import mbox file, select the user's mailbox ...
Recover/reupload messages deleted by fetchmail
1,312,395,345,000
I am not sure if I understand the concept of hardware and software interrupts. If I understand correctly, the purpose of a hardware interrupt is to get some attention of the CPU, part of implementing CPU multitasking. Then what issues a hardware interrupt? Is it the hardware driver process? If yes, where is the hard...
A hardware interrupt is not really part of CPU multitasking, but may drive it. Hardware interrupts are issued by hardware devices like disk, network cards, keyboards, clocks, etc. Each device or set of devices will have its own IRQ (Interrupt ReQuest) line. Based on the IRQ the CPU will dispatch the request to the ...
What are software and hardware interrupts, and how are they processed?
1,312,395,345,000
I just know that Interrupt is a hardware signal assertion caused in a processor pin. But I would like to know how Linux OS handles it. What all are the things that happen when an interrupt occurs?
Here's a high-level view of the low-level processing. I'm describing a simple typical architecture, real architectures can be more complex or differ in ways that don't matter at this level of detail. When an interrupt occurs, the processor looks if interrupts are masked. If they are, nothing happens until they are unm...
How is an Interrupt handled in Linux?
1,312,395,345,000
The program ed, a minimal text editor, cannot be exited by sending it an interrupt through using Ctrl-C, instead printing the error message "?" to the console. Why doesn't ed just exit when it receives the interrupt? Surely there's no reason why a cryptic error message is more useful here than just exiting. This be...
Ctrl+C sends SIGINT. The conventional action for SIGINT is to return to a program's toplevel loop, cancelling the current command and entering a mode where the program waits for the next command. Only non-interactive programs are supposed to die from SIGINT. So it's natural that Ctrl+C doesn't kill ed, but causes it t...
Why can't ed be exited with C-c?
1,312,395,345,000
I am reading the Wikipedia article for process management. My focus is on Linux. I cannot figure out the relation and differences between system call, message passing and interrupt, in their concepts and purposes. Are they all for processes to make requests to kernel for resources and services? Some quotes from the ...
All modern operating systems support multitasking. This means that the system is able to execute multiple processes at the same time; either in pseudo-parallel (when only one CPU is available) or nowadays with multi-core CPUs being common in parallel (one task/core). Let's take the simpler case of only one CPU being...
What is the relationship between system calls, message passing, and interrupts?
1,312,395,345,000
I'm trying to get a deeper understanding of how system calls and hardware interrupts are implemented, and something that keeps confusing me is how they differ with respect to how they're handled. For example, I am aware that one way a system call (at least used to) be initiated is through the x86 INT 0x80 instruction....
INT 0x80h is an old way to call kernel services (system functions). Currently, syscalls are used to invoke these services as they are faster than calling the interrupt. You can check this mapping in kernel's Interrupt Descriptor Table idt.c and in line 50 in the irq_vectors.h file. The important bit that I believe ans...
Do system calls actually "interrupt" the CPU the same way that hardware interrupts do?
1,312,395,345,000
I know that I can interrupt a make process anytime without having to recompile the entire source tree again. As I know, make only compiles a target if it's not compiled yet, or the source code is modified after the last compilation. But if I interrupt make, there will surely be one or more (depending on the concurrenc...
In simple terms, you can think of make as having a (possibly large) number of steps, where each step takes a number of files as input and creates one file as output. A step might be "compile file.c to file.o" or "use ld to link main.o and file.o into program". If you interrupt make with CtrlC, then the currently execu...
How does make continue compilation?
1,312,395,345,000
I am reading APUE and the Interrupted System Calls chapter confuses me. I would like to write down my understanding based on the book, please correct me. A characteristic of earlier UNIX systems was that if a process caught a signal while the process was blocked in a ‘‘slow’’ system call, the system call was in...
Interruption of a system call by a signal handler occurs only in the case of various blocking system calls, and happens when the system call is interrupted by a signal handler that was explicitly established by the programmer. Furthermore, in the case where a blocking system call is interrupted by a signal handler, a...
What is interrupted system call?
1,312,395,345,000
I've been reading Linux Kernel Development and there's something that's not entirely clear to me -- when an interrupt is triggered by the hardware, what's the criterion to decide on which CPU to run the interrupt handling logic? I could imagine it having to be always the same CPU that raised the IO request, but as th...
On a multiprocessor/multicore system, you might find a daemon process named irqbalance. Its job is to adjust the distribution of hardware interrupts across processors. At boot time, when the firmware hands over the control of the system to the kernel, initially just one CPU core is running. The first core (usually co...
What's the policy determining which CPU handles which interrupt in the Linux Kernel?
1,312,395,345,000
I have the following in a script: yes >/dev/null & pid=$! echo $pid sleep 2 kill -INT $pid sleep 2 ps aux | grep yes When I run it, the output shows that yes is still running by the end of the script. However, if I run the commands interactively then the process terminates successfully, as in the following: > yes >/d...
What shell is used is a concern as different shells handle job control differently (and job control is complicated; job.c in bash presently weighs in at 3,300 lines of C according to cloc). pdksh 5.2.14 versus bash 3.2 on Mac OS X 10.11 for instance show: $ cat code pkill yes yes >/dev/null & pid=$! echo $pid sleep 2 ...
Why doesn't SIGINT work on a background process in a script?
1,312,395,345,000
man ksoftirqd indicates that: If ksoftirqd is taking more than a tiny percentage of CPU time, this indicates the machine is under heavy soft interrupt load. I'm working with a Debian Wheezy system under generally high system utilization in which ksoftirqd processes utilizes excessive cpu and disk resources for a ...
Check /proc/interrupts to find if one of or more interrupts occur excessively. Hint: Several thousand interrupts per second are no cause for alarm. Excessive interrupts (aka interrupt storms) can have multiple reasons, one of them even being hardware issues (noisy interrupt line). To further answer your question we ne...
How to debug causes of excessive ksoftirqd resource usage?
1,312,395,345,000
When a page fault occurs in a Linux system, the interrupt-handler has to figure out the reason why the page fault happened. But how ? Is there anywhere a special number for that !? If yes, where is that number logged ? Is it possible to know the reason for the page-fault before raising the exception ? Eg. Step-1 Lo...
A page fault occurs when a memory access fails because the MMU lookup for the virtual address ended in an invalid descriptor or in a descriptor indicating a lack of permissions (e.g. write attempt to a read-only page). When a page fault occurs, the processor performs a few actions; the details are specific to each pro...
What happens after a page fault?
1,312,395,345,000
I'm currently learning about the Linux Kernel and OSes in general, and while I have found many great resources concerning IRQs, Drivers, Scheduling and other important OS concepts, as well as keyboard-related resources, I am having a difficult time putting together a comprehensive overview of how the Linux Kernel hand...
Your understanding so far is correct, but you miss most of the complexity that's built on that. The processing in the kernel happens in several layers, and the keypress "bubbles up" through the layers. The USB communication protocol itself is a lot more involved. The interrupt handler routine for USB handles this, and...
How does a keyboard press get processed in the Linux Kernel?
1,312,395,345,000
I'm trying to boot/install Linux for learning purposes, using an older PC (HP Pavilion Elite m9660de). The following message is the first thing that shows up when booting (Ubuntu and Fedora, both from a bootable USB-stick and a fresh install): do_IRQ: 1.55 No irq handler for vector do_IRQ: 2.55 No irq handler for vec...
do_IRQ: 1.55 No irq handler for vector This message can be found in Linux kernel source file arch/x86/kernel/irq.c, so it's about x86-specific handling of interrupts. /* * do_IRQ handles all normal device IRQ's (the special * SMP cross-CPU interrupts have their own specific * handlers). */ __visible unsigned in...
How to deduce the nature of an interrupt from its number?
1,312,395,345,000
I'm starting two child processes from bash script and waiting both for completion using wait command: ./proc1 & pid1=$! echo "started proc1: ${pid1}" ./proc2 & pid2=$! echo "started proc2: ${pid2}" echo -n "working..." wait $pid1 $pid2 echo " done" This script is working fine in normal case: it's waiting both proce...
Set-up a trap handling SIGINT (Ctrl+C). In your case that would be something like: trap "kill -2 $pid1 $pid2" SIGINT Just place it before the wait command.
Interrupt child processes from bash script on Ctrl+C
1,312,395,345,000
I have two questions about the Linux kernel. Specifically, does anybody know exactly, what Linux does in the timer interrupt? Is there some documentation about this? And what is affected when changing the CONFIG_HZ setting, when building the kernel? Thanks in advance!
The Linux timer interrupt handler doesn’t do all that much directly. For x86, you’ll find the default PIT/HPET timer interrupt handler in arch/x86/kernel/time.c: static irqreturn_t timer_interrupt(int irq, void *dev_id) { global_clock_event->event_handler(global_clock_event); return IRQ_HANDLED; } This calls ...
Linux timer interrupt
1,312,395,345,000
I'm studying the linux kernel right know with O'Reilly's Understanding Linux Kernel and lately covered the signal and interrupt handling chapter sticking to some basic 2.4 linux version and diving into code as far as I can understand. Yet, I couldn't explain to myself nor finding an answer elsewhere, what is the instr...
The keypress generates an interrupt, just like you figured out. The interrupt is processed by an interrupt handler; which handler depends on the type of hardware, e.g. USB keyboard or PS/2 keyboard. The interrupt handler reads the key code from the hardware and buffers it. From the buffer the character is picked up by...
How does keyboard interrupt ends up as process signal
1,312,395,345,000
I was reading "Linux device drivers, 3rd edition" and don't completely understand a part describing interrupt handlers. I would like to clarify: are the interrupt handlers in Linux nonpreemptible? are the interrupt handlers in Linux non-reentrant? I believe I understand the model of Top/Bottom halves quite well, and...
The Linux kernel is reentrant (like all UNIX ones), which simply means that multiple processes can be executed by the CPU. He doesn't have to wait till a disk access read is handled by the deadly slow HDD controller, the CPU can process some other stuff until the disk access is finished (which itself will trigger an i...
re-entrency of interrupts in Linux
1,312,395,345,000
I'm studying the book 'Operating System Concepts' 9th edition. In the first chapter, part 1.2.1 computer system operation, I can't understand the figure 1.3: Can any one make a quick interpretation on this for me? especially about the peaks of this graph?
The I/O device (controller) is busy transferring data from the device buffer to the device. It goes from idle to transferring. This is the peak for I/O device. It goes back to idle when the transfer is done, until the next request. The CPU curve shows a peak when the transfer is done because the CPU is notified by t...
The interrupt timeline for a single process doing output
1,312,395,345,000
I have a Linux farm in VMware Enterprise 5.5. The VMs are (mostly) 64-bit amd64 Debian Jessie servers with SysVinit and not systemd. The VMs have open-vm-tools installed. I paravirtualized their Ethernet and disk controllers. Paravirtual drivers are ones where the virtualization platform does not have to emulate a...
If all the following hold More than one CPU in the VM The VM is pinned (via the host) to specific dedicated CPUs (not shared with other VMs) with a 1-1 mapping of VM CPUs to host CPUs The VM has dedicated (e.g. via passthrough) access to storage/network hardware then in-VM IRQ rebalancing still makes sense. Without ...
When is `irqbalance` needed in a Linux VM under VMware?
1,312,395,345,000
To kill a hanging job, I use Ctrl+c, to send an interrupt signal to the hanging job. Sometimes this wouldn't stop the job, at least not immediately. I can then use Ctrl+z to suspend the job and then kill it with kill %1 (or whatever the number of the job is). Why is Ctrl+z more powerful than Ctrl+c in interfering wit...
Ctrl+C (control character intr): It will send SIGINT signal to a process and usually application gets abort but the application can handle this signal. For example you can handle a signal with signal() function in C Language. Ctrl+Z (control character susp): It will send SIGTSTP signal to a process to put it in backgr...
Ctrl+c and Ctrl+z to interrupt/suspend jobs
1,312,395,345,000
How to programmatically detect when a device raises an interrupt? This can be when a device is connected or disconnected. And also this case: for example: when a finger is held over a fingerprint scanner, an interrupt is raised. How to detect and possibly trap this interrupt? I want to write an application using Gtkmm...
I can try to trap the Interrupt at a lower level and inform the gtkmm application. No, that is a kernel space activity. Fortunately, the kernel does report the outcome of certain events via interfaces accessible from userland. It's a little ambiguous in your question whether you want to detect when a block device i...
How to programmatically detect when a device raises an interrupt?
1,312,395,345,000
I've been reading a bit about threads and interrupts. And there is a sections which says that parallel programing using threads is simpler because we don't have to worry about interrupts. However, what is the mechanism in which signals the release of the blocking system call if not an interrupt? Example I read i file ...
Interrupts are handled by the operating system, threads (or processes, for that matter) aren't even aware of them. In the scenario you paint: Your thread issues a read() system call; the kernel gets the request, realizes that the thread won't do anything until data arrives (blocking call), so the thread is blocked. K...
Are threads which are executing blocking system calls awoken by interrupts?
1,312,395,345,000
When a timer interrupt occurred the ISR is called to service the interrupt. Is it okay to assume that every timer interrupt ends with a call to the scheduler on which process should continue running next? Can that be generalized and say that every interrupt must end in a scheduler call?
The timer ISR doesn't call schedule() directly. It ends up calling update_process_times() so the scheduler process accounting information is up to date. The scheduler is eventually called when returning to userspace. If the kernel is preemptive, it is also called when returning from the timer interrupt to kernelspace....
Are time interrupts always followed by a scheduler call?
1,312,395,345,000
Warning: DO NOT attempt the commands listed in this question without knowing their implications. Sorry if this is a duplicate. I am surprised to learn that a command as simple as echo $(yes) freezes my computer (actually it is lagging the computer very badly rather than freezing, but the lag is bad enough to make one...
As of GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu) and I am not using a VM: echo $(yes) exists the shell and does not freeze the system, and: ls /*/../*/../*/../*/../*/ returns bash: /bin/ls: Argument list too long But as a rule, when you dealing with something that could get all the resources of a s...
Interrupt shell command line expansion
1,312,395,345,000
As far as I understand, the kernel is not a process, but rather a set of handlers that can be invoked from the runtime of another progress (or by the kernel itself via a timer or something similar?) If a program hits some exception handler that requires long-running synchronous processing before it can start running a...
"The kernel is not a process." This is pure terminology. (Terminology is important.) The kernel is not a process because by definition processes exist in userland. But the kernel does have threads. "If a program hits some exception handler that requires long-running synchronous processing before it can start running ...
How does the kernel scheduler know how to pre-empt a process?
1,312,395,345,000
Are the system calls like fork(), exit() saved in some kind of function pointer table , just like the Interrupt Descriptor Table ? where does my OS go when I call my fork() or exit() ? I guess this image explains it, but I would like an explanation from a person who really knows what's happening , I don't want knowled...
There's a fantastic pair of articles on LWN that describe how syscalls work on Linux: "Anatomy of a system call", part 1 and part 2.
Is there any Syscall table just like Interrupt Table?
1,312,395,345,000
While I know that lot of packet processing(CRC calculations, packet segmentation handling, etc) can be offloaded to NIC, then does each packet still cause an interrupt to CPU? Is there a difference if NIC is in promiscuous mode?
Normally, the NIC will only interrupt the CPU if it needs to send the received packet to the system. In non-promiscuous mode, this would only be for packets addressed to its MAC address, the broadcast address ff:ff:ff:ff:ff:ff, or a multicast address to which it has been subscribed. It also does validation before send...
Does each network packet cause an interrupt to CPU?
1,312,395,345,000
In the following chain of piped commands, when an interrupt is sent with Ctrl-C, ping is able to print its summary statistics before exiting, as long as tee has the -i (ignore interrupts) flag: ping -D localhost 2>&1 | tee -a -i ping.log However, with another command in the chain, ping's summary does not get printed:...
ping -D localhost 2>&1 | (trap '' INT; exec sed -u 's/^\[\([0-9]*\.[0-9]*\)\]\(.*$\)/echo "[`date -d @\1 +"%Y-%m-%d %H:%M:%S"`] \2"/e') | tee -a -i ping.log Calling trap '' INT tells the shell to ignore SIGINT. The exec is optional but nice to have, since the subshell process is no longer necessary after the trap.
How to ignore interrupts with piped commands
1,312,395,345,000
Here is the output from cat /proc/irq/79/spurious: count 28 unhandled 0 last_unhandled 0 ms What are these parameters indicating here — count, last_unhandled? Is this count indicating the number of times this interrupt did not get noticed?
count gives the total number of times the IRQ fired, modulo 100,000; spurious gives the number of unhandled events in recent memory; and last_unhandled stores the jiffies at which the last unhandled event occurred (displayed in milliseconds since the kernel booted). The purpose of these is to track spurious interrupts...
What does `/proc/irq/.../spurious` contain?
1,312,395,345,000
cat /proc/interrupts shows a bunch of IRQs such as NMI and LOC. The per-line comments in the output give clear explanation, but if they do not have a numeric IRQ number, how does the x86 CPU respond to them, in terms of entries in the Interrupt Descriptor Table?
The non-numeric entries in /proc/interrupts correspond to arch-specific, non-device-related interrupts. On x86, the IDT layout is described in arch/x86/include/asm/irq_vectors.h: Vectors 0 ... 31 : system traps and exceptions - hardcoded events Vectors 32 ... 127 : device interrupts Vector 128 : legacy ...
What are the non-numeric IRQs in /proc/interrupts?
1,312,395,345,000
In my previous question How does the kernel scheduler know how to pre-empt a process? I was given an answer to how pre-emption occurs. Now I am wondering, how does the kernel scheduler know that a timeslice has passed? I read up on the hardware timer solution which makes sense to me, but then I read that most current ...
It seems like some hardware timer would be necessary? Yes, the kernel relies on hardware to generate an interrupt at regular intervals. On PCs, this was historically the 8253/8254 programmable interval timer, or an emulation thereof, then the local APIC timer, then the HPET. Current Linux kernels can be built to run...
How does the kernel scheduler know a timeslice has passed?
1,312,395,345,000
I have been playing around kernel programming for a while and want to create this simple data acquiring interface with some custom hardware. For portability and reusability, I do the whole thing on my Raspberry Pi. The challenging part of the project is having a high speed ADC (parallel) connected to GPIO's and havin...
For the userspace data collection program, what is wrong with an infinite loop? As long as you are using the poll system call, it should be efficient: https://stackoverflow.com/questions/30035776/how-to-add-poll-function-to-the-kernel-module-code/44645336#44645336 ? Permanent data storage I'm not sure what is the best...
Saving data from kernel module into userspace
1,461,317,772,000
I have this error that flooding my syslog every day. As a solution on arch linux forum is hpet=disable in kernel command line, but I think it is a bad idea and I searching for another solution. Is there any other?
Yes, I had the same issue on the same machine. Applied below option and now the dmesg is not showing that error anymore. From here: https://bbs.archlinux.org/viewtopic.php?id=124908 Try to disable hpet with hpet=disable via the kernel command line. It will fall back to a less nice (but not seemingly broken) clocksour...
kernel: hpet1: lost 19 rtc interrupts
1,461,317,772,000
When I do cat /proc/interrupts on my multicore x86_64 desktop PC (kernel 3.16) I see this: 0: 16 0 IO-APIC-edge timer LOC: 529283 401319 Local timer interrupts When I do cat /proc/interrupts on my multicore x86_64 laptop (kernel 3.19) I see this: 0: 1009220 0 IO-APIC-ed...
Under your apparently x86_PC architecture : IRQ 0 is the interrupt line associated to the first timer (Timer0) of the Programmable Interval Timer. It is delivered by the IO-APIC to the boot cpu (cpu0) only. This interrupt is also known as the scheduling-clock interrupt or scheduling-clock tick or simply tick: If the ...
What is the difference between Local timer interrupts and the timer?
1,461,317,772,000
As you can see below, nvidia is sharing the intrerrupt and the interrupt is using only CPU0, how can I change the interrupt for nvidia, and how can I make it use both CPU's ? Here is an article describing the second question, I can change between CPU0 and CPU1 by modifing smp_affinity, but did not understand how can I...
You're barking up the wrong tree. Having the interrupts go to both CPUs would make performance worse, not better. For one thing, it would mean the software decoder would constantly be interrupted. For another, it would mean the interrupt code would be less likely to be hot in cache. There are many other reasons this w...
change interrupt smp_affinity
1,461,317,772,000
Please comment on the following sentence: On the standard Linux kernel without the rt patch, interrupts can't interrupt ongoing system calls. The reason why our machine doesn't stop working when data is fetched from the hard disk is because the system call we used for that operation is blocking. Blocking means ...
System calls can be interrupted through the use of signals, such as SIGINT (generated by CTRL+C), SIGHUP, etc. You can only interrupt them by interacting with the system calls through a PID, however when using Unix signals and the kill command. rt_patch & system calls @Alan asked the following follow-up question: Is ...
Can system calls be interrupted?
1,461,317,772,000
I've added some keyboard shortcuts in my Zsh to enable selecting words. In order for the selection to do something, I would like to use Ctrl + C to copy it. However I would also like to use Ctrl + C to interrupt programs, when the Zsh Line Editor (ZLE) isn't active. Is this possible and how can I do this? I tried to d...
The following code allows us to use the usual shortcuts Ctrl + X, Ctrl + C, Ctrl + V to cut/copy/paste, to both Zsh's as well as X.org's clipboard. Ctrl + C functions as interrupt as usual, when we aren't in ZLE. To do this, we insert our hook into Zsh's precmd_functions & preexec_functions, to know when we start edit...
Copying text with Ctrl + C when the Zsh line editor is active
1,461,317,772,000
/proc/softirq is softirq stats. Is /proc/interrupt both hard and soft interrupts or hard only? I want to measure the rate of hard and soft irq's per second roughly using watch -n 1 grep 'foo' /proc/softirq and watch -n 1 grep 'bar' /proc/interrupt so I can compare the rate of hardware interrupt increase to software in...
softirqs aren't directly related to hardware interrupts, they're the successor to "bottom halves" and the predecessor of tasklets. The (old) Unreliable Guide to Hacking the Linux Kernel has a brief section on the topic; I dare say there are better resources elsewhere. The list of softirqs is defined in include/linux/i...
What is the difference between /proc/interrupts and /proc/softirq in Linux?
1,461,317,772,000
Who raises this softirq? Is it raised on every time tick( based on timer interrupt?) Does this make the kernel to shedule a runnable process? If yes, how does the handlers of lower priority softirqs (HR_TIMER,RCU_SOFTIRQ) run since the execution is now process context(after a schedule ())?
According to kernel documentations: Software Interrupt Context: Softirqs and Tasklets Whenever a system call is about to return to userspace, or a hardware interrupt handler exits, any 'software interrupts' which are marked pending (usually by hardware interrupts) are run (kernel/softirq.c). Much of the real ...
What is the functionality of SCHED_SOFTIRQ in linux?
1,461,317,772,000
I have an m1.small EC2 instance that is mostly just running Apache as a web server for several simple PHP web sites (that use RDS as a database). The server is constantly with a very high load average - around 8, and never below 5. This causes my web sites to be annoyingly slow, much more then I'd expect from a suppos...
After looking at it for a while, this seems like a "hardware issue" - most likely the physical server hosting the VM is under heavy load from other VMs, and the m1 type machines do not get guaranteed performance, so you get whatever CPU time is left on the host. Worse, if your VM is running on CPU core 0, you also get...
Why EC2 instance spends all its time in "IRQ" and what to do about it?
1,461,317,772,000
What are the main stacks in Linux? What I mean is, for example when an interrupt occurs what stack will be used for it, and what is the difference between user process and kernel process stacks?
This is highly platform-specific. Unless you bind to a certain platform (even difference between x86-32 and x86-64 is principal), one can't answer this. But, if to limit it to x86, according to your last comment, I could suggest some information. There are two main styles of service request ("syscall") from user land ...
Main stacks in Linux
1,461,317,772,000
I have a lot of files in a directory: $ ls file000001 file000002 # ... truncated ... file999999 I am calculating the md5sum of the files like this and finally dumping it to a file: hashes='' for file in $(ls); do hashes+=$(md5sum $file) hashes+="\n" done echo "$hashes" > hashes.txt Now, I would like to press Ct...
trap break INT before your loop: hashes= trap break INT for file in *; do hashes+=$(md5sum -- "$file")$'\n' done trap - INT echo "$hashes" > hashes.txt I've corrected some dubious stuff in your script ($(ls), "\n"). FWIW, such a "nonlocal break" doesn't work in mksh or yash, but it does in bash, dash, zsh and ksh9...
Dump contents of variable to file while script is running in bash
1,461,317,772,000
Playing aroud looking at /proc/interrupts The output below shows ERR and MIS on lines 26 and 27 respectively. What are these and why do they have counts (albeit of zero) for CPU0 but no others, as well as no description? Am I right to think they're actually to do with if the PIC errors itself? Thanks ErikF for the rep...
You are correct: they relate to the IO-APIC system. ERR is documented in the kernel documentation in Documentation/filesystems/proc (lines 677-680): ERR is incremented in the case of errors in the IO-APIC bus (the bus that connects the CPUs in a SMP system. This means that an error has been detected, the IO-APIC ...
Regarding /proc/interrupts what are MIS and ERR?
1,461,317,772,000
Why does a system call table exist and not just appended to the interrupt vector table? I don't understand the design choice here. If it improves performance to differentiate events, why not system calls then?
I haven’t looked into the historical context behind the use of a single interrupt (0x80) for system calls on i386, there are a few reasons not to use separate software interrupts for individual system calls. The number of software interrupts is limited, which constrains the number of system calls (and on x86, a numbe...
Why does a system call table exist and not just appended to the interrupt vector table?
1,461,317,772,000
I was reading a textbook which describes how to deal with system call when interrupted: System calls can be interrupted. System calls such as read, wait, and accept that can potentially block the process for a long period of time are called slow system calls. On some older versions of Unix, slow system calls that are...
On Linux, yes, it is always safe to restart a system call which returned with EINTR: that return value means that the system call was interrupted before it made any useful progress, and should be restarted. The system call’s implementation takes this into account. Cases where the system state has changed because of th...
Is it safe to restart system calls?
1,461,317,772,000
What does it mean when threads are time-sliced? Does that mean they work as interrupts, don't exit while routine is not finished? Or it executes one instruction from one thread then one instruction from second thread and so on?
Time-sliced threads are threads executed by a single CPU core without truly executing them at the same time (by switching between threads over and over again). This is the opposite of simultaneous multithreading, when multiple CPU cores execute many threads. Interrupts interrupt thread execution no matter of technolog...
Threads vs interrupts
1,461,317,772,000
I have a bunch of log files and I want to do a tail -f on them in a loop such that when I press Ctrl-C, the current tail -f gets killed and I proceed to the next log file: for log in *.log; do printf '%s\n' "Tailing log '$log'; press Ctrl-C to skip to the next" tail -f "$log" done The issue is that pressing C...
Put trap ":" SIGINT before the loop. This makes the shell ignore the signal. But just in the sense that it executes a dummy command, not "ignore" in the signal handler sense. Because the shell process does not block this signal (from the kernel perspective) it gets through to its child processes (like tail in this ex...
How to restrict interrupt signal to just the child process?
1,461,317,772,000
From the bash time command on different stock Ubuntu systems (both real hardware and VMs) all with CONFIG_HZ=250, I'm sometimes getting real 0m0.001s, user 0m0.001s or sys 0m0.001s as well as any other number of milliseconds. How is this possible ? Edit: I admit the elapsed (real) time can be computed exactl...
As you can read from some code #if defined (HAVE_GETRUSAGE) && defined (HAVE_TIMEVAL) && defined (RUSAGE_SELF) ... getrusage (RUSAGE_SELF, &self); ... print_timeval (stdout, &self.ru_utime); ... #else # if defined (HAVE_TIMES) ... times (&t); print_clock_t (stdout, t.tms_utime); ... Depending on HAVE_GETRUSA...
How can the time command compute one millisecond from 4 ms timer ticks?
1,461,317,772,000
(This is in the context of x86-64 Linux.) I am trying to write a high-reliability userland executable, and I have total control over the generated assembly. I don't want to rely on automatic stack allocation, so I would like to put the stack in a known location. Suppose I have calculated that my program uses at most 4...
Is it safe to allocate 414 bytes in the .bss section and point RSP to the top? Since you’re controlling all the content of your executable, and presumably not linking to any libraries, this should be fine. Notably, the MAP_STACK mmap flag currently has no effect, any readable and writable page can be used for the st...
Is it safe to use the .bss section as a static stack?
1,461,317,772,000
If we add a device that does not support PNP (Plug-an Play), the manufacturer will hopefully provide explicit directions on how to assign IRQ values for it. However, if we don't know what IRQ value to specify, what command line should be used to check if a IRQ value is free or not? lsdev displays info about devices: ...
Looking at the man page for lsdev there is this comment: This program only shows the kernel's idea of what hardware is present, not what's actually physically available. The output of lsdev is actually just the contents of the /proc/interrupts file: excerpt from man proc /proc/interrupts This is used to...
How to know if an IRQ value is free to use
1,461,317,772,000
People often hit Ctrl + c or Ctrl + z to cancel or abandon the job if the process gets sluggish, in this case which of these signals get processed, the first one or the last one? is each signal processed? if not, then which ones are ignored?
The signals are sent in the order that you type them via the terminal to the kernel. If you use Ctrl+C you're instructing the kernel to send the signal SIGINT, to the foreground process group. Upon receiving this, the command that was running will be terminated. With a Ctrl+Z you're sending the signal SIGSTP. Which do...
What happens to the signals requested recursively?
1,461,317,772,000
According to the POSIX standard regarding signals (see "Standard signals" section), both SIGKILL and SIGINT have as default action Term. However, this seems not to be the case when the receiving process has been stopped via SIGSTOP (or SIGTSTP). For the sake of simplicity, let's say I create a program with an infinite...
SIGKILL will terminate a process by default and cannot be blocked, whereas SIGINT will terminate a process by default but can be blocked. Since you moved the process to the background with CtrlZ (SIGTSTP), the SIGINT signal will be blocked and will only be delivered to the process after it resumes its execution (SIGCO...
Why does SIGINT not terminate a stopped process?
1,461,317,772,000
I would like to know more about Top half and Bottom Half processing in the Context on Interrupts. Could someone explain me the exact things happening in both scenarios.
Chapter 6 of "Linux Kernel Development" by Robert Love explains it, as do these free web resources: Linux Kernel Module Development Guide linuxdriver.co.il Linux Device Drivers Basically, the top half's job is to run, store any state needed, arrange for the bottom half to be called, then return as quickly as possibl...
What happens in the Top half and Bottom Half processing of Interrupts?
1,461,317,772,000
I have a kernel module with netfilter hooks at different points in the packet route, and the hooks use shared resources. In addition, the module has a char device that may be written to, that also affects these resources. I am not sure if I need to use locks when different handlers access these resources. I read that ...
Depending on what you've written and what data structures it uses, it's hard to say, but: I read that interrupts can't sleep, does that mean I am guaranteed that my handlers (hooks and read handlers) will be executed one after the other, or do I need to use locks to prevent simultaneous access to the same resources f...
Resource locking in interrupts
1,461,317,772,000
I am trying to test the NAPI functionalities on embedded linux environment. I used 'pktgen' to generate the large number of packets and tried to verify the interrupt count of my network interface at /proc/interrupts. I found out that interrupt count is comparatively less than the packets generated. Also I am trying to...
I wrote a comprehensive blog post about Linux network tuning which explains everything about monitoring, tuning, and optimizing the Linux network stack (including the NAPI weight). Take a look. Keep in mind: some drivers do not disable IRQs from the NIC when NAPI starts. They are supposed to, but some simply do not. Y...
How to test linux NAPI feature?
1,461,317,772,000
If I run mysqld from the command line, it displays some startup messages, and then stops responding. It doesn't produce output, and ignores any input, and there seems to be no way to get rid of it. ctrl+z and ctrl+c don't do anything, there is no way to get back to a terminal - I have to start a new session. This mean...
Ctrl+Z is actually a feature of the generic terminal interface in the kernel, not of bash. It causes a SIGTSTP signal to be sent to the foreground process. Likewise Ctrl+C sends SIGTERM and Ctrl+\ sends SIGQUIT. There are two ways in which a program can cause Ctrl+Z to lose its effect. The program can ignore the SIGT...
How to interrupt uninterruptible program?
1,461,317,772,000
I have irq/21-xhci-hcd displayed as the process consuming 90% CPU on top. There was also a lot of CPU time spent on servicing software interrupts (si). This is on embedded Linux. Does this mean that it's IRQ 21? Can I then use lspci -vvv to get more info on IRQ 21? If that's not the case, do I need to use other method...
xhci stands for eXtensible Host Controller Interface which is standard for USB 3.0 "SuperSpeed" host controller hardware. irq/21-xhci-hcd is likely to represent the irq associated to one particular usb bus. (Which can host several different usb devices) lsusb -t utility should give you more information (and lsusb -vt ...
How to get more details on irq process in top?
1,461,317,772,000
$ bash -c "trap \"echo INT\" INT; sleep 3" & pid=$!; sleep 1; kill -INT $pid; wait [1] 27811 INT [1]+ Done bash -c "trap \"echo INT\" INT; sleep 3" $ (bash -c "trap \"echo INT\" INT; sleep 3" & pid=$!; sleep 1; kill -INT $pid; wait) Can you explain why the SIGINT handler doesn't get invoked in th...
Job control refers to the protocol for allowing a user to move between multiple process groups (or jobs) within a single login session. https://www.gnu.org/software/libc/manual/html_node/Job-Control.html Generally it's enabled in interactive shells, and disabled in non-interactive ones: $ echo $-; sleep 1 & fg himBH...
Setting a trap for INT doesn't work in a subshell
1,461,317,772,000
From assembler point of view, when we make a code that just jumps a few commands back, does not jump to any control function that sheduler might use, how can unix interrupt such a code? I assume it is using timer and interruptions. So the question is then can we implement unix system on a hardware without interruption...
What you discuss is the difference between non-preemptive and preemptive scheduling. non-preemptive (also called cooperative) is a bit simpler (no timer needed), and it does not need locks when threads communicate. Examples Apple Mac OS9 and earlier, I think early MS-Windows, many embedded systems, and micro-threads. ...
infinite loop VS sheduler
1,461,317,772,000
I have written a set of programs with the intent of using a radio transmitter-receiver (NRF24L01) to connect two devices as if they were connected via a serial interface. Currently, i am able to send bash commands in one direction, lets say from device A to B. My A device is currently an AVR microcontroller. My B dev...
The easiest approach is probably to have your program use pipe2 three times to create three pipes (for each of stdin, stdout, and stderr). Probably you want them in non-blocking mode. Then fork, and have the child use dup2 to put the pipes into file descriptors 0, 1, and 2. The child then uses one of the exec family t...
Writing and Executing Program to behave like console
1,461,317,772,000
I'm trying to setup a device tree source file for the first time on my custom platform. On the board is a NXP PCA9555 gpio expander. I'm attempting to setup node for the device and am a bit confused. Here is where I'm at with the node in the dts file: ioexp0: gpio-exp@21 { compatible = "nxp,pca9555"; r...
Read section 2 in this: Specifying interrupt information for devices ... 2) Interrupt controller nodes A device is marked as an interrupt controller with the "interrupt-controller" property. This is a empty, boolean property. An additional "#interrupt-cells" property defines the number of cells needed to specify ...
Confusion regarding #interrupt-cells configuration on PCA9555 expander
1,472,897,402,000
I need to write a program to react to the modem control lines changing in the serial port on my FreeBSD 10.3 machine. I don't want to read any data from it (there won't be any). I'm aware I can configure the port to raise (in my instance) IRQ4 when this happens, but how could my program pick up on the interrupt? Do I ...
As it is for a UPS, I imagine you can afford to poll the modem signals every 10 seconds or so (from freebsd tty(4)): int state; if(ioctl(fd, TIOCMGET, &state)...) if(state & TIOCM_DTR)... However, if you want to be notified immediately of changes in exactly one modem signal, namely DCD, you can set the tty flags to c...
Hook serial port interrupt in FreeBSD
1,472,897,402,000
I know that an interrupt is a signal sent to a kernel asking for handling. In some cases we have a physical device like a keyboard with a driver that connects a process with an interrupt(key pressed). But what about timers or other things that don’t have a physical device. Maybe I have wrong thoughts about this all, a...
From one standpoint : whatever piece of code (microcodes included) running under a Linux system is running as a more or less immediate consequence of some hardware interrupt. From the opposite standpoint : No hardware interrupt will immediately run anything else than kernel's internal cooking inside its hardware inter...
How is the process programmatically connected to an interrupt?
1,472,897,402,000
Operating System Concepts says: During I/O, the various device controllers raise interrupts when they are ready for service. These interrupts signify that output has completed, or that input data are available, or that a failure has been detected. Are interrupts used to signify that output is ready or input has co...
that output has completed, or Are interrupts [also] used to signify that output is ready? Yes. Consider writing to a serial port device. The device has a receive buffer called a FIFO, to store a small amount of data e.g. 16 bytes. There may be an interrupt both when the buffer falls empty, and output is complet...
Are interrupts used to signify that output is ready or input has completed?
1,472,897,402,000
When I run the command: sudo lspci -vvv, I see the following among the output: 0c:00.0 Network controller: Broadcom Corporation BCM4311 802.11b/g WLAN (rev 01) Subsystem: Dell Wireless 1390 WLAN Mini-Card Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR+ FastB2B- DisI...
The original PCI had four dedicated interrupt pins, INTA to INTD. IIRC, across the motherboard they would wire them in a rotated manner so if every card used INTA they still wouldn't be the same physical lines. Anyway, in PCI-e, these legacy interrupts are emulated with a specific packet type; there are no dedicated l...
What does this mean: "Interrupt: pin A routed to IRQ 17"
1,472,897,402,000
I mistakenly broke my pop-OS and when I restart it then I get an error window with **Error occured which system cannot restored. Contact administrator** I already tried apt-get dist-upgrade in recovery but it shows error shown in . I tried several suggestions but am not able to upgrade it because of this error. ...
I resolved this issue as I got an error that the following packages have unmet dependencies which we can see in the above picture so I simply download those dependencies by entering command sudo apt install libavfilter7:i386 and I was able to get rid of that problem.
Broken my pop-OS while upgrading