date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,586,628,012,000 |
By default journalctl shows messages in the traditional system log format, including the CLOCK_REALTIME stamp, i.e. wall clock time (and calendar date).
However, this doesn't show accurate timestamps for kernel messages, if they were logged when journald wasn't running e.g. during boot or the suspend/resume procedure.... |
Yes, yes it can.
$ journalctl -o short-monotonic -b
[ 0.000000] alan-laptop kernel: microcode: microcode updated early to revision 0x2a, date = 2018-01-18
[ 0.000000] alan-laptop kernel: Linux version 4.15.14-300.fc27.x86_64 ([email protected]) (gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC)) #1 SMP Thu Mar ... | View original kernel message timings from historical system logs |
1,663,512,508,000 |
I am always getting this error at boot. Is there anything major, and if it is, how could be fixed?
I get that it has something to do with my AMD GPU. Here is the setup I have:
Cpu:
AMD A9-9420 RADEON R5, 5 COMPUTE CORES 2C+3G, 2586 MHz
GPU:
ATI Stoney [Radeon R2/R3/R4/R5 Graphics],
AMD ATI Radeon R5 M230 / R7 M260DX ... |
Edit the file /etc/default/grub and add the below parameters to the GRUB_CMDLINE_LINUX:
$ sudo nano /etc/default/grub
GRUB_CMDLINE_LINUX="acpi_osi=Linux acpi_backlight=vendor"
Do not forget to run update-grub afterwards.
For me that solved the issue! I had it on an ATI/AMD, a rather old gpu. Also I wanted to mention... | Kernel error: systemd-backlight@backlight:acpi_video0.service |
1,663,512,508,000 |
Is there a way to clear systemd/journal messages manually only keeping high priority messages?
I have a system with very limited storage and would like to keep the journal compact while still keeping track of errors.
Messages of priority 0..3 should be kept as long as there is sufficient space, messages of lower prior... |
Is there a way to clear systemd/journal messages manually only keeping high priority messages?
No.
Can the --vacuum-time option of journalctl be combined with any type of filter?
No.
Your options are:
Not logging
Logging outside of journald
Logging somewhere else if your have a network connection
| journalctl - clear low priority messages |
1,663,512,508,000 |
I was perplexed to find that, when running for instance journalctl -f showed my logs to stop on Apr 20th, 8 months ago. I piped to less, journalctl | less and pressed G to go to the end, same thing.
Then I did journalctl | less and went down 'slowly' (ctrl+d), this way I was able to go way further than Apr 20th...
The... |
SystemMaxFileSize= and RuntimeMaxFileSize= control how large individual journal files may grow at most. This influences the granularity in which disk space is made available through rotation, i.e. deletion of historic data. Defaults to one eighth of the values configured with SystemMaxUse= and RuntimeMaxUse=, so that... | journalctl log way too big? |
1,663,512,508,000 |
Edited:
Since the initial question was too general I will focus on only one program.
I am running the command libinput-gestures-setup start, which comes bundled with libinput-gestures and it seems to work but ps shows no record of the process started and libinput-gestures-setup status says that program hasn't been sta... |
I make an answer because I haven't enough reputation to comment. Anyway as @thanasisp has said there the strace command line. But there is an other interesting framework to trace software. It's lttng and its gui babeltrace. You can trace the kernel, c binary, python and java software.
And here is a quick-start tutor... | Is there a way to log program specific behavior? |
1,663,512,508,000 |
Setup
Using systemd 244 (244.5+) on kernel 4.19.62.
I want to set the total journal storage size to 100MB. Journald is set to volatile storage, so logs end up on /run/log/journal/... and RuntimeMaxUse should be used to set the storage quota as follows in /etc/systemd/journald.conf:
[Journal]
Storage=volatile
RuntimeMa... |
The 64M was coming from an additional config file I was unaware of: /lib/systemd/journald.conf.d/00-systemd-conf.conf.
With that additional setting of RuntimeMaxUse=64M removed, I can now set the desired values in /etc/systemd/journald.conf.
Tip: use strace on journald startup to see what config files it really uses a... | journald RuntimeMaxUse is ignored, quota tied to RuntimeMaxFileSize instead |
1,663,512,508,000 |
My embedded box is running Linux 5.15 with systemd 251 (251.2+).
I have configured persistent logging for journal.
/etc/systemd/journald.conf
[Journal]
Storage=persistent
Created folder /var/log/journal. This is mounted on mtd flash partition.
ls -alt /var/log/journal/
drwxr-sr-x 2 root systemd- 0 Jan ... |
The file system in our case is jffs2.
Persistent journal would not work on jffs2. More details are in my Github systemd issue #2571.
| systemd journal is not stored in /var/log/journal and not persistent after reboots |
1,663,512,508,000 |
Reading the content of man journalctl, I came across the following:
Storage=
Controls where to store journal data. One of "volatile", "persistent", "auto" and "none". If "volatile", journal log data will be stored only in memory, i.e. below the
/run/log/journal hierarchy (which is created if needed). ... |
Systemd journal data is not stored in plain text. It is designed to be read through the journalctl tool. If you wish, you can use strace to confirm that journalctl is indeed reading files from /run/log/journal, among other places:
strace journalctl 2>&1 | grep /run/log/journal/
| cannot read saved journalctl logs |
1,663,512,508,000 |
I can do the following to get local3 logs:
journalctl SYSLOG_FACILITY=19
The magic number 19 is uterly confusing. How can I do the following:
journalctl WHAT_TO_PUT_HERE=local3
?
I do not see anything helpful in man journalctl or journalct -n10 -ojson | jq | less.
|
I do not see anything helpful in man journalctl
There is a --facility option:
journalctl --facility=local3
| How to filter journalctl logs by human readable facility? |
1,663,512,508,000 |
Here's a simple issue.
I want an overview, e.g. separate files with debug information for each process which has dumped core extracted from journalctl.
Here's a sample output:
Jan 17 12:49:45 localhost systemd-coredump[137987]: [🡕] Process 3045 (xfce4-panel) of user 1000 dumped core.
... |
Don't ask me why but journalctl _COMM=systemd-coredump doesn't work as it produces: -- No entries --. No big deal.
I'm sure it can be done a lot easier by e.g. using JSON output but that will involve using and parsing jq output but since I'm not a proper programmer I decided to use awk instead. Here's what I got:
#! /... | Extract journalctl/system log "Process 1234 (processname) of user 1000 dumped core" messages into separate files |
1,663,512,508,000 |
Why does journaltcl logs start only today when the last reboot was done 5 days before ? :
$ journalctl -e | grep Logs.begin
-- Logs begin at Tue 2022-09-06 09:42:37 CEST, end at Tue 2022-09-06 11:04:27 CEST. --
$ last reboot | head -1
reboot system boot 3.10.0-1160.62.1 Thu Sep 1 23:46 - 11:04 (4+11:18)
$ journalc... |
A glance at the logrotate status output does seem to confirm that the scality app's logs were rotated. However, there is a bit of confusion here because there are two sets of logs to consider, and what logrotate does does not affect what's returned by journalctl, nor are journald's own files managed by logrotate.
Jou... | Why does journaltcl logs start only today when the last reboot was done 5 days before? |
1,663,512,508,000 |
I am running SystemD version 249.7+ on a custom embedded Linux device with Kernel 5.10.50. I am using Podman 4.0.2 with Docker-Compose to run a few containers. The problem I have is that the 'conmon' child processes from the podman system service duplicates every single journald log entry that the docker-compose proce... |
Try LogLevelMax=error, which simply limits all logging for the unit to log level error or worse. At least for me, this solved a similar issue where a program would spam journalctl with messages. Maybe it also helps in this case, at least in the sense that it would suppress all non-error messages from the child process... | SystemD JournalD cannot disable child process output |
1,663,512,508,000 |
I have one systemd service which runs with systemctl --user start test_unit@random_arguments. How could I use journalctl to filter all logs of test_unit? If it supports "follow mode", that's even better.
|
If this is a user unit, use the --user-unit option:
journalctl -f --user-unit=test_unit@random_arguments
Otherwise, filter the unit with _SYSTEMD_UNIT:
sudo journalctl -f _SYSTEMD_UNIT=test_unit@random_arguments
| Use journalctl to show logs of specific unit which has a parameter? |
1,663,512,508,000 |
I see many entries of "Got unexpected auxiliary data with level=1 and type=2" in journalctl, but there is no hint where these are generated. The number of log entries is high. I cannot brain-link these entries with specific services.
How can I find out which service generates the "Got unexpected auxiliary data with le... |
This might be somewhat brute-force but you can list all enabled services with
systemctl list-unit-files | grep enabled
You can likely disregard most of the services listed as being fairly vanilla. For the ones you want to take a look at, use
journalctl -u *servicename*
Tedious but it should work. Might be better to ... | How to find the source of "Got unexpected auxiliary data with level=1 and type=2" |
1,663,512,508,000 |
> journalctl
-b: -c: line 0: unexpected EOF while looking for matching `"'
-b: -c: line 1: syntax error: unexpected end of file
> systemctl status docker.service
-b: -c: line 0: unexpected EOF while looking for matching `"'
-b: -c: line 1: syntax error: unexpected end of file
https://clbin.com/0CNIZ <- Link to strac... |
Thanks to @Artem I've found that my issue is that I set my PAGER variable to be export PAGER="/usr/bin/bash -c \"col -b -x | vim -R -c 'set ft=man nolist laststatus=0' -c 'map q :q<cr>' - \"". The smallest reproducible case is export PAGER="/usr/bin/bash -c 'vim -R -'".
The solution that I went with is putting this in... | journalctl fails when run |
1,663,512,508,000 |
My PC freezes a third time and I have to shut it down forcibly. Why doesn't journalctl save the boot logs before forced shutdown? When I do journalctl --list-boots I only get the boot after crash.
I'm not sorting well or misconfiguration?
System: ArchLinux (5.4.8-arch1-1)
|
It depends on the freeze, and it's not clear to me what do you mean by "shut it down forcibly". If this means a power off, definitely, there is no way for your PC to sync data in a proper way. The recommended way to force reboot, is by using the magic SysRq key and the REISUBsequence. More details are at
https://wiki.... | Why journalctl don't save my logs of the boot before forced shutdown? |
1,477,761,853,000 |
I have an HP DL380G9 server with two discreet nvidia graphics card installed running RHEL 6 with Kernel 2.6.32-573. Both cards have the same chipset (NV117) but different models. K620 (Slot 5 address 88:00.0), K2200 (Slot 4 address 84:00.0). The K2200 is the selected card for Linux to output plymouth and boot messages... |
I finally found this is done with a kernel feature called vga arbiter. Whichever VGA adapter is used as primary by the BIOS ends up being flagged a the "bootvga" device. Its possible to force vga arbiter to select and use the next vga adapter by using the stub driver for the undesired VGA adapter. Retrieve the pci dev... | Select graphics card for console output |
1,477,761,853,000 |
Is it possible to set Linux kernel sysctl settings (those usually set in /etc/sysctl.d) using kernel command line (those visible in /proc/cmdline)?
(Using grub config file /etc/default/grub variable GRUB_CMDLINE_LINUX="...".)
|
Sysctl parameters can be set via the kernel command-line starting with kernel version 5.8, thanks to Vlastimil Babka from SUSE.
sysctl.*= [KNL]
Set a sysctl parameter, right before loading the init
process, as if the value was written to the respective
/proc/sys/..... | How to set sysctl using kernel command line parameter? |
1,477,761,853,000 |
Is it possible to change this value in runtime without rebooting? I don't always have this problem, when I suspend right now I'm getting a failure and
Suspending console(s) (use no_console_suspend to debug)
I would like to debug now, without having to reboot and recreate the problem.
|
Yes:
echo N | sudo tee /sys/module/printk/parameters/console_suspend
| Can no_console_suspend be set in runtime? |
1,477,761,853,000 |
I'm confused between the various ways that LUKS/dmcrypt/cryptsetup discard /TRIM operations can be enabled via the Linux kernel command line.
The dracut manpage:
rd.luks.allow-discards
Allow using of discards (TRIM) requests on all LUKS partitions.
The systemd-cryptsetup-generator manpage
luks.options=, rd.luks.op... |
It depends a little on the distribution you are using and what components are included by dracut in the initramfs.
For example, the cryptdevice= option is interpreted by the encrypt hook. Thus, it's only relevant for initramfs images that include this hook.
The disadvantage of rd.luks.allow-discards and rd.luks.allow-... | LUKS discard/TRIM: conflicting kernel command line options |
1,477,761,853,000 |
According to https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
conf/all/* is special, changes the settings for all interfaces
forwarding - BOOLEAN
Enable IP forwarding on this interface. This controls whether packets
received _on_ this interface can be forwarded.
ip_forward - BOOLEAN
... |
Indeed, both parameters affect IP forwarding at a broad level. However, net.ipv4.conf.all.forwarding is meant to provide more granular control within network namespaces when dealing with complex networking scenarios where you want to enable or disable forwarding for specific namespaces while leaving others unaffected.... | Difference between net.ipv4.conf.all.forwarding and net.ipv4.ip_forward |
1,477,761,853,000 |
We know that sysctl command can change kernel parameters with :
# sysctl -w kernel.domainname="example.com"
or by directly editing the file in /proc/sys directory. And for persistent changes, the parameters must be written to /etc/sysctl.d/<moduleName>.conf files as:
# echo kernel.domainname="example.com" > /etc/sysc... |
As far as I know, you can use modprobe to adjust parameters only when the feature in question has been compiled as a module - and you're loading the module in the first place. For setting module parameters persistently, you'll have the /etc/modprobe.d directory. (Generally you should leave /usr/lib/modprobe.d for dist... | Difference between modprobe and sysctl -w in terms of setting system parameters? |
1,477,761,853,000 |
At boot I see:
:: running hook [encrypt]
A password is required to access the volume:
Command requires device and mapped name as arguments
Command requires device and mapped name as arguments
Command requires device and mapped name as arguments
The final message repeats every second.
There is no opportunity for me ... |
You've probably forgotten to include the required cryptdevice mapped name in the kernel command line parameter.
I had:
cryptdevice=/dev/sdaX
However, the second colon-separated field is mandatory, eg:
cryptdevice=/dev/sdaX:root
If you're using an SSD, and have understood the implications, for increased performance you... | LUKS password not being requested by dmcrypt / encrypt hook at boot |
1,477,761,853,000 |
In this post there is some explanation about why does lsmod show -2 in 'used by' column. The idea is that the kernel config option CONFIG_MODULE_UNLOAD was not set.
But what if lsmod shows -1 only for one specific module while CONFIG_MODULE_UNLOAD is set in my current kernel? How to debug this muddle?
|
A module reference count of -1, visible both in /sys/module/<module>/refcnt and in lsmod’s output, means that the module is currently unloading.
If a module’s reference count stays at -1, that indicates a problem — dmesg should tell you more.
| lsmod 'used by' shows -1 while CONFIG_MODULE_UNLOAD=y |
1,477,761,853,000 |
I'm currently trying to rebuild the kernel for a proprietary device. In order to do this I will need to produce a kernel config for the device. While I could likely do this through trial and error, it would be better to see if I can extract the config from the running host.
That being said the running kernel was not... |
One, arguably silly, idea that comes to mind is to see if you can pull the kernel's symbol table from the image or from /proc/kallsyms or somewhere, and reverse engineer at least the included drivers based on that. Though with something like 35000 symbols shown by kallsyms on a stock distribution kernel, that would re... | What are methods for recovering a Linux Kernel config? |
1,477,761,853,000 |
I first found this by investigating parameters for earlycon but found that the options for console look almost identical. Both are present below and were taken from this source:
From documentation for console we have:
console= [KNL] Output console device and options.
tty<n> Use the virtual console device <n>... |
I'm sure someone is still doing this, but back in the days before stuff like ILO/DRAC/etc. became cheap and ubiquitous, the best way to get "out of band" access to the console in case of emergencies or an oops was over the serial port. You would mount a Terminal Server in the rack, then run cables to the serial port o... | Kernel parameters "console" and "earlycon" refer to old hardware? |
1,477,761,853,000 |
I have an internal webcam on my Dell laptop. I don't see it listed with lspci, but it works.
I am using a self-compiled kernel, and here are the options I have enabled:
# zcat /proc/config.gz | grep -v '^#' | egrep '(MEDIA|VIDEO)'
CONFIG_ACPI_VIDEO=y
CONFIG_MEDIA_SUPPORT=y
CONFIG_MEDIA_SUPPORT_FILTER=y
CONFIG_MEDIA_CA... |
If CONFIG_KALLSYMS is enabled, built-in drivers can be disabled by disabling their init function. For uvcvideo (which is likely to be the driver used for your webcam), add
initcall_blacklist=uvc_video_init
to your kernel’s command line.
If it isn’t, you won’t be able to disable only your webcam using kernel command l... | Disable webcam at boot time, by appending a boot parameter |
1,477,761,853,000 |
This is on the Linux OS.
I see that on some machines the net.bridge.bridge-nf-call-iptables variable doesn't exist until I modprobe the br_netfilter filter. I also see that there are some machines where the bridge module is loaded and that itself brings in this variable.
Is there a way to know which module I should lo... |
There's no automatic database relating sysctl variables to modules. You can search the module binary and hope that the variable name isn't found in other strings (this one isn't). Search for the last part, i.e. bridge-nf-call-iptables — the full string isn't present in the binary, it's constructed dynamically.
grep -r... | Kernel module for net.bridge.bridge-nf-call-iptables |
1,477,761,853,000 |
First, let me give a background of what I am trying to achieve. I know how to isolate a particular CPU using boot param (isolcpu and nohz_full; the housekeeping subsystem setup).
But as per my requirement, I need to isolate the CPU after the system has booted up. So, as per many articles, I tried to isolate a particul... |
taskset will call sched_setaffinity which will fail if
The affinity bit mask mask contains no processors that are currently
physically on the system and permitted to the thread according to
any restrictions that may be imposed by cpuset cgroups or the "cpuset"
mechanism described in cpuset(7).
As for why is the be... | Set affinity of a process using TASKSET or sched_setaffinity() to a processor core isolated using CPUSET |
1,477,761,853,000 |
Some Linux distributions have kernel.sysrq=16 which means only SysRq + s (sync) is allowed. As an example: Fedora (25 and 28) has it set as such in /usr/lib/sysctl.d/50-default.conf
I had to create a file as /etc/sysctl.d/95-sysrq.conf where I manually set kernel.sysrq=1 so it's available as soon as possible (but poss... |
There is kernel boot parameter sysrq_always_enabled according to the doc:
sysrq_always_enabled
[KNL]
Ignore sysrq setting - this boot parameter will
neutralize any effect of /proc/sys/kernel/sysrq.
Useful for debugging.
I have tested Sysrq to work(eg. help,sync) even ... | How to ensure SysRq is always enabled regardless of the kernel.sysrq setting? |
1,477,761,853,000 |
I have an error when booting on a machine, my machine is stuck with the error message:
Booting a command list.
I can see this message when I add loglevel=7 and only if I delete the quiet in the kernel parameters via grub boot loader.
Is there a way to make the boot even more verbose than loglevel=7 using kernel parame... |
It may be stuck during loading kernel or initrd, try adding insmod progress line before linux and something like echo 'Loading linux...' and echo 'Loading initrd...' before linux and initrd lines. Also consider adding tsc=unstable kernel parameter, it may fix delay before booting, see following question: kernel boot l... | Can I make the boot even more verbose than loglevel=7 using kernel parameters? |
1,477,761,853,000 |
I saw in my syslog kernel.perf_event_max_sample_rate get changed.
I was wondering if I could write a quick script to log this variable every few minutes. Currently it is:
sysctl -a | grep kernel.perf_event_max_sample_rate
In the man page sysctl says
sysctl - configure kernel parameters at runtime
Does that mean tha... |
So one of the big things about learning to Unix is reading the bloody man page:
I'm not just being a get off my lawn grumpy old man, there REALLY IS valuable information in there. In this case:
DESCRIPTION
sysctl is used to modify kernel parameters at runtime. The parameters available are those listed under /proc/sy... | View current kernel parameters? |
1,477,761,853,000 |
When I add the "badram" pattern that 64bit Memtest86+ v6.10/v6.20 gave me, GRUB 2 hangs completely on boot.
Q:
Why is the badram pattern address different from the "Error Address" displayed (0x0ac... vs 0x62c...)? What is the reason for this apparent offset?
Why does GRUB hang on passing a 64bit badram pattern?
T... |
While I didn't really find an answer as to why, since I can't grok that GRUB source code, I'm quite certain now that GRUB 2's badram command is just broken for 64 bit address space.
So this information is for anyone else, who may be going down this rabbit hole.
(tl;dr: badram is unusable! Use Linux' memmap= kernel pat... | GRUB hangs itself with 64bit Memtest86+ BadRAM pattern? |
1,477,761,853,000 |
Supposedly I passed the kernel a parameter that it doesn't understand, for example blabla or eat=cake, what would the kernel do with these unknown parameters, the traditional case would be passing any unknown parameter to init, in case if the the Linux kernel starts with early user space (initramfs) would it pass it t... |
From the kernel documentation:
The kernel parses parameters from the kernel command line up to --;
if it doesn't recognize a parameter and it doesn't contain a ., the
parameter gets passed to init: parameters with = go into init's
environment, others are passed as command line arguments to init.
Everything af... | What does the Linux kernel do with unknown kernel parameters? |
1,477,761,853,000 |
Quoting the linux kernel documentation for boot parameters :
pcie_bus_perf : Set device MPS to the largest allowable MPS based on
its parent bus. Also set MRRS (Max Read Request Size) to the largest
supported value (no larger than the MPS that the device or bus can
support) for best performance.
I fail to understand... |
I hope you found the answer but I found some information for this which could help.
This kernel-mailing-list-discussion and this article are mentioning this issue and the explanation is that by setting the MRRS you are ensuring that the devices are not sending out read requests where the completion-packet-size (the an... | pcie_bus_perf : Understanding the capping of MRRS |
1,477,761,853,000 |
System uptime is stored in /proc/uptime.
As you know, the Linux kernel has a jiffies variable which increments by each timer interrupt specified by the HZ parameter. I got the value ofHZ by the following command:
$ zcat /proc/config.gz | grep CONFIG_HZ=
CONFIG_HZ=300
In my machine, it's equal to 300. So I divided th... |
Some/many (but not all) modern kernels add an offset to jiffies - it's a very large offset, basically it's 4294967295 - (300 * HZ)
The 300 * HZ is a 5 minute offset so that the kernel always tests jiffy rollover
So, for 300Hz that would be 4294877295
Subtracting that from the jiffies value, then dividing by HZ should ... | Why jiffies/HZ does not match uptime? |
1,477,761,853,000 |
How do I escape the string:
acpi_osi="Windows 2015"
To keep the space and quotes in GRUB's GRUB_CMDLINE_LINUX?
[Alternate search term: acpi_os_name=]
|
The correct quoting / escaping format to use is:
GRUB_CMDLINE_LINUX="... acpi_osi=\"Windows 2015\" ... "
Then /proc/cmdline will contain:
"acpi_osi=Windows 2015"
| GRUB: escape acpi_osi="Windows 2015" in GRUB_CMDLINE_LINUX |
1,477,761,853,000 |
After upgrading my CentOS 7 kernel from 3.10.0 to 4.8.7, while rebooting the system I will get the following lines:
[ 0.641455] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 0 (-19)
[ 0.641734] cpufreq: cpufreq_online: Failed to initialize policy for cpu: 1 (-19)
[ 0.641873] cpufreq: cpufreq... |
Are you using virtual machines or a hypervisor? If yes so, you should update your hypervisor host to the latest version so it can support the kernel version.
CPUFreq stands for CPU frequency scaling which enables the operating system to scale the CPU frequency up or down in order to save power.
I'm not sure why you're... | Kernel 4.8.7 failure on cpufreq - CentOS 7 |
1,477,761,853,000 |
Besides the possibility of userspace applications that care which one you use reading /proc/cmdline, what is the difference between using the kernel parameter quiet, versus loglevel=4, and the parameter debug, versus loglevel=7? Is there any?
|
Nope, they're absolutely the same. The following is a quote from Linux Kernel in a Nutshell by Greg Kroah-Hartman
debug
Enable kernel debugging.
Cause the kernel log level to be set to the debug level, so that all
debug messages will be printed to the console at boot time.
quiet
Disable all log messages.
Set the ... | Kernel parameter quiet versus loglevel=4 and debug versus loglevel=7 |
1,477,761,853,000 |
I am trying to figure out how to disable bounce buffers used in IOMMU when the hardware IOMMU is used.
To give more context, when IOMMU_DEFAULT_DMA_STRICT is set in the kernel it enables strict IOTLB invalidations on page unmap. Also, it uses an "additional layer of bounce-buffering".
Reference:
config IOMMU_DEFAULT_D... |
I asked the kernel developers the same question and am posting the answer here if anyone else has the same question (relevant kernel mail thread).
There is no kernel boot option or config option to enable or disable IOMMU SW bounce buffers.
SW bounce buffers are internally enabled for any untrusted PCI device.
Linux k... | How to disable/enable bounce-buffers in IOMMU? |
1,477,761,853,000 |
The Linux kernel takes a memmap parameter *) to manually designate memory regions for different use-cases.
Q: What is the difference between reserved memory (memmap=nn[KMG]$ss[KMG]) and protected memory (memmap=nn[KMG]!ss[KMG])?
I.e. how are they treated by the kernel and when is either used?
In regards to /proc/iomem... |
Reserved memory is memory the kernel cannot/should not use as regular memory, for whatever reason.
Protected memory (sometimes also known as persistent memory) is memory that is guaranteed to keep its contents through a reboot or power loss, either because it is a Non-Volatile DIMM (NVDIMM) or for some other reason.
e... | Linux kernel difference between protected and reserved memory? (memmap parameter) |
1,477,761,853,000 |
The NOTES section of $ man 5 sysctl.conf states: The description of individual parameters can be found in the kernel documentation.
But is there a way for me to find this kernel documentation offline? Is it a package that I'd need to install?
For example, I came across the kernel.panic parameter, which on my system is... |
But is there a way for me to find this kernel documentation offline? Is it a package that I'd need to install?
Yes, most distributions provide the kernel documentation for their kernel in a package. On Debian, this is linux-doc, which is a meta-package pulling in the default kernel’s documentation for whichever rele... | Where to get offline documentation/descriptions of individual sysctl kernel tunable parameters? |
1,477,761,853,000 |
I am developing an embedded Linux device. I have successfully created an InitramFS CPIO archive that runs quickly after boot. Now, I want to change the initial kernel command line to include "quiet" parameter so I can boot even faster.
However, once the splash screen is displayed in the InitramFS, I want to remove the... |
You can't really change the kernel command-line after boot, but what you can do is reproduce the effects of setting or unsetting the quiet command-line through other means, which should accomplish what you want to achieve here.
In short, to increase verbosity once you don't want quiet anymore, you can use this command... | Linux Modify/Add Kernel Command Line from InitramFS "UserSpace" |
1,477,761,853,000 |
I recently installed Arch Linux on a System76 Lemur Pro laptop. The installation seemed to complete successfully, but the console_loglevel is set to the very high value of 15. The following command allowed me to draw this conclusion:
# cat /proc/sys/kernel/printk
15 4 1 4
The high console_loglevel ca... |
The log level was being set to a high value because of a kernel fault. I figured this out with the help of the System76 support team. The solution to my specific problem was to install the System76 ACPI DKMS driver, and info about the solution is now on the Arch Wiki.
Information about printk being set to a high value... | What is setting the the console_loglevel at boot? |
1,477,761,853,000 |
[Sun Mar 1 07:51:40 2020] MTRR default type: uncachable
[Sun Mar 1 07:51:40 2020] MTRR fixed ranges enabled:
[Sun Mar 1 07:51:40 2020] MTRR variable ranges enabled:
[Sun Mar 1 07:51:40 2020] pmd_set_huge: Cannot satisfy [mem 0xf8000000-0xf8200000] with a huge-page mapping due to MTRR override.
Noticed these messa... |
The Memory-Type Range Registers (MTRR) can control caching behaviour with respect to memory writes. In both your logs, no specific behaviour is enabled. If it was enabled, it would look like this (from an older system of mine):
MTRR default type: uncachable
MTRR fixed ranges enabled:
00000-9FFFF write-back
A0000-E... | MTRR (Memory Type Range Register) in Debian 10 dmesg messages |
1,477,761,853,000 |
I noticed that kernel has different console levels for the printk.
I also noticed this post [1].
I understand that we can change the /proc/sys/kernel/printk to change the printk level for the console; We can even use the dmesg --level to change the display level for dmesg.
However, my question is:
If I have a printk(... |
It looks to me like KERN_DEBUG and lower will not get compiled in unless you set an appropriate flag in your kconfig. http://lxr.free-electrons.com/source/include/linux/printk.h?v=4.10#L280 I highly doubt the overhead of a function call and checking an if statement is an issue though and that is all the printk(KERN_DE... | How to let kernel not run the printk with KERN_DEBUG |
1,592,146,650,000 |
I am trying to auto install debian buster with ipxe, it seems that the boot parameters don't work in the ipxe menu. I always get the language section. So the preseed isn't loaded. Here is the relevant entry in the ipxe menu:
:d10-dc-node
set base-url https://d-i.debian.org/daily-images/amd64/daily/netboot/debian-insta... |
I finally could install debian buster fully unattended by using the following Kernel arguments:
:d10-dc-node
set base-url https://d-i.debian.org/daily-images/amd64/daily/netboot/debian-
installer/amd64
kernel ${base-url}/linux
initrd ${base-url}/initrd.gz
initrd tftp://my.ipxe.server/preseed/debian_buster_node.seed /... | boot parameters seems not to work with ipxe and daily image |
1,592,146,650,000 |
I often see editing of grub2 parameters to change kernel parameters (i.e. loglevel, quiet, intremap, etc...), but I think there are also grub2 parameters and I'm lost to what they actually are.
Specifically, does grub2 need any special parameters to handle a network boot (PXE)? In legacy-grub, I've had to add macappen... |
They are the same, the main difference is that kernel parameters can be set in three ways :
1- During the boot sequence GRUB via :
a- The Grub interface during the boot.
b- Configuration files with regenerating `grub.cfg` (permanent)
2- During the RunTime via :
sysctl command
/proc/sys/* directory
3- By configu... | Is there a difference between Kernel parameters and the bootloader parameters? |
1,592,146,650,000 |
This was prompted by another question elsewhere, which after digging into briefly a quick online search ("linux kernel command line override priority" and some variations) turned up absolutely nothing.
The issue is that /proc/cmdline indicates a parameter has been included twice with different values. My question is ... |
I’m not sure it’s documented explicitly in the kernel, but the x86-specific boot command-line parsing includes this comment:
Find a non-boolean option, that is, "option=argument". In accordance
with standard Linux practice, if this option is repeated, this returns
the last instance on the command line.
This allows ... | Do subsequent arguments override previous from linux kernel command line, or vice versa? |
1,592,146,650,000 |
We have systems with both spinning mechanical disks, and NVME storage. We want to reduce the CPU overhead for IO by taking any IO scheduler out of the way. We want to specify this on the Linux boot command line; i.e. in GRUB_CMDLINE_LINUX, in the file /etc/default/grub.
For mechanical disks, we can append elevator=no... |
I/O schedulers are assigned globally at boot time.
Even if you use multiple elevator=[value] assignments only the last one will take effect.
To automatically/permanently set per-device schedulers you could use udev rules, systemd services or configuration & performance tuning tools like tuned.
As to your other questio... | How to specify multiple schedulers on the kernel boot command line? |
1,592,146,650,000 |
How to add sysrq_always_enabled and audit=0 kernel parameters to an AppVM in QubesOS 4.0 ?
Current /proc/cmdline inside the VM is:
[user@dev01-w-s-f-fdr28 ~]$ cat /proc/cmdline
root=/dev/mapper/dmroot ro nomodeset console=hvc0 rd_NO_PLYMOUTH rd.plymouth.enable=0 plymouth.enable=0 nopat
|
tl;dr: Run this in dom0: qvm-prefs --set vmnamehere kernelopts 'nopat sysrq_always_enabled audit=0'
In Qubes OS (4.0), if you want to add new kernel parameters for a specific VM (AppVM or TemplateVM) you can (only?) do so from dom0.
First, see what kernel parameters are already added(because you need to specify them ... | How to add VM kernel parameters in Qubes OS 4.0 ? |
1,592,146,650,000 |
When isolating CPU cores for jitter-sensitive processes it is common to use both boot parameters nohz_full and isolcpus (I know the latter is deprecated in favor of cpusets, but it's still around). isolcpus also has a nohz parameter. I wonder if it has the same effect as nohz_full?
|
Initially, the nohz_full kernel parameter was meant to only (*) :
set the specified list of CPUs whose tick will be stopped whenever
possible.
When isolcpus was meant to (*) :
Specify one or more CPUs to isolate from disturbances specified in the
flag list
Disturbance depicts a much wider area than the timer tick ... | What's the difference between the kernel boot parameters nohz_full and isolcpus=nohz |
1,592,146,650,000 |
NOTE: My question stems from this other U&L Q - What exactly is iodepth in fio?
I want to know how internally FIO sets I/O depth. I.e., one of the parameters we submit to FIO when we run it is "IOdepth" (--iodepth=). How does FIO internally control this parameter with the underlying operating system?
Here is an examp... |
fio is passing this value [depth] to the operating system
and
Accordingly, fio is passing this value to the operating system. So how does FIO do this?
There might be a misconception here: fio is NOT directly passing a depth parameter to the operating system. If possible, fio tries to submit I/O up to the iodepth s... | How does FIO benchmark set IOdepth? |
1,592,146,650,000 |
Heavily related to a question on the sister site (https://serverfault.com/questions/874943/debian-9-black-screen-during-install), I have recently picked up an HP ProLiant DL380 G5 and attempted to install Debian 9 on it (currently to a USB drive as I wait for my order of HDD's).
The OS setup would halt due to a NMI Wa... |
After a day with this, I found a few workarounds, with varying results.
Swapping out acpi=off for nolapic allows the system to boot and power off, until I noticed that I was operating on only one core.
Disabling "MPS Table Mode" in the BIOS[*] has the same outcome as option one, but with less kernel chatter.
I tried ... | ACPI kernel parameter options for HP ProLiant DL380 G5 |
1,592,146,650,000 |
I recently attempted to compile a device driver (Xilinx XAPP1052) on Fedora Workstation 20. It gave me the following error.
ERROR: 256 KiB atomic DMA coherent pool is too small!
Please increase it with coherent_pool= kernel parameter
How would I go about doing this? Is there a command that lets me change the coheren... |
Like the message says, use coherent_pool=<size> kernel (boot) parameter.
With grub, select the desired kernel, press e to modify the boot entry, then append the line starting with kernel with the option. This change won't be preserved across reboots.
If you want the change permanent, append the option to GRUB_CMDLINE_... | How to increase atomic DMA coherent pool? |
1,592,146,650,000 |
What are the default kernel parameters, when creating a new network namespace? Is there a way to override them upon creation?
I think they are inherited by the parent process. An example using unshare:
> /sbin/sysctl -a --pattern 'net.ipv4.conf.all.forwarding'
net.ipv4.conf.all.forwarding = 1
> unshare -n
> /sbin/sysc... |
I think your surmise is correct, they are inherited from the parent namespace. This seems similar to how processes clone themselves using the fork() system call, then any desired changes have to be applied by the clone, using the normal system calls. (Including replacing the current program with a completely differe... | Default kernel parameters on new network namespaces |
1,592,146,650,000 |
I have my Linux root on an F2FS USB flash drive. The kernel is on another device accessible by the bootloader. I'm trying to start it with the parameters root=/dev/sda1 rootwait rootfstype=f2fs, but I always end up with a kernel panic:
VFS: Cannot open root device "sda1" or unknown-block(8,1): error -19
Please append ... |
As @derobert pointed out, you have to build the kernel with the F2FS module. In my case it wasn't even included as a loadable module.
To build the kernel yourself, grab it from kernel.org. Get the default kernel config for your platform. (I got mine from here for the TI-Nspire calculator series.) Modify it to include ... | Linux root on F2FS |
1,592,146,650,000 |
I'm using Arch on a very old computer with Chrome and it crashes pretty often, plus the CPU consumption is very high.
I read that using cfs-zen-tweaks could improve the responsiveness.
Which is better, using cfs-zen-tweaks or a linux-zen kernel? What is the difference?
|
I have an older laptop with low processing power as well, I use it on the go as it's very light and the battery lasts quite long. It wasn't unstable, though, but got unresponsive whenever I did an update in the background. I run Arch on it.
I moved from the vanilla kernel over to the cfs-zen tweaks, which made a diffe... | linux-zen VS cfs-zen-tweaks |
1,592,146,650,000 |
I thought it was NUL. But today when I wrote a script, I found that it was space. Is it configurable? Or just my memory wrong?
|
Maybe this has led to a mix-up in your memory:
In /proc/cmdline (i.e., command-line arguments for the kernel itself), arguments are separated by 0x20.
In /proc/some_process_id/cmdline (i.e., command-line arguments for individual user processes), arguments are separated by 0x00.
| Is Linux kernel parameters separated by space (0x20) or NUL (0x0)? |
1,592,146,650,000 |
My WiFi connection is frequently dropping. Are there any system settings to help with the problem?
|
A generic way to try to fix things is to increase the mac80211 kernel module parameters having to do with disconnections. From modinfo -p mac80211:
max_nullfunc_tries:Maximum nullfunc tx tries before disconnecting (reason 4). (int)
max_probe_tries:Maximum probe tries before disconnecting (reason 4). (int)
beacon... | System setting to stop WiFi from dropping connection? |
1,592,146,650,000 |
I need to disable retpoline for a use case. I tried adding noretpoline to the boot parameter but it doesn't seem to work.
The output after adding noretpoline param:
$ cat /sys/devices/system/cpu/vulnerabilities/spectre_v2
Mitigation: Full generic retpoline, STIBP: disabled, RSB filling
Kernel: 4.18.0-58.el8.x86_64
|
To disable retpoline, you need to disable the Spectre variant 2 mitigations using spectre_v2=off on the kernel command line. See the kernel’s list of parameters for details (that link is specifically for 4.18; for other versions, replace “v4.18” in the URL as appropriate).
| How to disable retpoline? |
1,592,146,650,000 |
The following output (from a Vagrant VM running CentOS 6.6) mostly speaks for itself:
[root@localhost ~]# echo 131072 > /proc/sys/fs/inode-max
-bash: /proc/sys/fs/inode-max: No such file or directory
[root@localhost ~]# sysctl -q -p
[root@localhost ~]# echo 'fs.inode-max = 131072' >> /etc/sysctl.conf
[root@localhost ~... |
The man page in man7.org and in Debian has a more useful description:
/proc/sys/fs/inode-max (only present until Linux 2.2)
This file contains the maximum number of in-memory inodes. This value should be 3-4 times larger than the value in file-max, since stdin, stdout and network sockets also need an inode to hand... | Why does the fs.inode-max kernel tunable not exist on version 2.6 of the Linux kernel? |
1,404,865,705,000 |
I created this file structure:
test/src
test/firefox
When I run this command:
ln -s test/src test/firefox
I would expect a symbolic link test/firefox/src to be created pointing to test/src, however I get this error instead:
-bash: cd: src: Too many levels of symbolic links
What am I doing wrong?
Can you not create... |
On the surface, what you've suggested you've tried works for me.
Example
$ mkdir -p test/src test/firefox
$ tree --noreport -fp
.
`-- [drwxrwxr-x] ./test
|-- [drwxrwxr-x] ./test/firefox
`-- [drwxrwxr-x] ./test/src
Make the symbolic link:
$ ln -s test/src test/firefox
$ tree --noreport -fp
.
`-- [drwxrwxr... | Too many levels of symbolic links |
1,404,865,705,000 |
I am facing some issue with creating soft links. Following is the original file.
$ ls -l /etc/init.d/jboss
-rwxr-xr-x 1 askar admin 4972 Mar 11 2014 /etc/init.d/jboss
Link creation is failing with a permission issue for the owner of the file:
ln -sv jboss /etc/init.d/jboss1
ln: creating symbolic link `/etc/init.d/j... |
On a Linux system, when changing the ownership of a symbolic link using chown, by default it changes the target of the symbolic link (ie, whatever the symbolic link is pointing to).
If you'd like to change ownership of the link itself, you need to use the -h option to chown:
-h, --no-dereference
affect each symbo... | How to change ownership of symbolic links? |
1,404,865,705,000 |
I'm trying to create a symbolic link in my home directory that points to a directory on my external HDD.
It works fine when I specify it like this:
cd ~
ln -s /run/media/name/exhdd/Data/ Data
However it creates a faulty link when I try this:
cd /run/media/name/exhdd
ln -s Data/ ~/Data
This creates a link that I cann... |
Here's what's happening. If you make a symlink with a relative path, the symlink will be relative. Symlinks just store the paths that you give them. They never resolve paths to full paths. Running
$ pwd
/usr/bin
$ ln -s ls /usr/bin/ls2
creates a symlink named ls2 in /usr/bin to ls(viz. /usr/bin/ls) relative to the di... | Create a symbolic link relative to the current directory |
1,404,865,705,000 |
I have used ln to write symbolic links for years but I still get the order of parameters the wrong away around.
This usually has me writing:
ln -s a b
and then looking at the output to remind myself.
I always imagine to be a -> b as I read it when it's actually the opposite b -> a. This feels counter-intuitive so I f... |
I use the following: ln has a one-argument form (2nd form listed in the manpage) in which only the target is required (because how could ln work at all without knowing the target) and ln creates the link in the current directory. The two-argument form is an addition to the one-argument form, thus the target is always ... | Tips for remembering the order of parameters for ln? |
1,404,865,705,000 |
In Arch Linux, if I do ls -l in /sbin, I can see that reboot, shutdown and poweroff are all symlinks to /usr/bin/systemctl. But issuing reboot, shutdown and systemctl commands obviously does not all have the same behaviour.
Is ls -l not showing me full information regarding symlinks? How can I, for example, know what ... |
Many programs make use of this technique where there is a single executable that changes its behavior based on how it was executed.
There's typically a structure inside the program called a case/switch statement that determines the name the executable was called with and then will call the appropriate functionality fo... | Why are reboot, shutdown and poweroff symlinks to systemctl? |
1,404,865,705,000 |
I have 2 questions. The first one is for the -sf options and the second one is for the more specific usage of -f options.
By googling, I figured out the description of command ln, option -s and -f.
(copy from http://linux.about.com/od/commands/l/blcmdl1_ln.htm)
-s, --symbolic : make symbolic links instead of hard link... |
First of all, to find what a command's options do, you can use man command. So, if you run man ln, you will see:
-f, --force
remove existing destination files
-s, --symbolic
make symbolic links instead of hard links
Now, the -s, as you said, is to make the link symbolic as opposed to hard. ... | Why use 'ln -sf' in Linux? |
1,404,865,705,000 |
I'm trying to create a bunch of symbolic links, but I can't figure out why this is working
ln -s /Users/niels/something/foo ~/bin/foo_link
while this
cd /Users/niels/something
ln -s foo ~/bin/foo_link
is not.
I believe it has something to do with foo_link linking to foo in /Users/niels/bin instead of /Users/niels/so... |
The easiest way to link to the current directory as an absolute path, without typing the whole path string would be
ln -s "$(pwd)/foo" ~/bin/foo_link
The target (first) argument for the ln -s command works relative to the symbolic link's location, not your current directory. It helps to know that, essentially, the cr... | ln -s with a path relative to pwd |
1,404,865,705,000 |
I created a symbolic link (yesterday) like this:
sudo ln -s bin/python /usr/bin/prj-python
When I run:
prj-python file.py
I get:
prj-python: command not found
When I try creating the link again, I get:
ln: creating symbolic link `/usr/bin/prj-python': File exists
Why is that happening? My $PATH is:
/usr/local/sb... |
You forgot the initial slash before bin/python. This means /usr/bin/prj-python now points to /usr/bin/bin/python. What would you like it to point to exactly?
| Executable symbolic link results in "command not found" |
1,404,865,705,000 |
> cd /tmp
> ln -s foo
> ls -alhF /tmp
lrwxrwxrwx 1 user user 3 Jul 29 14:00 foo -> foo
Is this a bug in ln or is there a use case for symlinking a file to itself?
This is with coreutils 8.21-1ubuntu5.1.
|
It's not a bug. The use case is for when you want to link a file to the same basename but in a different directory:
cd /tmp
ln -s /etc/passwd
ls -l passwd
lrwxrwxrwx 1 xxx xxx 11 Jul 29 09:10 passwd -> /etc/passwd
It's true that when you do this with a filename that is in the same directory it creates a link to itsel... | Why does ln -s accept a single argument |
1,404,865,705,000 |
Is there a way to replace the value of a symbolic link?
For example, I want to change a symbolic link from this:
first -> /home/username/foo/very/long/directories/that/I/do/not/want/to/type/again
to this:
second -> /home/username/bar/very/long/directories/that/I/do/not/want/to/type/again
I want to change only foo t... |
You can use the -f, --force option of ln to have it remove the existing symlink before creating the new one. If the destination is a directory, you need to add the -n, --no-dereference option to tell ln to treat the symlink as a normal file.
ln -sfn target existing_link
However, this operation is not atomic, as ln wi... | Is there way to replace value of symbolic link? [duplicate] |
1,404,865,705,000 |
Can someone give me a command that would:
move a file towards a new directory
and leave a symlink in its old location towards its new one
|
mv moves a file, and ln -s creates a symbolic link, so the basic task is accomplished by a script that executes these two commands:
#!/bin/sh
mv -- "$1" "$2"
ln -s -- "$2" "$1"
There are a few caveats. If the second argument is a directory, then mv would move the file into that directory, but ln -s would create a lin... | Move a file and replace it by a symlink |
1,404,865,705,000 |
I have a particular directory full of other directories organized (named) by date. For ease of reference, I have a symlink called current pointing to the latest one.
In the script that creates new date directories, I wish to create or fix the current symlink to point to the newest directory once created.
I thought th... |
In GNU's ln, there is ln -n, which would allow re-pointing a symlink:
$ mkdir dir1 dir2
$ ln -s dir1 sym
# dir1/
# dir2/
# sym -> dir1/
$ ln -nsf dir2 sym
# dir1/
# dir2/
# sym -> dir2/
BSD coreutils uses the flag -h the same way -n would be used, but it is likely the binary may support -n just for compatibility wit... | How to force creation of a symbolic link? |
1,404,865,705,000 |
From the man pages:
ln - make links between files
and
link - call the link function to create a link to a file
These seem to do the same thing however ln takes a lot of options as well.
Is link just a very basic ln? Is there any reason to use link over ln?
|
link used solely for hard links, calls the link() system function and doesn't perform error checking when attempting to create the link
ln has error checking and can create hard and soft links
| What is the difference between the link and ln commands? |
1,404,865,705,000 |
I am implementing a backup scheme using rsync and hardlinks. I know I can use link-dest with rsync to do the hardlinks, but I saw mention of using "cp -l" before "link-dest" was implemented in rsync. Another method of hardlinking I know of is "ln".
So my question is, out of curiosity: is there a difference in making h... |
The results of both has to be the same, in that a hard link is created to the original file.
The difference is in the intended usage and therefore the options available to each command. For example, cp can use recursion whereas ln cannot:
cp -lr <src> <target>
will create hard links in <target> to all files in <src>.... | Is there a difference between hardlinking with cp -l or ln? |
1,404,865,705,000 |
I want to create a symlink
~/.pm2/logs -> /opt/myapp/log
When I run
ln -sFf /opt/myapp/log ~/.pm2/logs
I get a symlink
~/.pm2/logs/log -> /opt/myapp/log
which is not what I want.
I'd prefer a POSIX-compatible solution if possible.
|
You already have a directory at ~/.pm2/logs. Since that directory exists, the symbolic link is put inside it.
Would you want that ~/.pm2/logs is a symbolic link rather than a directory, then you will have to remove or rename that existing directory first.
| How to create a folder symlink that has a different name? |
1,404,865,705,000 |
It seems like it should be simple to symlink one file to a new file in a subdirectory.... ....without moving subdirectories. But something about the syntax is perplexing and counter to what I would expect. Here's a test case:
mkdir temp
cd temp
mkdir deploy
echo "Contents of the build file!" > deploy/resources.build... |
But something about the syntax is perplexing and counter to what I would expect.
The arguments for ln, in the form that you're using it, are:
ln [OPTION]... [-T] TARGET LINK_NAME (1st form)
The perplexing, unintuitive thing is that when you're creating a symlink, the target argument for ln isn't expected to be a... | Symlink aliasing files in subdirectories without changing current directory |
1,404,865,705,000 |
After I make&make install vim from source, I found many symbolic links of vim in /usr/local/bin, such as evim, rvim, view...
The vim(1) man page said that "rvim" is equivalent to "vim -Z" and so on.
Now I wonder: can I make such a symbolic link with ln(1) myself, and if so, how?
|
You can't without writing a bit of code.
Those symlink shortcuts work because vim is written that way. It looks at how (with what name) it was started and acts as if it had been called with the appropriate command line options.
This behavior is hardcoded in the executable, it is not a trick done by the symbolic link.
... | How to make a symbolic link to /usr/bin/vim but with start-up parameters? |
1,404,865,705,000 |
When I wanted to create a hard link in my /home directory in root mode, Linux showed the following error message:
ln: failed to create hard link ‘my_sdb’ => ‘/dev/sda1’: Invalid cross-device link
The above error message is shown below:
# cd /home/user/
# ln /dev/sda1 my_sdb
But I could only create a hard link in the... |
But I could only create a hard link in the /dev directory and it was not possible in other directories.
As shown by the error message, it is not possible to create a hard link across different filesystems; you can create only soft (symbolic) links.
For instance, if your /home is in a different partition than your ro... | Why I can't create a hard link from device file in other than /dev directory? |
1,404,865,705,000 |
So I'm writing a small package manager, and a problem I've run into is making the symbolic links to files.
It installs the package to /usr/pkg/name-version, and then reads a file to determine what symbolic links to make. I'm using ln to make the links, and I've run into a problem when trying to install the Linux API h... |
You won't need a convoluted bash script, but a simple one-liner. mkdir --parents will take care of everything, nicely not even printing an error if the directory structure already exists.
Just be careful with how you treat these directories on removal, so you don't break other packages.
Also, since you're writting it ... | Use `ln` to create a missing directory |
1,404,865,705,000 |
I am trying to create a symlink of a file on one linux workstation to another linux workstation, without having to 'mount' any network shares. Here's what I am trying to do, but can't get it to work.
ln -s /link/to/local/file.mov //10.0.1.103/sharedFolder/symlinkFile.mov
|
You can't:
A symlink is simply an extra inode (a structure that points to the file) and this inode consists of, amongst other things, a deviceId and an inode pointer. The deviceId effectively points to a device special file within the /dev directory and the inode pointer points to a block on that device.
Your network... | Symlink from one workstation to another without mount |
1,404,865,705,000 |
I have multiple hard drives with the same directory hierarchy, for example:
/media/sda/dir1
/media/sda/dir2
...
/media/sdb/dir1
/media/sdb/dir2
Two hard drives with similar names and similar directory names.
I want to create separate symbolic links to dir1 and dir2 on every hard drive.
The easiest way I have found is... |
You might want to do that:
for dir in dir1 dir2
do
[[ ! -d /somedir/$dir ]] && mkdir /somedir/$dir
find /media/sd*/$dir -type f -exec bash -c \
'[[ ! -f /somedir/'$dir'/$(basename $1) ]] && ln -s $1 /somedir/'$dir'/' foo {} \;
done
This create symbolic links in /somedir/dir1/ (resp. dir2) pointing to all ... | Create symbolic links with wildcards |
1,404,865,705,000 |
Original Problem
I have a file on one filesystem: /data/src/file
and I want to hard link it to: /home/user/proj/src/file
but /home is on one disk, and /data is on another so I get an error:
$ cd /home/user/proj/src
$ ln /data/src/file .
ln: failed to create hard link './file' => '/data/src/file': Invalid cross-device ... |
There's a disappointing lack of comments in the code. It's as if no-one ever thought it useful, since the time bind mounts were implemented in v2.4. Surely all you'd need to do is substitute .mnt->mnt_sb where it says .mnt...
Because it gives you a security boundary around a subtree.
PS: that had been discussed q... | Why can't I create a `hardlink` to a file from a "mount --bind" directory on the same filesystem? |
1,404,865,705,000 |
When running (on linux different ubuntu variations):
>ln -s dir_1 symlink_dir
>ln -s dir_2 symlink_dir
It fails without telling that it fails. But if you do the same thing on a file instead or, add v to the option it does tell you that it fails:
>ln -s file_1 symlinkg_file
>ln -s file_2 symlinkg_file
or
>ln -sv dir_... |
Because in the second ln it doesn't fail it creates a
symlink_dir/dir_2 -> dir_2
symbolic link
Do a:
ls -l symlink_dir/dir_2
And you'll see a (probably broken) symlink there.
That's how ln is meant to work if the target is a directory (or a symlink to a directory).
A third ln could fail because there's already a di... | Why doesn't ln -s tell that it fails when creating a symlink to an existing symlinked directory? |
1,404,865,705,000 |
I have an issue with ln -s on Ubuntu 14.04, while using it in the following scenario:
$ cd ~/programming/tmux/
$ ln -s tmux ~/bin/tmux
$ ls -l ~/bin/tmux
lrwxrwxrwx 1 USER USER 4 sie 31 11:02 /home/USER/bin/tmux -> tmux
Why is it like so? When I create it giving the absolute path everything works fine:
$ ln -s ~/pr... |
When you write
ln -s VALUE link_name
it creates a symbolic link with value VALUE. This is what you got. If you want to create a relative link, it is best to cd to the directory where you want to put the link:
$ cd ~/bin
$ ln -s ../programming/tmux/tmux .
Shell completion will help you.
| Why ln -s creates relative broken links? [duplicate] |
1,404,865,705,000 |
I'm refreshing my understanding of a few basic GNU/Linux commands that I admit that I never really understood fully for the last 20+ years.
$ man ln in part says:
-n, --no-dereference
treat LINK_NAME as a normal file if it is a symbolic link to a directory
To try to understand this better, I broke this dow... |
Without -n, both your ln commands would create links inside dir2: if LINK_NAME exists and is a directory or a symlink to a directory, the link is created inside the directory (if possible).
That’s what -n changes here: ln won’t consider LINK_NAME as a directory (if it’s a symlink). Since LINK_NAME already exists, ln f... | What is `ln --no-dereference` supposed to do? |
1,404,865,705,000 |
Symbolic links do take room, of course, but just the room it takes to store
the name and target plus a few bytes for other metadata
Do symbolic links actually make a difference in disk usage?
My question is, can we determine how many bytes a symlink is taking up?
$ touch alfa.txt
$ ln -s alfa.txt bravo.txt
Both d... |
Sort of, but note that the size of a file is not well-defined at that level of precision.
A symbolic link involves four parts:
The name of the link, which is stored in the directory where it is an entry.
Other metadata that is present for every directory entry, to locate the rest of the metadata. This is typically th... | Size of symlink |
1,404,865,705,000 |
Having a (single, no batch filesystem processing needed) symlink, what a command line to use to turn it into a hard link to the same file?
|
ln -f "$(readlink <symlink>)" <symlink>
| How to replace a symbolic link with an equivalent hard link? |
1,404,865,705,000 |
Is there a way to create a symlink whose target does not exist using shell scripts?
From reading man 1 ln, I do not see an option to do so; and even -f checks if the target exists.
Is there a way to achieve what I'm looking for?
|
When you run
ln -s nonexistenttarget link
ln doesn’t check whether nonexistenttarget exists, it creates the link, unless link already exists. -f works around the last part by deleting link if necessary.
The impact of a non-existent target is only felt when a program tries to dereference the link, e.g. by opening it:
... | Is there a way to create a symlink to a non-existent target? |
1,404,865,705,000 |
I understand the reasoning why nearly every unix version doesn't allow hard-linking of directories (in fact HFS+ on OS X is the only one I know, but even that isn't made easy to do yourself). However, all file-systems in theory support hard-linked directories, as all directories contain at least one extra hard-link to... |
Don't do this. If you want to have a backup system using hard links to save space, better to use rsync with --link-dest, which will hard link files appropriately to save space, without causing the problems that this causes (that is, hard linking between directories is a corruption of the filesystem, and will cause it ... | Forcibly create directory hard link(s)? |
1,404,865,705,000 |
I have a cluster with a bunch of servers with a shared disk containing a GFS global file system that all nodes access simultaneously.
Each node in the cluster run the same program (a shell script is the main core).
The system processes files that appear in a couple of input directories, and it works like this:
the pr... |
The link() system call on the NFS client should map directly to the NFS LINK operation, which the server should implement using its link() system call. So as long as link() is atomic on the server, it will also be atomic on the clients.
| Is `ln` atomic and reliable on NFS? Could NFS replace GFS in this use case? |
1,404,865,705,000 |
Let's suppose I have one file and one directory:
$ ls -l
total 4
drwxrwxr-x. 2 user user 4096 Oct 8 09:53 dir
-rw-rw-r--. 1 user user 0 Oct 8 09:53 file
I created a symlink to file called symlink1, and a symlink to dir called dirslink1:
$ ls -l
drwxrwxr-x. 2 user user 4096 Oct 8 09:53 dir
lrwxrwxrwx. 1 user use... |
-L only works with hard links; as specified in POSIX:
If the -s option is specified, the -L and -P options shall be silently ignored.
If you have readlink you can use that:
ln -s -- "$(readlink symlink1)" symlink4
If your readlink supports the -f option, you can use that to fully canonicalise the target (i.e. resol... | ln: create symlink using another symlink |
1,404,865,705,000 |
Say I have the following setup :
$ cat fileA
textA
$ cat fileB
textB
$ ln fileA myLink
$ cat myLink # as expected
textA
I do not understand the following behaviour :
$ cp fileB fileA
$ cat myLink # expected ?
textB
I would have expected this outcome if I had written ln -s fileA myLink instead, but not here.
I would... |
There is no "following the link" with hardlinks - creating a hardlinks simply gives several different names to the same file (at low level, files are actually integer numbers - "inodes", and they have names just for user convenience)- there is no "original" and "copy" - they are the same. So it is completly the same ... | cp overwriting without overwriting hardlinks to destination |
1,404,865,705,000 |
It is easy to convert a symlink into a hardlink with ln -f (example)
It would also be easy to convert a hardlink (filenames link and original) back to a symbolic link to link->original in the case where you know both files and define yourself which one is the "original file". You could easily create a simple script co... |
I created a script that will do this. The script converts all hard-links it finds in a source directory (first argument) that are the same as in the working directory (optional second argument) into symbolic links:
https://gist.github.com/rubo77/7a9a83695a28412abbcd
It has an option -n for a dry-run, that doesn't do a... | Convert a hardlink into a symbolic link |
1,404,865,705,000 |
On a Linux machine (a computing cluster, actually), I copied a folder from another user (who granted me permissions to do so using the appropriate chmod).
This folder contains symbolic links to files I cannot access. I want to update them so that they point to copies of the same files, that I own.
However, when I try ... |
It appears as if the GNU ln implementation on Linux uses the stat() function to determine whether the target exists or not. This function is required to resolve symbolic links, so when the target of the pre-existing link is not accessible, the function returns EACCESS ("permission denied") and the utility fails. Thi... | Why permission denied upon symbolic link update to new target with permissions OK? |
1,404,865,705,000 |
I have two directories: /all/origins/ & /all/links/.
Everything in links/ points individually to something in origins/, but not everything in origins/ is linked in links/. (Squares, rectangles & categorical hierarchy, get it?) These are symlinks (ln -s), not hard links.
Everything in 1. links/ needs to be deleted, al... |
First take backup of your data in case something goes wrong.
What I understood is that you want to delete all the contents of /all/links/ directory and the file to which the links inside this directory are pointing.
There is no way to do this with a simple Unix command as you preferred, but it will work with a simple ... | rm to remove a dir, any symlinks, AND symlink destinations? [duplicate] |
1,404,865,705,000 |
Is it possible to create a symbolic link to an executable that executes it with a certain option/argument?
I know a workaround would be to create a bash script in one of the PATH directories but can I achieve it somehow with a symbolic link?
EDIT: Thanks for the answers, in my case an alias wouldn't do the job because... |
No, a symbolic link is a type of file that references the path of another file.
Now, if you do:
ln -s /bin/cat foo
And invoke foo as:
$ ./foo -A /proc/self/cmdline
./foo^@-A^@/proc/self/cmdline^@
You'll notice that the first argument that cat/foo received was ./foo and not cat. So, in a way, through that symlink, we... | Symbolic link with option |
1,404,865,705,000 |
I created a soft link with following command:
ln -s "/media/Eric/node/language/1-1.English/space@English/7-2 IELTS" ~/desktop/IELTS
On my desktop, when click to open the IELTS dir, the path is /home/eric/Desktop/IELTS.
I want the path to be the original path /media/Eric/node/language/1-1.English/space@English/7-2 IEL... |
short: no, you cannot do it this way
long: a desktop launcher may work for you.
Unix-style symbolic links have only a target directory; there is no separate property for source directory. You can read about symbolic links in
What is a symbolic link made from? Understanding the structure of symlinks
Advantage of syml... | Is it possible to create a soft link on my desktop which opens with the target path instead of the link's path? |
1,404,865,705,000 |
as the answer to this question shows,
Is there a difference between hardlinking with cp -l or ln?
The purpose for creating the -l option for the cp command is to recursively hard-link (the contents of) directories. The -s option is the counterpart, creating soft links instead of hard links, but it appears that it ca... |
Given an absolute path to the source directory:
cp -rs $PWD/sourcedir/ targetdir/
The symbolic links in targetdir will then contain absolute paths to sourcedir.
Otherwise, if it just made a symbolic link, it would create something like:
targetdir/filename -> sourcedir/filename
But that isn't the correct relative pat... | what is the purpose of cp -s? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.