date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,551,884,463,000
I'm writing a script to execute after a new installation of Minimal Ubuntu(mini.iso) to install all the software I need and sync the dotfiles I backed up previously. What's the best way to avoid errors? Install the software and after do the sync of the dotfiles within my /home folder or the contrary? Thanks!
I have been doing the opposite, I install the OS then install packages using APT / snapd then copy dotfiles. Try it first on a VM to check what might break when installing a newer OS (or newer package versions) and re-using your existing dotfiles. Sometimes the conf file syntax may have changed, but then I would look...
Should I install softwares first or sync the dotfiles on new Ubuntu install? [closed]
1,551,884,463,000
I'm debating whether I should switch from Windows to Linux and I've decided that if I do, I'll be using Arch Linux (most likely manjaro specifically). Mainly because I don't want to have to deal with: "5 years of free security and maintenance updates" (correct me if I'm wrong) The problem is that the "rice" that I w...
From the wikipedia: In Unix-like operating systems, any file or folder that starts with a dot character (for example, /home/user/.config), commonly called a dot file or dotfile, is to be treated as hidden – that is, the ls command does not display them unless the -a flag (ls -a) is used. In most command-line ...
Are Ubuntu dotfiles compatible with Arch dotfiles?
1,551,884,463,000
In my deployment script I have such as code to exclude certain files. shopt -s extglob mv !(deploy.sh|file1|file2) ~/$public It works almost well but ignores hidden files so they are not moved. How to improve the code to move hidden files too?
There is a dotglob option in bash exactly for this purpose: $ touch file1 file2 .file $ ls !(file1) file2 $ shopt -s dotglob $ ls !(file1) .file file2
Excluding certain files from moving but move hidden ones too
1,551,884,463,000
So my trusty Linux box died after 10 years of faithful service. The memorial will be Friday afternoon. Anyway, I am moving to a Mac (lesser of two evils - a Win 10 machine was the other option), and I don't think I want to run Linux on it directly - I booted with a live cd of Mint 18 and the video resolution was won...
In OS X, there is a hidden directory ~/Library, whose subdirectories will contain that kind of user settings. This is for historical reasons: it is similar to pre-OS X versions of MacOS used to do. Here is a MozillaZine KB article that has the exact paths for Firefox on Windows, Linux and Mac: http://kb.mozillazine.or...
Migrate from Linux Mint to OS X [closed]
1,551,884,463,000
I keep my dotfiles in a private git repo on bitbucket and this works great for the majority of my files (.vimrc, .tmux.conf etc) then I just set up symlinks from my home directory to my cloned gitrepo of dotfiles and everything works great. My problem is that I also use the prezto framework to manage zsh plugins. Pre...
You can use a hardlink in this instance, presuming you are not crossing file system boundaries. In case you are unaware, a hardlink is much like a symlink, but from a process perspective the file is a normal file. This includes git, which will properly work with them and archive them as normal files with content and...
Git tracking dotfiles that are symlinked
1,551,884,463,000
The context of this question is the hg-ssh script. It is helpful but not critical to know something about Mercurial. This script sets up a forced command using public keys so the given public key setup on the server will only allow the owner of the corresponding private key to push to a permitted set of repositories o...
For recursive matching, the right tool is often find. Since you want to match all files in the current directory and its subdirectories recursively, but only down to a certain depth, specify -maxdepth. This isn't in POSIX, but exists on all current *BSD and in GNU find (Linux, Cygwin) and in Busybox (embedded Linux) s...
restricting pushes to selected Mercurial repositories using `ssh` forced commands and `hg-ssh`
1,551,884,463,000
I would like to symlink my emacs init.el into a dotfiles repo - located at ~/Documents/Dotfiles. However, when I attempt to do so the command fails even though my prompt doesn't return an error - ls -la doesn't show a link there. For example, I might do the following: ln -s ~/.emacs.d/init.el ~/Documents/Dotfiles/.em...
As far as I can see, in my case this happens when the target link has directories which doesnt exist. Try this: File should exist: file /Users/Chris/.emacs.d/init.el Remove previous symbolic link if present: rm /Users/Chris/Documents/Dotfiles/.emacs.d/init.el Now create needed directories: mkdir -p /Users/Chris/Docu...
Symlinking `init.el` in
1,551,884,463,000
I would like to backup config files (hidden, starting with a dot) with duplicity. Only files, no directories. The following command duplicity --include '/home/foo/.*' --exclude '/home/foo/**' /home/foo sftp://myserver/backup --dry-run backups everything starting with a dot, thus config directories are also included....
katonag, try to add --exclude '/home/foo/.*/' or --exclude '/home/foo/.*/**' in the beginning eg. --exclude '/home/foo/.*/' --include '/home/foo/.*' --exclude '**' . duplicity tests in/exclude by given order. so the above translates to - /home/foo/.*/ + /home/foo/.* - ** where the first matches .folder but not the ....
Backup only hidden (dot) files with duplicity
1,699,187,920,000
(If the score of this question is 72, please don't upvote!) I ran this: cat /usr/bin/* | perl -ne 'map {$a{$_}++} split//; END{print map { "$a{$_}\t$_\n" } keys %a}' | grep --text . | sort -n | plotpipe --log y {1} and got this: (Even with a log y-axis it still looks exponential! There is more than 100x between ...
That would be the 64 bit operand size prefix of amd64 machine code instructions. You'll notice it only happens on amd64 executables. If you compare on the /bin/* of http://ftp.debian.org/debian/pool/main/c/coreutils/coreutils_9.1-1_arm64.deb, http://ftp.debian.org/debian/pool/main/c/coreutils/coreutils_9.1-1_amd64.deb...
Why is 'H' / 72 / 0x48 the second most common byte in executables?
1,699,187,920,000
I've seen discussion before about ELF magic, most recently the comments in this Security stack exchange question. I've seen it mentioned before, and I've seen it in my own boot logs.. But I'm not sure what it is. The man page on elf is a bit over my head, as I don't do C or lower level languages. As someone who uses ...
Right from the man page you reference: elf - format of Executable and Linking Format (ELF) files ELF defines the binary format of executable files used by Linux. When you invoke an executable, the OS must know how to load the executable into memory properly, how to resolve dynamic library dependencies and then where...
What is ELF Magic?
1,699,187,920,000
I have found the term "LSB executable" or "LSB shared object" in the output of the file command in Linux. For example: $ file /bin/ls /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=4637713da6cd9aa30d1528471c...
“LSB” here stands for “least-significant byte” (first), as opposed to “MSB”, “most-significant byte”. It means that the binary is little-endian. file determines this from the sixth byte of the ELF header.
What does "LSB" mean when referring to executable files in the output of /bin/file?
1,699,187,920,000
Given a 2.6.x or newer Linux kernel and existing userland that is capable of running both ELF32 and ELF64 binaries (i.e. well past How do I know that my CPU supports 64bit operating systems under Linux?) how can I determine if a given process (by PID) is running in 32- or 64-bit mode? The naive solution would be to ru...
If you want to limit yourself to ELF detection, you can read the ELF header of /proc/$PID/exe yourself. It's quite trivial: if the 5th byte in the file is 1, it's a 32-bit binary. If it's 2, it's 64-bit. For added sanity checking: If the first 5 bytes are 0x7f, "ELF", 1: it's a 32 bit ELF binary. If the first 5 bytes...
Determine if a specific process is 32- or 64-Bit
1,699,187,920,000
Whenever I run file on an ELF binary I get this output: [jonescb@localhost ~]$ file a.out a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped I'm just wondering what changed in Linux 2.6.9 that this binary coul...
glibc has a configure option called --enable-kernel that lets you specify the minimum supported kernel version. When object files are linked with that glibc build, the linker adds a SHT_NOTE section to the resulting executable named .note.ABI-tag that includes that minimum kernel version. The exact format is defined i...
Why does the file command say that ELF binaries are for Linux 2.6.9?
1,699,187,920,000
I'm trying to learn more about library versioning in Linux and how to put it all to work. Here's the context: -- I have two versions of a dynamic library which expose the same set of interfaces, say libsome1.so and libsome2.so. -- An application is linked against libsome1.so. -- This application uses libdl.so to dynam...
This doesn't exactly answer your question, but... First of all, ELF is the specification use by Linux for executable files (programs), shared libraries, and also object files which are the intermediate files found when compiling software. Object files end in .o, shared libraries end with .so followed by zero or more ...
Linux, GNU GCC, ld, version scripts and the ELF binary format -- How does it work?
1,699,187,920,000
I have an executable binary; let's call it a.out. I can see the binary contains strings $ strings a.out ... /usr/share/foo .... I need to change the string /usr/share/foo to /usr/share/bar. Can I just replace the string with sed?: sed -i 's@/usr/share/foo@/usr/share/bar@' a.out This looks like a safe thing to do. Wi...
I don't know if your version of sed will be binary-clean or if will choke on what it thinks are really long lines in its input, but barring those issues, editing the string in-place should work. To see whether it does, compare the old and new versions with cmp -l. It should tell you whether or not the only three diffe...
When can I edit strings in an executable binary?
1,699,187,920,000
What I already know: An ELF executable has a number of sections, obviously the .text and .data sections get loaded into memory as these are the main parts of the program. But for a program to work, it needs more info, especially when linked dynamically. What I'm interested in are sections like .plt, .got, .dynamic, .d...
The following is a really good reference: http://www.ibm.com/developerworks/linux/library/l-dynamic-libraries/. It contains a bibliography at the end of a variety of different references at different levels. If you want to know every gory detail you can go straight to the source: http://www.akkadia.org/drepper/dsoho...
Which parts of an ELF executable get loaded into memory, and where?
1,699,187,920,000
I want to find file types that are executable from the kernel's point of view. As far as I know all the executable files on Linux are ELF files. Thus I tried the following: find * | file | grep ELF However that doesn't work; does anybody have other ideas?
Later edit: only this one does what jan needs: thank you huygens; find . -exec file {} \; | grep -i elf
How to find executable filetypes?
1,699,187,920,000
Is it possible to check if given program was compiled with GNU gprof instrumentation, i.e. with '-pg' flag passed to both compiler and linker, without running it to check if it would generate a gmon.out file?
You could check for references to function mcount (or possibly _mcount or __mcount according to Implementation of Profiling). This function is necessary for profiling to work, and should be absent for non-profiled binaries. Something like: $ readelf -s someprog | egrep "\s(_+)?mcount\b" && echo "Profiling is on for so...
Detect if an ELF binary was built with gprof instrumentation?
1,699,187,920,000
I'm studying the ELF specification (http://www.skyfree.org/linux/references/ELF_Format.pdf), and one point that is not clear to me about the program loading process is how the stack is initialized, and what the initial page size is. Here's the test (on Ubuntu x86-64): $ cat test.s .text .global _start _start: mov ...
I don't believe this question is really to do with ELF. As far as I know, ELF defines a way to "flat pack" a program image into files and then re-assemble it ready for first execution. The definition of what the stack is and how it's implemented sits somewhere between CPU specific and OS specific if the OS behaviour...
How does the ELF loader determine the initial stack size?
1,699,187,920,000
With two files, one compiled and linked with gcc and the other manually with nasm and ld I get ELF 32-bit LSB shared object ... ELF 32-bit LSB executable ... What's the difference between these two things? I can see with readelf -h that one is Type: DYN (Shared object file) Type: EXEC (Executable file) I can see ...
It seems this has something to do with Position Independent Executable (PIE). When GCC compiles executable by defaults it makes them PIE which changes the output flag on the ELF Header to ET_DYN. You can disable the generation of PIE executables with gcc -no-pie If you're seeing this check the default options gcc i...
What is the difference between "LSB executable" (ET_EXEC) and "LSB shared object" (ET_DYN)?
1,699,187,920,000
I compiled a small C program (2 lines of codes) with gcc to try to understand ELF file format. Doing a readelf -h on the object file, I have in the header : OS/ABI: UNIX - System V I am using Fedora, so why isn't it Linux instead ? Edit: I compiled int main(){ int x = 0; x++; } wit...
There are few differences between ELF executables on different platforms. “UNIX - System V” is the common ground; System V is where the ELF format came from. The corresponding numerical value is 0. This value indicates that the executable doesn't use any OS-specific extension. Debian GNU/Linux, at least, configures GC...
Why does readelf show "System V" as my OS instead of Linux?
1,699,187,920,000
I'm trying to decrease a Linux image running SuSE, and thought about running strip on all of the system's executables. Even though I may not re-gain much disk space this way, would there be any harm in doing so?
It's not the case for Linux (just checked...), but on other systems (such as BSDs, e.g., OSX) doing this will remove any setuid/setgid permissions as a side-effect. Also (still looking at OSX), the ownership of the file may change (to the user doing the writing). For Linux, I recall that early on, stripping a shared ...
What harm would there be in running strip on all files?
1,699,187,920,000
When I use strace to examine a program, I often have a hard time finding where the syscalls from the dynamic loader end and the syscalls from the program begin. The output from strace ./hello where hello a simple hello world C program is 36 lines. Here's a sample: execve("./hello", ["./hello"], 0x7fffb38f4a30 /* 73 va...
On x86_64 the main program starts just after arch_prctl(ARCH_SET_FS) and a couple of mprotect()s, so you can sed 1,/ARCH_SET_FS/d on the strace's output. A trick you can use on all platforms is to LD_PRELOAD a small library which overides __libc_start_main() and does a pointless system call like write(-1, "IT_STARTS_H...
Can I skip syscalls made by the dynamic loader in strace?
1,699,187,920,000
I've been doing an exersice in attempt to understanding some of what's going on under the hood of a program. I wrote a small C program, and compiled it on i386 Linux (Ubuntu 12.04) using gcc. I then did a hexdump -C on the output to text file. I noticed that there were some gaps on the offset with an *: 00000670 0...
Like in the standard od command or hd, it means all the elided lines are the same as the preceding line. You can pass -v to make it display those lines anyway. From hexdump(1): The -v option causes hexdump to display all input data. Without the -v option, any number of groups of output lines, which would be identica...
What does `*` mean using hexdump -C?
1,699,187,920,000
A minimal ELF executable only requires the ELF header and at least one program header in order to be functional. However, when I run strip on a short executable, it decides not to throw out the section header table or the section strings section, keeping them around although they have no purpose (as far as I know) for...
The documentation for GNU binutils strip alludes to the reason, but is not explicit, mentioning in the description of --only-keep-debug that Note - the section headers of the stripped sections are preserved, including their sizes, but the contents of the section are discarded. The section headers are preserved so tha...
Why doesn't `strip` remove section headers from ELF executables?
1,699,187,920,000
When I'm on my Linux Box I use bash as a shell. Now I wondered how bash handles the execution of an ELF file, that is when I type ./program and program is an ELF file. I grepped the bash-4.3.tar.gz, there does not seem to be some sort of magic number parser to find out if the file is an ELF nor did I find an exec() sy...
Bash knows nothing about ELF. It simply sees that you asked it to run an external program, so it passes the name you gave it as-is to execve(2). Knowledge of things like executable file formats, shebang lines, and execute permissions lives behind that syscall, in the kernel. (It is the same for other shells, though th...
How does bash execute an ELF file?
1,699,187,920,000
On every loading of a lib, I get the error: no version information available This lib has been compiled on another PC (ubuntu 10.04) than the one running it (mandriva 2010.2). $ ldd /usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd-2.21.so /usr/local/gnu-eabi-4.5.2/i686-pc-linux-gnu/arm-eabi/lib/libbfd...
No, it doesn't. It appears to mean that the version of libz you linked against when you compiled your program was built with different tools than the version on the madriva system you're using. The mandriva copy is missing symbol version info which was present in the copy of the libz library your program originally ...
Why does LD keep outputting "no version information available"
1,699,187,920,000
when loading a shared library in Linux system, what is the memory layout of the shared library? For instance, the original memory layout is the following: +-----------+ |heap(ori) | +-----------+ |stack(ori) | +-----------+ |.data(ori) | +-----------+ |.text(ori) | +-----------+ When I dlopen foo.so, will the memory...
The answer is "Other". You can get a glimpse of the memory layout with cat /proc/self/maps. On my 64-bit Arch laptop:: 00400000-0040c000 r-xp 00000000 08:02 1186758 /usr/bin/cat 0060b000-0060c000 r--p 0000b000 08:02 1186758 /usr/bin/cat 0060c000-0060d000 rw-p 000...
Memory layout of dynamic loaded/linked library
1,699,187,920,000
I compiled a simple "Hello World" C program on Raspberry Pi 3, which was then transferred to an AMD64 laptop. Out of curiosity, I executed it, and it runs even though I did not expect it to: $ uname -a Linux 15ud490-gx76k 6.5.0-25-generic #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2 x86_64 x86_64 x...
QEMU user emulation is exactly why your binary runs: on your system, one of the QEMU-related packages you’ve installed ensures that QEMU is registered as a handler for all the architectures it can emulate, and the kernel then passes binaries to it. As long as you have the required libraries, if any, the binary will ru...
Why can an aarch64 ELF executable be run on an x86_64 machine?
1,699,187,920,000
The NASM docs on "elf Extensions to the GLOBAL Directive" say, Optionally, you can control the ELF visibility of the symbol. Just add one of the visibility keywords: default, internal, hidden, or protected. The default is default of course. Where are these defined? and how does ld use them? I see access levels menti...
It seems from the NASM source these seem to correspond with the docs from Oracle "Linker and Libraries Guide", these seem to correspond to STV_DEFAULT, STV_INTERNAL, STV_HIDDEN, and STV_PROTECTED. Oracle says this: STV_DEFAULT The visibility of symbols with the STV_DEFAULT attribute is as specified by the symbol's b...
What are difference between the ELF symbol visibility levels?
1,699,187,920,000
In How do I extract the filesystem image from vmlinux.bin? and https://wiki.gentoo.org/wiki/Custom_Initramfs#Salvaging methods are presented for getting and unpacking an embedded initramfs/initrd included in the kernel image. Now I would like to insert the modified file system (cpio + possibly packed using e.g. lzma) ...
As mentioned in the answer to a similar question about replacing ELF sections discussed at reverseengineering.se simply using dd might be enough under some circumstances apart from the new archive not being larger, e.g. whether there are relocations.
Repack the filesystem image from vmlinux.bin (embedded initramfs) without rebuilding?
1,699,187,920,000
I'm trying to understand how does symbol tables relate to the .data section in ELF. First some assumptions that I'm using as ground to start with. A symbol is a human readable (or "as written in the source file") representation of a function or a variable that is mapped to the actual binary value (that the CPU ...
The .data section contains the data itself, i.e. the four bytes which hold the int value 5. The .symtab section contains the symbols, i.e. the names given to various parts of the binary; the var_global_init symbol name points to the four bytes of storage in the .data section. That’s why you only see one entry: there i...
Symbol table in the .data section of ELF
1,699,187,920,000
;TL-DR - Answer: because the dynamic linker ld-linux-x86-64.so.2 was missing. I have mounted a squashfs (shouldn't matter) filesystem -ro,loop at /mnt/foo. It contains among other things the following (/mnt/foo is the mount point): -rwxr-xr-x 1 root root 110088 jan 17 2013 /mnt/foo/bin/ls -rw-r--r-- 1 root ...
The problem is /bin/ls don't just need the shared libraries, which you provided. It also needs the program that loads them; the linux loader. To solve your problem you can copy the loader from your system (usually /lib/ld-linux.so.2) to the location of your chroot (/mnt/foo/lib/ld-linux.so.2).
Why does chroot get ENOENT on an existing file?
1,699,187,920,000
If one program, for example grep, is curretly running, and a user executes another instance, do the two instances share the read-only .text sections between them to save memory? Would the sharing of the main executable text sharing be done similarly to shared libraries? Is this behavior exhibited in Linux? If so, do o...
Unix shares executables, and shared libraries are called shared (duh...) because their in-memory images are shared between all users. I.e., if I run two instances of bash(1), and in one of them run, say, vim(1), I'll have one copy each of the bash and the vim executables in memory, and (as both programs use the C libr...
Are .text sections shared between loaded ELF executables?
1,699,187,920,000
I am trying to port Android apps to Linux (don't laugh :) and I have come across a problem. When trying to execute an Android executable (app_process) after adding the executable permission with ./app_process it says it doesn't exist although cat ./app_process works. Also in my file manager (Pantheon Files) the execut...
Android and Linux are two different operating systems. You can't just take an executable from one and run it on the other. The first hurdle is the kernel. Android and Linux are based on the same kernel, but they have a few different features. In particular, Android provides binders, which only exist in the mainstream ...
Why can't I execute Android x86 executables on Linux
1,699,187,920,000
I was working through my C programs, I am new to Linux/UNIX development and was having a look around. I created a simple C program of Hello world and was inspecting the compilation process. I tried to read the file header of the final executable and got the Output as this $ objdump -f my_output file format elf32-i386 ...
The flags in the output are BFD - Binary File Descriptors. They're part of the binutils package, you can read what the flags mean if you look in the bfd header file /usr/include/bfd.h for their meaning or here. The reference to the "flags" 0x00000112 is what's called a flag field. It's binary and each bit represents a...
Portions of the file Header
1,699,187,920,000
ERROR: type should be string, got "\nhttps://linux-audit.com/elf-binaries-on-linux-understanding-and-analysis/\nsays\n\nThe type field tells us what the purpose of the file is. There are a\n few common file types.\nCORE (value 4)\nDYN (Shared object file), for libraries (value 3)\nEXEC (Executable file), for binaries (value 2)\nREL (Relocatable file), before linked into an executable file (value 1)\n\n\nhttps://unix.stackexchange.com/a/476157/674 shows that a kernel module is REL. Why is it REL not DYN?\nWhat is the difference between DYN and REL?\nThanks.\n"
See the System V ABI, which contains the specifications of the ELF format. It says Relocation entries for different object files have slightly different interpretations for the r_offset member. In relocatable files, r_offset holds a section offset. That is, the relocation section itself describes how to modify anoth...
What is the difference between Shared object file and Relocatable file?
1,699,187,920,000
I read somewhere that (at least since Linux v. 2.6) all user-space code is placed at load address 0x8048000 in the virtual memory address space. My own observations confirm this. I have done a cat /proc/......../maps for several processes and the very first section of a process' program text always starts at '0x8048...
I admit that the following isn't a great answer, but I believe the 0x8048000 value is enshrined in the ELF Specification. See figures A.4, A.5 and A.6 in that doc. The System V ABI Intel 386 Architecture Supplement also standardizes on 0x8048000. See page 3-22, Figue 3-25. 0x804800 is prescribed as the low text seg...
Rationale for making user space text segment start at 0x8048000
1,699,187,920,000
I was wondering what are some formats of object files in Linux? There are two types of object files that I know: executable, which has ELF format object files that are generated by gcc after compilation but before linkage. what is the format of such object files? Or are they also ELF format but with some different ...
Core dumps are also object files, of a sort, and usually in ELF format, too. Running this program will probably produce a file named "core": int main(int ac, char **av) { char *p = 0; *p = 'a'; return 0; } My file command says: core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4...
Different formats of object files in Linux
1,699,187,920,000
How do I use file to differentiate between ELFves and scripts as quickly as possible? I don't need any further details, just ELF, script (/plaintext), or other/error.
If it's just between ELF and script, you may not need file at all. With bash: IFS= LC_ALL=C read -rn4 -d '' x < file case $x in ($'\x7fELF') echo ELF;; ("#!"*) echo script;; (*) echo other;; esac (-d '' (to use NUL character as delimiter) is to work around the fact that bash's read otherwise just ignores the NU...
Differentiate between ELFves and scripts quickly
1,699,187,920,000
Look at the following output snippet generated by running objdump -T on libc.so.6: 000000000009f8a0 g DF .text 000000000000001d (GLIBC_2.2.5) aio_write64 0000000000119d00 g DF .text 0000000000000034 GLIBC_PRIVATE __pread64_nocancel 000000000009aae0 g DF .text 00000000000003c0 GLIBC_2.34 pthread_rwlock_t...
See the description of the -T option: If the version is the default version to be used when resolving unversioned references to the symbol then it’s displayed as is, otherwise it’s put into parentheses. So the library provides version 2.2.5 of aio_write64, but only for backward-compatibility; there’s another version...
Why are some instances of the same version string in objdump -T enclosed in paranthesis?
1,699,187,920,000
There are at least two standards of Executable and Linkable Format (ELF), one of them System V Application Binary Interface AMD64 Architecture Processor Supplement (With LP64 and ILP32 Programming Models) Version 1.0 Tool Interface Standard (TIS) Executable and Linking Format (ELF) Specification Version 1.2 The old...
The TIS/ELF one covers ELF in general, while the System V ABI is a supplement which documents the x86_64 Application Binary Interface. The second document does not contain any information about x86_64 since the architecture didn't exist at the time it was written.
Different standards of ELF (SysV vs TIS) and Linux?
1,699,187,920,000
I have a local static variable, something like this: void function(void) { static unsigned char myVariable = 0; ... I dump the symbol table using readelf as follows: readelf -s myprogram.elf and I get the symbol table, that contains myVariable as follows: ... 409: 00412668 1 NOTYPE LOCAL DEFAULT 16 m...
That's not an artifact of readelf's output; myVariable.9751 is really that symbol's name. In order to distinguish static variables defined in different scopes/functions, the compiler has to decorate their names in some way: $ cat a.c static int var; int foo(void){ static int var; if(var++ > 3){ static ...
What is the number in readelf symbol table name?
1,699,187,920,000
As far as I can tell, prelink can only works with dynamic libraries which an executable declares it needs at compile time (the libraries that can be found with ldd). It doesn't seem to include dynamic libraries which are manually loaded by the executable, like plugins or (in my particular case) Java native libraries....
When you run prelink on an ELF binary it will only inspect the binary itself and its dependencies (as referenced in the ELF .dynamic and .dynstr sections). You should be able to use: prelink --libs-only libone.so libtwo.so [...] If one library is dependent on another you may need to specify these together on the same...
Using prelink on manually loaded libraries? (like Java native libraries)
1,613,647,156,000
I am studying ELF binary anatomy / structure and there are lots and lots of resources out there that describes what the ELF magic is. I understand the 45 4c 46 = ELF signature thing but what no source even touches on is what the 7f in 7f 45 4c 46 is. I found one source saying it's a "fixed byte", but what does that me...
This is the first byte of the ELF file. Linux has a system of "magic numbers" that are use to recognise specific file types. Apart from being helpful for the file utility, they are used by the kernel to recognise executables. The 'magic' concept has a long history, but there has been little or no correlation on specif...
ELF Magic meaning of "7f" magic number?
1,613,647,156,000
— It's known you can run x86_32 programms with x86_64 kernel if it was compiled with support for that. But dynamic linker doesn't provide any way to define a separate set of preload libraries for 32-bit programs, so every time you run such a program, had you x86_64 preloads, you would face this error message: ERROR: l...
In your ld.so.preload, you want to specify "$LIB" in your path rather than an explicit "lib" or "lib64". Thus, on a Redhat-style distro, "/usr/alternates/$LIB/libfoo.so" becomes "/usr/alternates/lib/libfoo.so" for a 32-bit process and "/usr/alternates/lib64/libfoo.so" for a 64-bit process. On an Debian-style distro, "...
ld.so.preload doesn't differ x86_32 and x86_64
1,613,647,156,000
I'm following the course of Baking Pi – Operating Systems Development. In it they created another section .init. So can we create as many sections as we want (not just .data, .bss, .text) and can we put code and data (initialized of no) in any of them?. If so, what's the purpose of sections then?
Initial research At first sight it would appear that the answer would be "no" the specification for ELF only allows the following sections. C32/kernel/bin/.process.o architecture: i386, flags 0x00000011: HAS_RELOC, HAS_SYMS start address 0x00000000 Sections: Idx Name Size VMA LMA File off A...
How many sections can I create in object file?
1,613,647,156,000
A while ago I was exploring a simple C program's ELF binary using GDB. I saw that the environment variables that are printed when I run printenv in the terminal are also present at the top of the stack of the C program's binary that I ran in that terminal. How does Bash actually execute a program and at the same time ...
A Linux program is executed using the execve system call. execve has the following signature: int execve(const char *filename, char *const argv[], char *const envp[]); The last argument, envp, is used to pass the environment to the process, as an array of strings, each of the form key=value. By convention, the same e...
How does a new process executed in Bash always has the same environment variables?
1,613,647,156,000
ERROR: type should be string, got "\nhttps://linux-audit.com/elf-binaries-on-linux-understanding-and-analysis/\nsays\n\nThe type field tells us what the purpose of the file is. There are a\n few common file types.\nCORE (value 4)\nDYN (Shared object file), for libraries (value 3)\nEXEC (Executable file), for binaries (value 2)\nREL (Relocatable file), before linked into an executable file (value 1)\n\n...\nA common misconception is that ELF files are just for binaries or\n executables. We already have seen they can be used for partial pieces\n (object code). Another example is shared libraries or even core dumps\n (those core or a.out files). The ELF specification is also used on\n Linux for the kernel itself and Linux kernel modules.\n\nWhat ELF types do kernel itself and kernel modules have?\nCould you give some examples of the files of kernel itself and kernel modules, for me to try out with file? I am using Ubuntu 18.04.\nThanks.\n"
You can find out yourself: For modules, by looking under /lib/modules/$(uname -r)/kernel/.../*.ko: $ file xfs.ko xfs.ko: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), BuildID[sha1]=bcb5e287509cedbb0c5ece383e0b97fb99e4781e, not stripped $ readelf -h xfs.ko ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00...
What ELF types do kernel itself and kernel modules have?
1,613,647,156,000
I was experimenting with how Linux allocates and protects memory. For some of my experiments, I have created a small program in C: #include <stdio.h> int gv=10; int main(){ char *v=(char*)0x601000;//0x601030 printf("gv=%p\n", &gv); scanf("%s", v); printf("You gave=%s\n", v); } After compilation (p...
I have found the problem. By filling that region with junk I had overwritten the printf's got entry, which with its final invocation caused the segmentation. So if we modify the code to: #include <stdio.h> int gv=10; int main(){ char *v=(char*)0x601000; printf("gv=%p\n", &gv); scanf("%s", v); //printf("You...
Enforced memory protection granularity (x86-64)
1,613,647,156,000
I was wondering how prelinking works. If I prelink my whole system and than delete glibc, will the system 'get up' after restart?
Well of course it won't, because you won't have a C library anymore. All prelink does is to try and calculate an optimal load address for each library so that no program will have overlapping libraries, then update the libraries so that they default to loading at that address. Then when a program is run the libraries ...
How does prelink work
1,613,647,156,000
(This is a general question and not a complaint -- there is probably a good explanation for this.) For a compiled executable, why is path to the interpreter hard-coded into the binary as opposed to letting the operating system decide? I.e shouldn't the interpreter be derivable from the executable's format (e.g ELF) an...
The attributes available in the ELF header (other than the pointer to the dynamic linker itself) aren’t sufficient to determine the appropriate dynamic linker. The dynamic linker is also tied to the C library against which the compiler was built, and thus for example a 64-bit x86 binary on Linux built using the GNU C ...
Why is path to the interpreter hardcoded in ELF executables?
1,613,647,156,000
I am trying to dump the full paths of the shared libraries that are imported by an ELF file (/usr/bin/ls) Using readelf --dyn-syms /usr/bin/ls I get the name of the libraries, but not where they are located on the filesystem: 101: 0000000000000000 0 FUNC GLOBAL DEFAULT UND [...]@LIBSELINUX_1.0 (4) Using objd...
This is what ldd is for: $ ldd /bin/ls linux-vdso.so.1 (0x00007ffd67705000) libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007f25aaab6000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f25aa8f1000) libpcre2-8.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f25aa859000) ...
ELF: Dump paths to .so files imported by binary
1,613,647,156,000
Mac OS X uses Mach-o executable format and FreeBSD Unix uses ELF executable format. OS X uses FreeBSD Unix, correct me if I'm wrong. Then why does the Executable format in OS X differ from that of FreeBSD Unix?
Very short answer: OSX combines a Mach kernel with a BSD Unix toolset and libraries. The Mach heritage (via NeXTSTEP) lead to the use of Mach-O as the executable format. See this answer for more details: https://unix.stackexchange.com/a/713/24313
Executable Format in OS X vs Executable Format in FreeBSD
1,613,647,156,000
My intent is to place the text section at a specific location in memory (0x00100000). SECTIONS { . = 0x00100000; .text : { *(.text*) } } Although the linker does do this (note the 0x01000000 Addr field): $ readelf -S file.elf There are 12 section headers, starting at offset 0x104edc: ...
It turns out that telling the linker to emulate elf_i386 produced the output that I was looking for, though I do not understand why. Namely, invoke the linker with: $ ld -melf_i386 [...] Files produced with and without -melf_i386 appear to be mostly similar: with.elf: ELF 32-bit LSB executable, Intel 80386, versio...
GNU linker producing useless spacing between sections in ELF file
1,613,647,156,000
I've noticed that strip removes ELF sections, such as .symtab and .strtab, but is there a way to force it to remove the .shstrtab section as well? I already tried the -R option but it didn't work. Strip just exits as if nothing happened. The current strip version is 2.30
If you are using the standard ELF tools, the functionality you asked for is in the mcs program that is a hard link to strip.. Use: mcs -d -n .shstrtab <object-file-name> See: http://schillix.sourceforge.net/man/man1/mcs.1.html
Remove .shstrtab with strip
1,613,647,156,000
On my MIPS box I'm trying to run a program. I use a cross compiler for mips. When I run my program, I'm getting Illegal instruction I pulled of one binary from it, called cputest. It basically prints “hello world” with some delay. Here is what readelf tells about it: readelf -a ./cputest.mips ELF Header: Magic: ...
# cat proc/cpuinfo system type: RTL8672 processor: 0 cpu model: 56322 An RTL8672 is not a full MIPS implementation, but a Lexra. You will need a customized toolchain that knows how to handle this. Something like this, or for a binary-only toolchain, look for rsdk; e.g., this.
“Illegal instruction” on a static MIPS binary
1,613,647,156,000
I'm a bit confused. I just read this: http://www.es.freebsd.org/doc/handbook/binary-formats.html, which basically says that freeBSD uses the elf binary format. But when I compile my code I using cc, I get a file called a.out. So what's going on here? Can I somehow specify in which format cc should build my code? Does...
The a.out file is still leftover from when compilers were using the a.out format. If you check the file with file a.out you will see it is actually in ELF format. To specify the name of the output file, use cc -o exec_name code.c.
How to compile to a specific executable format?
1,613,647,156,000
The coredumpctl utility displays a stack trace of the program when the coredump has been created. For example, on a firefox coredump: Stack trace of thread 14469: #0 0x00007f0ac652d3bd pthread_cond_wait@@GLIBC_2.3.2 (libpthread.so.0) #1 0x0000560f2ab95488 _ZN7mozilla6detail21ConditionVariableImpl4waitERNS0_9MutexImp...
As you correctly guess, the symbols come from the symbol information embedded in the ELF files. Some symbol information is needed to be able to do dynamic linking, even if the full symbol table is not present. As far as the actual stacktrace is concerned, when a function is called the place for the cpu to return to is...
How are stack traces reconstructed from a coredump?
1,613,647,156,000
I have an old PC with a program called atomTV, for viewing, and producing movies from molecular trajectory files. I only have a binary, and the platform it ran on was 64-bit MIPS architecture, where I was running IRIX. I have spoke with the creator, and he says he lost the source. My IRIX PC has died recently, but I s...
I think the best bet is for you to acquire another SGI machine, unfortunately. There are several open source MIPS emulators but their functionality does vary. Available emulators include: GXemul Qemu Update: Newer releases of MAME are now able to run certain releases of IRIX, emulating an Indy. Instructions are avai...
how can I run old programs from a MIPS?
1,613,647,156,000
While examining the /proc/<PID>/maps file for an aarch64 process running on an Android (8), I notice this section: 726048e000-7260564000 r-xp 00000000 103:00 5402 /system/lib64/libc++.so 7260564000-7260565000 ---p 00000000 00:00 0 7260565000-726056d000 r--p 000d6000 103:00 5402 /system/lib64/libc++.so 726056d000...
The last column of the program header table printed by readelf is the p_align member of the header, which defines an alignment requirement for the defined segment. From Linux man page elf(5): This member holds the value to which the segments are aligned in memory and in the file. Loadable process segments must have ...
LOAD segment not loaded
1,613,647,156,000
I am trying to install a binary file, and I get the output as "Cannot install binary". When I did file .bin, the output is: c64plus-imglib_2_02_00_00_Linux-x86_Setup.bin: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, stripped On my ARM machine uname -a: returns Linux overo 3.5.7 #...
You cannot. A program in binary form can only be executed in a machine with a compatible ISA (Instruction Set Architecture, see Wikipedia article). Intel maintains backward ISA compatibility in each processor generation as a newer ISA is always a superset of older ISA, and a program created for i386 will run on Penti...
How to install an Intel binary file on ARM?
1,613,647,156,000
Recently I noticed something in several ELF files which looks for me a bit suspicious under Linux. Taking for example "/bin/ls" file and running readelf on it I can see following: There are 27 section headers, starting at offset 0x213b8: Section Headers: [Nr] Name Type Address Off ...
They share the same offset because the first of the two sections in the file is empty. BSS is used to reserve space at runtime, but that space is initialised to a known default (all zero) and isn’t stored in the binary. Sections have offsets in the address space (the “address” column) and in the file (the “offset” col...
Why the same offset of two sections in ELF?
1,613,647,156,000
Consider the following truncated output from running objdump -T (Prints dynamic symbol table entries) on the GNU ls utility. /usr/bin/ls: file format elf64-x86-64 DYNAMIC SYMBOL TABLE: 0000000000000000 DF *UND* 0000000000000000 (GLIBC_2.3) __ctype_toupper_loc 0000000000000000 DF *UND* 000000000000000...
Base means that there is no version associated with the symbol, i.e. the libraries which provide the symbols don’t provide multiple versions (or in the case of symbols in ls itself, ls contains a single version). The libraries used by ls can be seen using ldd /bin/ls. See What do the multiple GLIBC versions mean in th...
What does Base in objdump dynamic symbol table mean?
1,613,647,156,000
I'm currently doing a nm like program, to print the symbols of an ELF file with their addresses and their type. The typical output is something like : $ nm ./my_exec 0000000000003d28 d _DYNAMIC 0000000000003f28 d _GLOBAL_OFFSET_TABLE_ 0000000000002000 R _IO_stdin_used w _ITM_deregisterTMCloneTab...
nm chooses the character mostly based on the section in which the symbol appears. ELF is specified in the System V ABI; pages 4-22 and following describe the symbol table, which include two fields, st_info and st_shndx, and these determine the character shown by nm. The symbol binding (ELF32_ST_BIND(st_info)) determin...
How do `nm` choose the character to print for each symbol type?
1,613,647,156,000
If the Linux kernel by itself is an ELF file, where can I find its ELF file?
On many systems you can find a compressed kernel in /boot, typically named vmlinuz-$(uname -r). The ELF executable contained therein can be extracted using the extract-vmlinux script, available in the kernel source code: extract-vmlinux /boot/vmlinuz-$(uname -r) > vmlinux The result is an ELF file: $ file vmlinux vml...
Where is the linux kernel elf file located?
1,613,647,156,000
In "Uninformed Research -- informative information for the uninformed." 2003 mentions a tool called elfsign and elfverify. This is a tool to checksum and sign an ELF binary. I can't find that tool in Debian. Does it still exist and is it maintained?
That tool seems to be written by the same author of the paper skape ([email protected]). It's withheld from Debian for licensing reasons -- currently being under "The Clarified Artistic License". The code can be found on his site, http://www.hick.org/code/skape/elfsign/
What happened to elfsign and elfverify?
1,613,647,156,000
I'm maintaining a C-program, that uses Oracle client libraries. The libraries expect the ORACLE_HOME environment variable to be set, and fail to work without it -- in many cases. In our situation, the value of the variable is always derived from the location of the shared libraries themselves anyway -- and I'd like to...
For Linux you can read and search through pseudo file /proc/<pid>/maps, where <pid> would be self from a program looking at itself. It has lines for each memory mapped item, which should include each shared library, eg 7f63c2c23000-7f63c2dd0000 r-xp 00000000 08:01 136321 /usr/lib64/libc-2.26.so See man proc for deta...
Figuring out location of a loaded shared library
1,613,647,156,000
I was reading the Rust Unstable Book, and I saw a new feature for emit-stack-sizes, The rustc flag -Z emit-stack-sizes makes LLVM emit stack size metadata. It goes on to say NOTE: This LLVM feature only supports the ELF object format as of LLVM 8.0. Using this flag with targets that use other object formats (e.g. m...
This somewhat outlined here in the original RFC, "[eRFC] add -Z emit-stack-sizes" The end goal is to enable whole program analysis of stack usage to prove absence of stack overflows at compile time. Such property is important in systems that lack a MMU / MPU and where stack overflows can corrupt memory. And in system...
What purpose does ELF's stack-size metadata have?
1,613,647,156,000
I'm trying to locate where the libc program segments are in a program's memory, by reading the program headers. On Centos 6, when I use readelf on the libc.so.6 file, the VirtAddr contains the correct address where the program segment is loaded in the process's memory: [user@centos6 src]$ readelf -l /lib64/libc.so.6 -...
I think I figured it out, you need to check all of the PT_LOAD segments and find the one with the lowest p_vaddr (I'll call it lowest_pt_load). Then to work out the memory location it is: libc_base + segment.p_addr - lowest_pt_load.p_vaddr What was happening in the Centos 6 case was that lowest_pt_load was equal to li...
How to tell whether the p_vaddr in ELF program header is the real memory address or is just an offset from the shared library base address?
1,382,410,950,000
I'm trying to send unix mail (heirloom-mailx) via bcc. $ mail -V 12.5 6/20/10 My MTA is exim, which sends via Gmail SMTP. I can execute the following: echo -e "body" | mail -s 'subject' -b [email protected],[email protected] [email protected] All addresses receive the email, however the bcc is not hidden. i.e. in th...
heirloom-mailx hardcodes the options to pass to /usr/sbin/sendmail, and unfortunately the ones it passes don't make Bcc: headers work right in exim. That isn't really fixable, without patching and recompiling it. (You need to have it add -t to the arguments, and then either not pass the list of email addresses or alte...
How can I bcc with mailx?
1,382,410,950,000
I have configured the Debian workstations at our department to use Exim 4 for mail delivery. Also I have created an alias such that I receive all the root emails. The Exim 4 configuration (via Ansible and debconf) has those settings: exim4_dc_eximconfig_configtype: internet exim4_dc_readhost: … exim4_dc_smarthost: … e...
I think you've hit this reported bug, exim4: bogus reject response on overlong lines. It actually refers to lines that are too long, not the message itself. Try piping your message through fmt -s before passing it to exim4.
Mail delivery notices are correctly delivered, actual mail isn't
1,382,410,950,000
I am moving servers, both of them running Debian (oldstable and stable). Both are running Exim4. When I switch the DNS entries over to the new server, I'd like the old server to still forward incoming mail to my new server for processing, so that users do not see any outage. How can I do this?
Just replace all routers by one manualroute that points directly to the new MX: begin routers redir: driver = manualroute domains = * transport = remote_smtp route_list = * 12.34.56.78 Here 12.34.56.78 - is an IP-address of your new MX where all messages should go.
How to configure Exim to forward all incoming mail to new server?
1,382,410,950,000
dpkg-reconfigure exim4-config asks for a domain name to "qualify" email addresses of local users such as root. Let's say I've set this setting to qualified.example.com - this causes all email sent to simply root to go to [email protected]. I instead want all email to root to be sent to [email protected], but I want th...
Your host doesn't sufficiently know that it is supposed to be qualified.example.com. A local delivery to root is rewritten as [email protected], which is (wrongly) considered to be elsewhere, so an off-host delivery is attempted. You need to complete the process telling exim4 that your local host really is qualified.e...
Exim: Email to root ignores /etc/aliases and /root/.forward - always used qualifies domain name
1,382,410,950,000
550 relay not permitted That's the error message when email sent by Exim4 from my Debian laptop bounces. What's weird is that only the first email bounces. Second and subsequent emails pass through the relay and on to their destinations just fine. If I reboot my laptop, though, the first email after reboot bounces ag...
Your email timeout could well be due to your daemon trying IPv6 first. The IPv6 stack implementation by default has priority over the IPv4 stack so when programs/daemons try to communicate they will try first to use the IPv6 address, when the destination has both public IPv4 and IPv6 address. Even if you do not have p...
The first email bounces; the second and subsequent emails go through
1,382,410,950,000
I have over the last days tried to setup Exim4 to handle all mails sent from a web application. It seems to be working, but I haven't found out how to hardcode the hostname which will be sent with EHLO? (I don't want to set /etc/hostname) Have found the variable MAIN_HARDCODE_PRIMARY_HOSTNAME mentioned in the config b...
Set REMOTE_SMTP_HELO_DATA = whatever.you.want in /etc/exim4/exim4.conf.localmacros. It's supported by the Debian package since 4.69-10. From /usr/share/doc/exim4/changelog.Debian.gz: Allow setting outgoing smtp helo/ehlo by setting REMOTE_SMTP_HELO_DATA macro directly. Previously this was just supposed to be use...
Complete setup of Exim4 as SMTP to reach most inboxes as possible (correct configuration)
1,382,410,950,000
I'd like to manage all email incoming to *@example.com with a Python script running on my server, which will do various jobs. I've already done a DNS MX record for example.com, directing it my server: mx.example.com MX mailforwarder.example.com mailforwarder.example.com A 1.2.3.4 I...
procmail is considered problematical by Philip Guenther (and is quite possibly useless in this case, as .forward files or equivalent can send the mails directly to your program, skipping the thus needless complexity of procmail). Executive summary: delete the procmail port; the code is not safe and should not be u...
Redirect all incoming email to a Python script
1,382,410,950,000
I updated my /etc/spamassassin/local.cf spamassassin file to update some score rules. However, even after restarting spamassassin (via service), the new score are not shown in spam emails. In fact, nothing in that file seem to influence how spamassassin work. I use exim as my MTA but that should not matter. All packag...
The problem is that you are setting the HTML_MESSAGE score inside the Shortcircuit plugin. But that plugin comes disabled by default. Try to set the score in the last line of the file, after the Shortcircuit endif instruction: # Some shortcircuiting, if the plugin is enabled # ifplugin Mail::SpamAssassin::Plugin::S...
spamassassin does not honour local.cf
1,382,410,950,000
I'm trying to configure spam filter on VPS Debian Squeeze, exim4-heavy + spamassassin and dovecot. Exim version 4.72, SpamAssassin version 3.3.1, Perl version 5.10.1 And I have an irritating problem with spamassassin: messages has no X-Spam headers. Exim4 config: ### main/02_exim4-config_options spamd_address = 127.0....
the problem you are facing is, that things work a little bit differently than how you expect them to run. this is not how it works: exim receives an email exim passes the email to spamd spamd checks the email for spam and adds necessary headers spamd passes the (modified) email back to exim exim delivers the email i...
missed X-Spam- headers for all messages in exim4 + spamassassin
1,382,410,950,000
I know that you can change the from address in *nix mail by specifying command-line options. However, is there a way to set it globally, so that it is respected by forwarding? I tried modifying the $REPLYTO environment variable, but this did not help. Background I have set up my Raspbian mail to forward by configuring...
It sounds like you want Exim's address rewriting. In the rewriting section of your Exim config file, you will probably want something along the lines of this: [email protected] [email protected] Ffr You may need to adjust the flags ("Ffr") to the specific behavior you want. More generally, see: http://www.exim.org/ex...
How can I change the from address in *nix mail globally?
1,382,410,950,000
I am on Debian squeeze and I'd like to forward my root emails to my real email. I setup exim to use gmail so when I write mail [email protected] it sends to my email. However, now I'd like to email root and have it forward my emails to my real email address. mail root does not send an email to root. If I create a diff...
In order to forward root's e-mails to another e-mail address, you could change the line related to root in the file /etc/aliases. For instance: root: [email protected] To forward e-mails of a UNIX user (let say myuser) to another e-mail address ([email protected]), had the file .forward in the home folder of myuser. ...
How do I email root?
1,382,410,950,000
OS: GNU/Linux Debian 9.2 64-bit I disabled IPv6 on one of my servers. And now I'm getting this in mail: exim paniclog ... IPv6 socket creation failed: Address family not supported by protocol How do I get rid of it?
First of, man needs to disable IPv6 in exim4. In the following file: /etc/exim4/update-exim4.conf.conf Make sure this line is there, if not, add it, or change it: disable_ipv6='true' But I tried only this solution and the mail is still coming, so digging further... In the same file, make sure this line is set to tru...
IPv6 socket creation failed: Address family not supported by protocol
1,382,410,950,000
I have a machine hosted in datacenter with 3 network interfaces. Interface network ip address eth0 192.168.1.0/24 192.168.1.10 eth1 192.168.2.0/24 192.168.2.10 eth2 192.168.3.0/24 192.168.3.10 My default gateway is set to 192.168.2.1, where I can access some services provided by datacen...
You can set the firewall (iptables) to route to a specific gateway depending on one of 3 characteristics: destination port, source port or owner (may not work, see below) First you will add a custom routing table for your special application (gateway 192.168.1.1), create a rule that redirect all packages with the mask...
Change default gateway for specific program?
1,382,410,950,000
I'm trying to create an exim filter to block spam messages containing " 85% OFF" in the subject line. That's a blank space, then any two digits, then the percent sign, a blank space and the word OFF in all caps. This is what I wrote: # Exim filter if $header_subject: contains " \\d{2}% OFF" then fail text "no ...
I temporarily replaced my .forward file with yours and confirmed that it doesn't work. There are two problems. contains performs a substring match, and does not understand regular expressions. For regexes you want matches rather than contains. The \d PCRE-style character class appears to be broken as does the {N} syn...
regex usage in exim filtering
1,382,410,950,000
I have a fresh Debian installation with LAMP. There is a PHP script that sends email messages to arbitrary addresses using the mail function, but it does not work - the messages don't get delivered. I have been searching the internet for quite a while and found out that there already is a SMTP server installed by defa...
You need to configure exim4 to relay as a smarthost. There are a (lengthy) set of instructions here at the Debian wiki: GmailAndExim4, but it's really easy to get up and running. Your PHP sendmail_path is good to go.
PHP + Exim4 on Debian - mail does not get delivered
1,382,410,950,000
I am trying to substitute a hard-coded path in my Exim configuration file with a value taken from an environment variable, however I am getting an error I do not understand. "${env" is not a known operator (or a } is missing in a variable reference) This is the condition causing the error condition = ${if !exists{${e...
After chasing this myself for some time, I found that the ${env operator only seems to have been added in the relatively recent exim4 version 4.86. Compare here (4.85) and here (4.86). Unfortunately the latest version of exim4 available on debian jessie was 4.84, causing me similar pain until I found this.
Exim condition failure "${env is not a known operator"
1,382,410,950,000
Using Exim - root user can send email from command line, but non root users can not. $ mail -s "test" [email protected] </dev/null Null message body; hope that's ok [xxx@master1 /usr/home/xxx]$ 2015-03-31 17:06:34 [58856] cwd=/usr/home/xxx 3 args: send-mail -i [email protected] Seeing this in /var/log/messages: Mar ...
Others have suggested to resolve this with chmod 4755 /usr/sbin/exim In this case both mail and mutt is invoking sendmail. Problem resolved with: chmod 4755 /usr/sbin/sendmail Now messages are sent successfully, and /var/log/exim/mainlog is written to and reflect as such.
non-root users unable to send mail from command line using exim
1,382,410,950,000
Managed to get my hands on this: #!/bin/bash ######### Edit here ########## [email protected] # Set this to your email id to receive alerts on mail queue _limit=100 # Set the limit here ############################## clear; _result="/tmp/eximqueue.txt" _queue="`exim -bpc`" if [ "$_queue" -ge "$_limit" ]; then ech...
Try exiqgrep -f 'root@hostname' -i | xargs exim -M You can also look at more powerful tool exipick.
Bash script to extract message id and force send
1,382,410,950,000
Last week my email provider (mout.web.de) got listed on spamcop. So I cannot send emails to recipients whose mailserver uses spamcop. An obvious solotion, which popped up in the forums, is to switch to another (paid) email provider. Since I have a local mailserver (exim) running anyways, I wonder whether I can set it ...
In general this is possible, that's what email providers do. You surely need your own domain. Many ISPs have blocks in place so you're forced to go over your ISPs server. Even if your ISP does not block port 25, mail from your IP range will very likely be marked as spam if you run it from a home connection. Email is ...
Is it possible to run a private mailserver?
1,382,410,950,000
To catch mail send to any recipient I have added the following router directive in my exim4 configuration: local_catchall: debug_print = "R: catchall for $local_part@$domain" driver = redirect domains = +local_domains allow_fail allow_defer data = johanna How can I exclude some recipient addresses like it is po...
Use the condition router option and a single-key query like condition = ${lookup {$local_part@$domain} lsearch {/etc/deny_recips} {0} {1}} You could use the acl_smtp_rcpt instead, but note that it's for SMTP input only, extend if necessary: deny recipients = /etc/deny_recips
Exim4: How to block a list of recipient addresses
1,382,410,950,000
I'm trying to forward the emails from my Debian server to my usual email address. I'm probably missing something important, as I can't find a good solution online looking for the following error message: dnslookup defer (-1): host lookup did not complete I found this answer but it did not help me: https://serverfault...
The standard dnslookup router of exim uses an algorithm to decide how to resolve an email address (this is detailed in the Exim manual on the chapter detailing dnslookup router). Looking at the results from dig, this seems fine: $ dig mail.eu mx ; <<>> DiG 9.8.4-rpz2+rl005.12-P1 <<>> mail.eu mx ;; global options: +c...
Exim4 DNS issues
1,382,410,950,000
I am using /etc/aliases to direct group emails to multiple accounts, for example: postmaster: john abuse: john www: paul team: john, paul, ringo, george One of the lines is getting quite long due to the number of users it forwards to. Is it possible to wrap the line? I am using Exim as the MTA.
Edit: My original answer was that it is not possible, but after a very helpful comment from @Freddy it might work: Doing a quick test on a Debian 11 system: ~# cat /etc/aliases testgroup: test1, test2, test3 ~# newaliases ~# sendmail testgroup testmail4 ^d ~# su test3 ~$ mail "/var/mail/test3": 2 messages 2 new ...
Can lines be wrapped in /etc/aliases?
1,382,410,950,000
I'm using Debian stretch (9.4). I have an office365 account. Using Evolution, I can successfully download mail via POP3, and also send mail using the Evolution "Sending E-mail" preferences: Server: smtp.office365.com Port: 587 Server requires authentication TICKED Encryption method: STARTTLS after connecting Authentic...
I have restored my system's sendmail -t functionality: Studying the section for /etc/exim4/passwd.client in man exim4_passwd_client led me to realize that just because my outgoing mail is sent via smtp.office365.com, listing that DNS name in passwd.client may not actually be sufficient... there's some reverse DNS look...
How do I correctly configure exim4 on Debian so I can use `sendmail -t` to send mail via my office365 account?
1,382,410,950,000
On my development machine, I have a special kind of SMTP server running on non-standard port which is used for testing purposes. On my virtual machine I'm trying to push a message to that SMTP server by using Exim4's sendmail app: selenium-node$ sendmail -t To: [email protected]:2525 From: [email protected] Subject: T...
SMTP always goes to TCP/25 unless the mail delivery agent (here, sendmail as implemented by Exim) is specifically configured to send the mail to some custom port. There is no means to set the port like there is in URL from the mail user agent that talks to the mail delivery agent. Options thus are limited to reconfigu...
Dealing with non-standard SMTP ports with sendmail -t
1,382,410,950,000
I am trying to configure Exim to reject any $local_part that match a pattern. For example, I know that none of the local_parts for any of the myriad of domains I host will ever contains numbers. So, I know if someone send an email to [email protected], I know it is spam and can safely reject it. What would be the bes...
ACL line could be the next: deny condition = ${lookup{$localpart}nwildlsearch{/path/to/the/black.list}{yes}{no}} While black.list contains PCRE regexes one per line like that: ^.*[0-9].* ^.*[!@#$%^&*()_+].* ^.*sales.*
exim reject all local_part matching a pattern
1,382,410,950,000
My domain getting lot of spam mail like [email protected], [email protected]. We don't have such user's but we getting mails like that.Also getting lot of bounce mails, How to control spam like this in exim mail server.
If you use postmaster option require verify = recipient This statement requires the recipient address to be verified; if verification fails, the address is rejected. See Default Configuration You can also set some good acl rules to delay or block the host which sends the spam: deny message = Max $...
Incoming Spam Mail in exim mail server
1,382,410,950,000
I have had a few problem with exim4 and various phone mail clients (Windows Phone in particular) that seem to result from bad mail clients together with GnuTLS. I'd like to recompile exim4-daemon-heavy to use OpenSSL to see if that helps anything. Now, I've gotten used to debian's packaging system and am unsure on ho...
Although the answer is in my comment/duplicate, lets do a summary of the commands you need for: Building exim4-daemon-heavy in Debian-like distros mkdir exim4 && cd exim4 apt-get source exim4 sudo apt-get build-dep exim4 cd exim4-4.82 ### This could be different for you ##Modify your option here in the `debian/r...
How to recompile exim4-daemon-heavy? [duplicate]
1,382,410,950,000
I have just installed Debian Squeeze x64 and tried sending myself a test email from it using the normal "mail" command. When I sent it I got this error from Exim: 2013-06-08 08:12:46 Exim configuration error in line 173 of /var/lib/exim4/config.autogenerated: user uucp was not found Can't send mail: sendmail proces...
On my Ubuntu system I have a user uucp and it must have been created early because of its usernumber. grep uucp /etc/passwd gives: uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh and /var/spool/uucp does not exist. grep uucp /etc/group gives: uucp:x:10: and grep uucp /etc/shadow gives: uucp:*:15426:0:99999:7::: So you sh...
Debian installation has no uucp user - how to create
1,382,410,950,000
I have a Debian Jessie (Version 8.1) server that serves multiple domain names. Each has their own folder configured under /var/www/. Each domain name has a unique conf (example.com.conf) file under /etc/apache2/sites-enabled which is linked to a matching conf file under /etc/apache2/sites-available. Each conf file has...
Reconfigure your config by running # dpkg-reconfigure exim4-config General type of mail configuration: internet site Other destinations for which mail is accepted: example.com IP-addresses to listen on for incoming SMTP connections: fill in your IP address Those should be the most important items to change. Remove ...
How to configure EXIM4 to relay emails?
1,382,410,950,000
I recently installed a new SSL certificate and then also decided to tighten security a bit by make the private key less readable. This caused a problem with exim. The certificate is now 640 with user root and group ssl. The user Debian-exim is in this group. I can access the private key file just fine from the shell: ...
The groups that a user is in are granted by the login process. When a daemon switches to a user and group after launch, it typically only switches to this user and group (with setgid followed by setuid), and doesn't take on any other group implied by /etc/passwd (primary group) and /etc/group (supplementary group). I ...
Daemon file access denied while it shouldn't