date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,382,994,068,000
I have a fresh install of Ubuntu 16.04.1 with nginx installed, and when dpkg installed nginx, it registered the boot time config in two locations. Systemd location systemd config which states to start nginx daemon on boot (or "multi-user target") % ls -l /etc/systemd/system/multi-user.target.wants/nginx.service ...
As jordanm comments, this is inherited from Debian where different init systems are supported. Not only that, but you can change your init system without reinstalling, and expect your configuration to survive — including which services are enabled or disabled. That’s the reason why the systemd and sysvinit setups are ...
Ubuntu 16.04.1: Why are some programs started by both systemd AND initV systems?
1,382,994,068,000
The official Gentoo Dockerfile contains this line: RUN sed -e 's/#rc_sys=""/rc_sys="docker"/g' -i /etc/rc.conf As of the present time, Gentoo's default init is OpenRC. If I run the docker image with CMD /sbin/init, issuing OpenRC-type commands gives the response You are attempting to run an openrc service on a syste...
If you look at many of the boot runlevel init scripts, such as /etc/init.d/hostname, you will see a block as follows: depend() { keyword -docker -lxc -prefix -systemd-nspawn } This states that the init script should NOT be used automatically on any of those system types (you can see the manpage openrc-run(8) for...
What effect does rc_sys="docker" have?
1,382,994,068,000
I've a RaspberryPi, and I would like to run a nodeJS script (running a server), and then open Chrome when the server has been launched. Currently, I launch my nodeJS script thanks to a script in /etc/init.d and chromium thanks to a line in /etc/xdg/lxsession/LXDE/autostart The problem is chromium is launched BEFORE m...
Invoke chromium on a local HTML file that looks like this: <script> function vico_func() { location = "URL_to_your_server"; } setTimeout(vico_func, 3000); </script> setTimeout(some_function, delay) is like the at command — it schedules the function to be called in the future, after a delay, which is expressed in ...
Launch node & chrome after system boot
1,382,994,068,000
Theoretical question, but for example, is it possible to hibernate on a laptop and boot into that image on a desktop which could have otherwise identical configuration in terms of distro/config files. The practical application for this would be to transfer all running programs from a laptop to a desktop for greater pe...
This is indeed possible through the magic of virtualization. See, for example https://www.usenix.org/legacy/event/hotos09/tech/full_papers/kozuch/kozuch_html/index.html and https://en.wikipedia.org/wiki/Live_migration which contains a list of virtual machine managers that support live migration.
Transfer running instance of OS to another machine
1,382,994,068,000
I have a live-boot USB with Linux Mint 19.1 Cinnamon, I placed the boot image with Rufus and it has worked without problems on other machines. Now I have built a PC with various parts I've found on my shelf. Specs: Motherboard: Gigabyte GA-970A-DS3P Rev 1.0 (BIOS Version F1) RAM: Kingston HyperX 8G (4G+4G kit) CPU: A...
OK, I managed to install Pop!_OS 19.10 to the PC now, though it first did not want to do it (somehow Rufus does not flash the image properly, had to use Etcher). SUMMARY: NTFS-problem => just wipe the disk Medium not found => change from USB3.0 to USB2.0 Mouse/Keyboard not responding after boot => enable IOMMU (might...
Linux Mint Live USB wont boot. /Init line 7. Can't open sdb. No medium found
1,513,338,265,000
Whenever I boot my gentoo laptop, openrc hangs forever in the "Caching service dependencies..." stage. This causes my computer to be unbootable unless I use a sysrq key to kill it and manually boot the system. Using ps as a diagnostic tool, I found that the grep and cut programs (children of a script gendepends.sh) we...
These commands don't hang out of nowhere; they must have been invoked by some init script, but perhaps with wrong parameters or expecting non-existent data. I can imagine that they wait for some input which just isn't provided. In the output of ps -ef you find the ID of the parent process (PPID), which is probably the...
Gentoo's openrc hangs forever in "caching service dependencies..."
1,513,338,265,000
I have a Stretch system n which I would like to replace agetty with ngetty (for various reasons like because I have no use for serial lines, and I like the way ngetty can be configured, for examples). I know how to do that in runit or sysvinit, but I can't find where the info is with systemd. I can find nothing which...
Seems like you may be on a virtual environment where getty is useless. You may switch to mingetty (default at Amazon AWS now), which uses minimal resources and still be able to look at the "Console Logs" (via Amazon vm GUI ..eeeek). To switch from agetty to ngetty or mingetty, (you just need one): # apt install mgett...
how to change the getty binary in Debian Stretch?
1,513,338,265,000
So, I have a problem with the partitions setup of my laptop. I will try to include as many details as possible in order to make it easier to help. In the past, I had an ubuntu 15.10 system on my laptop with 2 identically sized drives. These were both identically formatted with 2 partitions each, one for /boot and one ...
The question is answered by myself now! The problem was that the crypttab entry for the second container was invalid. Even though I double-checked, I missed the error, and the update-initramfs didn't complain either. What do I take away from this? Always triple- or quadruple-check such critical things, as it can often...
Cryptsetup: LVM is missing (on a system without LVM)
1,513,338,265,000
If you want to customize the colors in Emacs, specifying them in the .emacs init file, without installing any extra package, and without using a pre-made theme, something like this seems to work: (set-background-color "#003c3c") (set-foreground-color "#ffffff") (set-face-background 'fringe "#253c3c") (set-face-backgro...
If you type M-x customize-face RET and then hit TAB, the completion window will provide a list of all faces, and you could copy the list from the completion window. Or you could hit RET, and then you would be brought into the Emacs face customization interface, where you can change the colors and save them. This does...
Emacs, complete list of color "keys"
1,513,338,265,000
I'm running Debian Weezy on an ARM board. Right now I'm working around an issue with my network driver by running an ethtool command that limits the Ethernet interface to 100 megabit. However, the issue with the driver manifests itself as early as DHCP negotiation, so I need to run ethtool before dhclient runs. I've...
It should be possible to bring up the eth as "manual" then apply whatever arbitrary scripts you want to run, including sleeps to slow things down, and then call for dhclient at the end. On Ubuntu it would look like this in /etc/network/interfaces auto eth0 iface eth0 inet manual pre-up /etc/network/pre-up-scripts/eth0...
Executing a command after eth0 is available, but before DHCP client
1,513,338,265,000
In old 5.3 rhel, we used to define the number of terminals and their respawn settings in /etc/inittab file as below. 1:2345:respawn:/sbin/mingetty tty1 1:2345:respawn:/sbin/mingetty tty2 1:2345:respawn:/sbin/mingetty tty3 1:2345:respawn:/sbin/mingetty tty4 ....etc for 12 terminals In new RHEL 6.4, we need to define ...
Unfortunately this is more involved than just editing the /etc/inittab now. I found 2 examples that were helpful: Replacing TTY with a script in CentOS 6 RHEL 6 Tech Notes Deployment The gist, modify this file: /etc/init/start-ttys.conf: script . /etc/sysconfig/init for tty in $(echo $ACTIVE_CONSOLES) ; do ...
How to disable respawn for terminal?
1,513,338,265,000
We have an embedded version of Meego Linux running on an x86 chip-set that currently uses X11 as the window technology. For various reasons we want to remove X11 from the mix (along with mutter, we are using clutter as a graphic toolkit). However, our main web browser needs to run in a X11 window. So far we have kept...
startx is just a script that wraps xinit and sets up an environment. You can probably copy it from just about any regular Linux install and customize it to your needs. If you're also missing xinit, all it does is run /usr/bin/X :0 and xterm when invoked without options (it's only slightly fancier when wrapped by start...
How to enable and disable X11 outside of init
1,513,338,265,000
I have a systemd service named webserver.service that is wanted by multiuser.target (enabled by default on system). I have another service under another target named test.service that I want to run after webserver.service. Within test.servive I’m adding: After=webserver.service Is it enough or should I add following ...
Short answer: yes. Before and After in systemd are interpreted purely for timing, they don't start services. You generally want a Wants or Requires or BindsTo in order to start a service. People rarely have a purely-timing requirement. Long answer: The Wants link from the Target unit (that was probably installed by t...
Systemd: should I use wants/requires for already enabled service listed in After=
1,513,338,265,000
Probably this is a really naïve question, but I can’t make this work by trying the methods I’ve found in the existing documentation or in other solutions. I have Alpine Linux installed on a Raspberry Pi, which SD card is formatted to have the usual boot partition and an ext4 to host /, I added a swap partition since m...
Doing something completely different I ran into the solution, and it works! I feel extremely silly since it was something as trivial as just declare this in the terminal: rc-update add swap boot And now the swap activates as intended! I’ll just leave this in case anyone runs into a similar issue I guess…
Alpine Linux in Raspberry Pi not activating swap partition on boot
1,513,338,265,000
In a minimal Busybox-based Linux system, which commands must be invoked as part of the init script to ensure all kernel modules for the current hardware are loaded?
After going down the rabbit hole, assuming a minimal initramfs with some drivers built into the kernel and others present as kernel modules along with all relevant depmod-generated metadata, here is what I found: Drivers built into the kernel are loaded before /init is invoked. Drivers built as modules must be loaded ...
How to load kernel modules for current hardware in init of minimal Busybox-based system
1,513,338,265,000
So, recently I was doing the Linux from scratch project and I had multiple terminals open, so I was continuing to make it, and by accident I typed the line in another terminal tab (root), and it messes up symlinks completely!, I can't run any commands on bash. case $(uname -m) in i?86) ln -sfv ld-linux.so.2 $LFS/...
What to recover The LFS variable was presumably unset when you ran this command. So it modified /lib64/ld-linux-x86-64.so.2 and /lib64/ld-lsb-x86-64.so.3. You've corrupted the dynamic loader. As a consequence, you can't run any dynamically linked program. Pretty much every program is dynamically linked, including bash...
switch_root: failed to execute /sbin/init: Too many levels of symbolic links
1,513,338,265,000
We recently moved our development infrastructure from our own old machines running Ubuntu 12.04 to Google Cloud instances running Ubuntu 18.04. Developers usually start some screens and run django servers within those screens. For example, one may create a screen screen -S webserver_5552 and run its django development...
I found the root cause. When re-attaching the screen, SIGWINCH signal got sent to the parent django process. The process don't handle it and just crashes, leaving the child orphan. This can then be easily retriggered by resizing the term or using kill -28 PID. I am not sure why it only happens on the GCP instances tho...
Process ownership automatically changes to init process on GCP Ubuntu 18.04LTS
1,513,338,265,000
On Kali Linux 2, before you are greeted with the GUI login screen, there is some pre-GUI text that scrolls on the screen. It shows you what modules and programs are working correctly, which ones failed, etc. Well, OpenVas always failed, so I did some commands to make it not fail, and now there is no text at all. That ...
You have to edit the /etc/default/grub file: remove quiet from GRUB_CMDLINE_LINUX_DEFAULT. After that, run update-grub.
Kali Linux 2.0 - Startup Text has disappeared
1,513,338,265,000
Given that a simple program: /* ttyname.c */ #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <errno.h> int main(int argc, char **argv) { char **tty = NULL; tty = ttyname(fileno(stderr)); if (tty == NULL) { fprintf(stderr, "%s\n", strerror(errno)); exit(EX...
If you're invoking it as init then you're not getting output to the screen; the output is being sent to the kernel and the kernel is printing it to the screen. init is a special process You can think of this as similar to the following shell script: $ x=$(ttyname 2>&1) $ echo $x Inappropriate ioctl for device This i...
Why can fprintf(stderr, ....) output to screen when stderr doesn't refer to a terminal device?
1,513,338,265,000
In sysvinit, telinit is a symlink to init. init is run as a daemon. Is telinit run as a daemon? I don't have sysvinit installed on my Lubuntu. For comparison, systemctl plays similar role to systemd as telinit to init, and systemctl has a controlling terminal so is not running as a daemon, while systemd is run as ...
Whether a file is a symlink to another one has no bearing on how it runs. telinit, like systemctl, runs as a “normal” process.
Is telinit run as a daemon?
1,386,587,555,000
Exploring amazing Book How Linux Works by Brian Ward I usually have no question. But this one. At the "6.7.0 Shutting Down Your System" there is an ordered list of jobs. After remount root file system in ReadOnly mode (6) write buffered data by the sync program (7). How is it possible to write data in a file system af...
There's the filesystem driver (which translates blocks on some block storage medium into directories and files), and there's a caching layer beneath that (so that you can quickly write data to the storage medium, and continue doing other things, while the kernel actually takes care of getting the data written to the s...
Shut down actions order: write buffers after RO root remount
1,386,587,555,000
Let us say I have a custom init like this #!/bin/bash sleep infinity Which of these will load init #!/bin/bash /sbin/init sleep infinity #!/bin/bash exec /sbin/init sleep infinity I know that exec is supposed to start a new shell but is it necessary?
It is actually very normal to invoke init from a script. Common bootloader scripts will properly mount the root disk and then run init. To invoke init as init, and not as telinit, it must be run as PID 1. Thus you need the exec. Thus, only your (2) script is potentially useful to run init. After an exec, the sc...
Can I call /sbin/init from init script
1,386,587,555,000
If you build a custom GNU/Linux system for an embedded device, do you need to execute mount -t proc proc /proc mount -t sysfs sysfs /sys somewhere in init process or is this done automatically by the kernel? I've read contradicting statements about this. An embedded Linux book advises to run the commands in init scri...
If you have systemd, it does that automatically (and some extra mount points as well, including /dev/, /dev/shm, /dev/pts, /run and even /tmp). If you have a different init system, you'll have to do that according to its documentation, most likely manually using /etc/fstab or/and scripts. Here's what gets mounted on F...
Who mounts /proc and /sys in GNU/Linux systems?
1,386,587,555,000
So I am working on building minimal os using busybox. What I want is I want to run my .net program from BIOS. But I am not sure linux will run .net program or not, so to clear my path I am using C program instead of .net program. I am generating initrd.img file successfully. Now before generating initrd.img file. I wa...
Your script is failing because you don’t have gcc in your initrd. You should not ship hello.c in your initrd; you should build the program and ship that instead in your initrd. You should also specify the full path to your program when attempting to run it.
How to integrate C program with init file?
1,386,587,555,000
I'm learning about how Linux works and for that I'm watching Tutorial: Building the Simplest Possible Linux System by Rob Landley. He basically goes through some steps to build a minimal system and around 20:00 he starts explaining about building a "hello world binary" that he will later use as the init program for th...
The init program can be anything that the internal kernel code which backs the execve system call can run. Many systems use a shell script, but it could even be a python script. The advantage of the init program being a statically linked binary is that it has less dependencies, so you don't require to have the run tim...
Why do I have to statically link a c program if I want to use it as the init program for the kernel?
1,386,587,555,000
I created a 1 line shell script to send me some custom notifications, and it works as intended. I placed the script in /etc/init.d/, ran update-rc.d scan defaults. After reboot, the notifier script is working properly. However systemd-analyze blame reports that the system is still booting for up to 5 minutes after I'm...
Can you get the script to fork? Add a & to the line of code. Look up job control in the bash manual, to find out more. Job control does a little more than a fork (if in an interactive shell).
Init script still running after boot
1,386,587,555,000
I'm trying to install freeBSD onto a VPS (OVH provider). So far, the third method from this response has come the closest to getting me where I want to go. I think OVH has a problem with nested virtualization, because the methods where I boot the installer from QEMU in rescue mode just haven't worked. The command: # ...
Reboot in rescue mode from OVH's management panel. Once logged in (via SSH or KVM, either works), perform the following sequence of commands Unmount your original filesystem with umount /dev/sdb*. Note that the rescue system is mounted from /dev/sda. Don't touch /dev/sda. Destroy your original filesystem and the p...
Where should I `dd` mfsBSD to get it to boot correctly?
1,386,587,555,000
I was trying to find out how to run a script at startup and during shutdown during which I got to know that level 6 corresponds to reboot in ubuntu. When I opened the /etc/rc6.d every link's name started with K which is for kill I suppose.
The K does indeed stand for “kill”. The symlinks link all the init scripts which are supposed to be called to stop the corresponding service when the system switches to runlevel 6; this tries to ensure that all the system’s services are stopped correctly before the system reboots. Each link is called with a stop argum...
Why do all the links in /etc/rc6.d start with K if runlevel 6 corresponds to reboot?
1,386,587,555,000
Looking in my /etc/inittab file I see the following entry: ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now What do the -t1 and -a options mean? They do not appear in the manual for the shutdown command. I have also seen another /etc/inittab in a reference book that shows: ca::ctrlaltdel:/sbin/shutdown -r -t 4 now S...
Those options are options to the sysvinit version of shutdown (see the relevant manpage): -t sec Tell init(8) to wait sec seconds between sending processes the warning and the kill signal, before changing to another runlevel. -a Use /etc/shutdown.allow. This version of -t is also valid in your second example, which ...
Understanding shutdown command in inittab
1,386,587,555,000
I have a couple of questions concerning qemu boot options 1) When using the following argument init=/bin/sh It works - but is really the init-process replaced by a sh-process? Qemu-system-x86_64 -hda output/images/rootfs.ext2 -kernel output/images/bzImage --append "root=/dev/sda console=ttyS0 rw init=/bin/sh" -serial...
Yes. When you tell the kernel to use /bin/sh as init, then it does exactly what you tell it to. /bin/ls runs and then exits, so the kernel panics because there is no init process any more. init is supposed to be a long-lasting process.
Qemu - substitute the init process
1,386,587,555,000
I have a very simple SysVinit service in /etc/rc.d: #!/bin/bash PIDFILE="/var/run/test.pid" status() { if [ -f "$PIDFILE" ]; then echo 'Service running' return 1 fi return 0 } start() { if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")"; then echo 'Service already running' return 1 fi e...
It looks like Synology moved from classic SysVinit to upstart in DSM 6 or so, and then to systemd in DSM 7. Both init systems provide backward compatibility for classic SysVinit-style start/stop scripts, but there are some quirks you should be aware of. If you have DSM 7.0 or newer, then after installing the script yo...
Stop not called for init rc.d service
1,386,587,555,000
I have an old embedded control system that still uses a 2.6 kernel and runs Debian 4. I am looking for a way to display a message whenever the superuser calls (interactively) reboot, shutdown, poweroff or halt. The message only needs to appear on the interactive terminal that the command is sent from. Essentially, I w...
Shutdown and so on usually progress through telinit setting the runlevel to 6 or 0, and this calls the kill scripts in /etc/rc6.d/K* so you could add a wall command to one of those scripts in the stop section.
How can I configure shutdown, reboot etc. to display a message on an old (2.6) Linux?
1,386,587,555,000
I'm trying to write an init, but can't figure out the reboot\poweroff thing. apparently reboot is just a link to systemctl? (I'm using arch) So how does this work? init poweroff works and stuff, but reboot/poweroff just seems to be linked to systemctl
Many programs behave differently depending on the name with which they are called. Something like systemctl inspects the value of argv[0] and behaves differently if it is reboot vs if it is systemctl. You can see this taken to the extreme with busybox, which is a single binary that provides almost an entire (minimal) ...
making an init: how exactly does the reboot command work?
1,386,587,555,000
I have a script in /etc/rc.d/init.d/ on a Red Hat 7 system that is provided by a vendor. This script is able to be started and stopped via systemctl, but it appears to not actually be a systemd unit file. The script depends on a drive being mounted on boot by a systemd unit file. However, this init script tries to sta...
SysV init scripts are auto-converted by systemd into systemd Unit files. See man systemd-sysv-generator. You would like to edit the generated Unit to add a suitable dependency for the mount point. You can do this by creating a "drop-in" file with just a few extra lines. If your init file is called, say, /etc/rc.d/init...
Require systemd service to be started before executing init.d script
1,386,587,555,000
Forgive me if this is a noob question, however, I just installed Artix with OpenRC, and while following the guide on setting up ALSA with OpenRC from the gentoo wiki, I was told to add the alsasound service to OpenRC using: rc-update add alsasound boot I was about to do this, until I realized that Pulseaudio and ALSA ...
aplay -l only needs the kernel modules, which can be autoloaded by the kernel if your sound card/chip is PCI-based or otherwise autodetectable by the kernel (or listed in device tree information if you have an ARM system, I guess?). But the autoloading may not take care of restoring your sound mixer settings, so every...
ALSA and PulseAudio starting without being invoked by init system?
1,386,587,555,000
I am learning Linux, using Ubuntu. I wanted to remove network management from one of the run levels. I had done this correctly before, but now, no matter how hard I try, I can not remove a script from the desired run levels. the rc3 folder is empty so how can I work on run level 3?!
Yes, with version 15.04 Ubuntu switched to systemd. The rcX.d folders are mostly obsolete. You can use a configuration command like sudo systemctl disable network-manager.service to disable the network manager (which should leave the networking mostly unconfigured). There are no runlevels in systemd, but an equivalent...
Are RC folders obsolete on Ubuntu?
1,386,587,555,000
Assuming that I decide, for some reason, to never use the syscall wait ever again in any of the programs I write. Does it mean that my memory will be cluttered with all the finished processes that their father didn't wait for? This is a part of an academic assignment and I find the question a bit perplexing because bo...
At some point, the init process will hold more processes than it can - regarding memory limits. Not quite: zombie processes (processes which have exited but haven’t been reaped) don’t occupy memory in their parent process; they occupy memory in the kernel’s process table. If your init is a “standard” init, it will r...
Zombie processes and exiting init
1,386,587,555,000
Recently encountered a problem: when entering init 1, it gives an error: init: must be run as PID 1. I Entering ps and it turns out that /sbin/init has PID 1. How now can I use init?
You cannot use init. It is the wrong program for the job. You need to un-learn the idea that init can be invoked as a normal command. The init programs where this is/was true are not the init program that you have. There are 4 init programs where one can invoke it as a normal command, and you are not using any of t...
init: must be run as PID 1
1,386,587,555,000
I am using ubuntu kernel 4.xx with corresponding ubuntu initrd.img, and it works. But, I want to use a custom initramfs inspired by lfs (linux from scratch) initramfs. The kernel extracts, and runs my init script successfully including mounting sysfs. But /sys doesn't expose any trace to available storage (two disk...
On the working system, look at the device(s) in sysfs, and their device symlink. This points to the parent device - which may in turn have its own parent device, and so on. Write yourself a list of the device and all its parent devices. Then you can check all of them in the initramfs. You might be missing more req...
kernel sysfs doesn't recognize storage kobjects [closed]
1,386,587,555,000
I'm trying to run a script at startup as root. (Just sets up a root-owned directory in /tmp). Currently, I'm using this script to set up the boot hook and it appears to get the job done: #!/bin/sh -eu if [ 0 -eq $((${1:-0})) ]; then #install [ -x /etc/init.d/tmpsetup ] || { cat > /etc/init.d/tmpsetup ...
I would've just put this into /etc/rc.local instead: umask 0222 && mkdir -p /tmp/u/ Making a service around this seems like it's over complicating things.
Portable way to run a simple script at startup
1,386,587,555,000
I need to update a raw UBI partition with a new UBIFS image from Linux userspace with superuser rights, however I'm getting EBUSY (Device or resource busy) error whenever I'm trying to open my corresponding /dev/ubiX_Y for writing, even if the current filesystem present on it is mounted as read-only. I suspect that an...
If there a line in /etc/inittab like: ::restart:/tmp/updater_stage2 Then if you send SIGQUIT to init it will replace itself with /tmp/updater_stage2. To reload /etc/inittab after you have changed it send SIGHUP. You can replace /etc/inittab with a bind mount: mount --bind /tmp/inittab /etc/inittab kill -HUP 1 sleep 1...
Opening raw UBI partition for writing on Linux if it's mounted and used by init
1,386,587,555,000
I am trying to restart my Centos 6.7 system using the command line: init 6 But I need it stay down N number of seconds before starting back up again. I have been searching with Google, but I cannot by a variant of the init command that will do this.
As you are on Debian, you want the rtcwake utility.Manual page Not good for very short sleeps (say less than 10 seconds) as it may take more time to put the system to sleep than that. The basic idea is that you program the RealTimeClock chip as a wake source for n seconds in the future and then suspend, either to ram ...
How can I tell my system to shutdown, stay off for X seconds, then restart?
1,386,587,555,000
NOTE: I am running Red Hat 6.7 I have a service that is configured with the Linux init system to start a process as a service when the machine boots. This was done by doing this one-time configuration from the command line: ln -snf /home/me/bin/my_service /etc/init.d/my_service chkconfig --add my_service chkconfig --l...
RedHat 6 uses upstart as the init system. At the very beginning of the provided inittab files are the lines: # inittab is only used by upstart for the default runlevel. # # ADDING OTHER CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM. You need to create a proper init definition in /etc/init (note: NOT /etc/ini...
inittab not restarting service after service crash in Red Hat 6.7
1,386,587,555,000
I know, when we run application in shell for a large website, we'd better set ulimit for our shell, But most of the service is started by systemd/sysv. Do I need set the ulimit in the service script (/etc/init.d) ?
You would normally set the ulimit on the user the service runs as in something like /etc/security/limits.conf. For example, if the web service is running as www-data, you would add an entry for www-data to /etc/security/limits.conf setting the relevant limits. If the process runs as root then it's more complicated giv...
Do I need set ulimit for system services, such as nginx.service(systemd)/nginx(sysv)?
1,386,587,555,000
I have latest Kubuntu. I have installed mysql. I was looking into the /etc/init. I see the following: In /etc/init/mysql.conf description "MySQL Server" [18/40]...
Ubuntu uses Upstart for its Init, which doesn't use /etc/rcX.d the way SysVInit does. More information: http://upstart.ubuntu.com/
How are the services exactly starting in (K)Ubuntu?
1,678,537,061,000
I had to move from Debian Jessie to Buster. The script that runs to create a small custom boot disc runs update-usbids to get the latest files to copy over to the build. However it now says update-usbids command not found. Looking around people say it was removed for systemd but the boot disk still uses init (movin...
# For pci.ids sudo wget -O /usr/share/misc/pci.ids http://pciids.sourceforge.net/pci.ids # For usb.ids sudo wget -O /usr/share/misc/usb.ids http://www.linux-usb.org/usb.ids
How to get the latest usb.ids when update-usbids no longer exists?
1,678,537,061,000
Im trying to understand the lifecycle of a process during the restart. For eg: If we issue the restart command It'll kill the process id remove or flush all the open files in the descriptors. Close the TCP or Unix socket Then start - all actual command will be triggered. Can someone help to understand this in a bett...
A SIGTERM signal will be sent to the server process, with the expectation that the process will exit. It is up to the process itself to catch the signal and do whatever is needed to gracefully exit. I.e. the process itself should take care of flushing files, closing network connections it has open, etc. If the process...
What happens when I restart a service via systemctl or init
1,678,537,061,000
If I do a: echo "foobar" > /etc/init.d/foobar chmod 744 /etc/init.d/foobar ln -s /etc/init.d/foobar /etc/rc.d/rc3.d/S99foobar on a SLES 11, then when will the "foobar" command launch during boot? as the last S99? or a normal start script format would be needed for that?
The SysVinit start/stop scripts are launched in alphanumerical order according to the sorting order of the default "C" (aka POSIX) locale, so S99foobar will start after any S99[a-e]* scripts but before any S99[g-z]* scripts. The scripts are launched by /etc/init.d/rc master script. The relevant code is essentially: fo...
When will S99 launch if it isn't in a normal form?
1,678,537,061,000
This might look stupid but i need to know. What if the initdefault is set to 0 or 6 in my redhat7 system. How to revert it back. As you can see i'm no expert so please give me a detailed explanation.
You need to access your Redhat OS via emergency or rescue mode. To do this, when your OS is booting up and grub2 prompts you for boot time selection press 'e' on your boot choice to edit the boot time parameters. Look for the linux with 'linux16' and at it's end append the string "systemd.unit=rescue.target" (without...
What if the initdefault is set to 0 or 6 in RHEL7. How to solve it?
1,678,537,061,000
After init 1, the ssh connexion on a remote server was interrupted with the following error packet_write_wait: Connection to UNKNOWN port 0: Broken pipe Now, even root cannot connect $ ssh root@remoteserver ssh: connect to host remoteserver port 22: Connection refused Is there any way to recover a ssh connexion?
Switching to runlevel 1 kills all processes (except the top-level init/upstart command itself), including the SSH daemon. From http://www.debianadmin.com/debian-and-ubuntu-linux-run-levels.html: Run Level 1 is known as ‘single user' mode. A more apt description would be ‘rescue', or ‘trouble-shooting' mode. In run lev...
Recover ssh connexion after init 1
1,678,537,061,000
I'm working on a embedded system. I have multiple SD cards to save copy of Linux rootfs on (kernel saved in nand). On a original SD card, where is located a system, and from this card the system is copied to another - everything works nice. Init service is working as it should. But there is a problem on copied system ...
Had to do some copy/paste things. First, I've downloaded minimal ELDK distribution (i'm using it), copied all with rsync. Next i've rsynced copy of system and copied it on SD card on fresh system. All worked.
Embedded Linux and Init problem - Init won't start
1,678,537,061,000
I've been searching for this a little while now: How do I, when I change from runlevel 2 to runlevel 5, start f.e. proftpd? When I go back to runlevel 2, the service should be stopped again. So - Start ftp-server when changing from runlevel 2 to 5 - Stop ftp-server when changing back (Sidenote: the ftp-server is not a...
If you look at man update-rc.d you can see some examples. Here's what you probably want: update-rc.d proftpd start 80 5 . stop 20 0 1 2 3 4 6 . The 80 and 20 are just to make proftpd start later than most other services. You may need to remove existing links first with: update-rc.d -f proftpd remove. If you have a n...
FTP server to start when changing runlevel 2 to 5
1,678,537,061,000
My os is mint 17.2 First off, when I start it with: sudo /etc/init.d/lsyncd start it starts. But when I reboot my system it isn't started by default. How do I have it start at boot time? I had previously had it as an Upstart job, but that wasnt working at startup either. Here are my files/settings: /etc/init.d/lsyncd...
As it turned out, it was not starting because one of the rules involved an HD that was not mounted at started. Mounting then restarting lsyncd did the trick.
lsyncd won't start at startup
1,678,537,061,000
this problem occurs on Debian jessie x86 with systemd. It leads to an incomplete boot sequence on init 2 because network-manager won't start. it leaves the whole system unusable NetworkManager[785]: segfault at e7394845 ip b74ab7a1 sp b7548810 error 7 in libgnutls-deb0.so.28.41.0[b746f000+13a000]
Turned out, I interrupted an upgrade process earlier. I manually reinstalled the network manager package.
segfault in libgnutls - Debian won't complete boot
1,678,537,061,000
My Lenovo Y500 intel i7 nvidia gt 560m LinuxMint 14 x64 halts during startup at: stopping samba auto-reload integration No error shown. No login prompt. I accidentally executed this in the wrong terminal: sudo dpkg-divert --local --rename --add /sbin/initctl sudo ln -s /bin/true /sbin/initctl then I tried to fix it...
Solution: startup from live cd. Chroot to installation. mv /sbin/initctl /initctl dpkg-divert --remove /sbin/initctl apt-get install --reinstall initctl
LinuxMint 14 x64 halts during startup at: stopping samba auto-reload integration
1,678,537,061,000
I'm new to init scripts, but the one I'm using I've copied almost verbatim (I did have to change a few things around from the source I found to work with Fedora). The daemon initializes fastcgi just fine, which was a great victory. However, the init script itself never finishes running, and never returns [ok], even th...
Sounds like the php-fcgi process doesn't daemonize by default, which means it will stay in the foreground and block progress just like you have observed. Most applications intended to run as daemons have an option that will cause it to daemonize (in short; run as a background process). If the php-fcgi process does not...
Init Script initializing daemonized process, but won't return [ok]
1,678,537,061,000
There are many times when I'd like to have a certain daemons run when a user logs in and killed when a user logs out. I'd like these daemons to be restarted if the daemon exits unexpectedly and I'd like a handy way to view the daemon status and what not. I want the daemon process to be owned by the user. Basically, I ...
Yes, systemd has a user service manager which takes care of user-scoped services. You can control it using the same systemctl commands you’d apply to system services, but with an extra --user option.
Is there a systemd equivalent for user sessions?
1,678,537,061,000
On OSes with Systemd, reboot and halt are symlinks to systemctl. On OSes with SysvInit, what are reboot and halt symlinks to? Is it telinit? Or are they themselves executable files, not symlinks? Thanks.
On Debian Jessie (for example), reboot may come from sysvinit-core ( https://packages.debian.org/jessie/sysvinit-core ) Downloading the file ( https://packages.debian.org/jessie/amd64/sysvinit-core/download ) $ mkdir X $ cd X $ ar x ../sysvinit-core_2.88dsf-59_amd64.deb $ xz -dc < data.tar.xz | tar tvf - | egrep 'rebo...
On OSes with SysvInit, are `reboot` and `halt` symlinks to some executables?
1,678,537,061,000
Kali version 2016.2 64bit full version Kali installation: main os-SSD An error message: [ 2.691529] radeon 0000:01:00.0 VCE init error (-22). Solutions tried and their result: gdm3 / X also apt-get update apt-get upgrade -y apt-get install -f gdm3 Noting worked, also tried more soultions in the we...
I try to reinstall windows but this time using UEFI. And then using the kali installation with UEFI or Lagacy mode. That solved my problem..
After a clean installation GUI not working-AMD GPU
1,678,537,061,000
In https://manpages.debian.org/stretch/sysvinit-core/init.8.en.html /sbin/telinit is linked to /sbin/init. It takes a one-character argument and signals init to perform the appropriate action. ... Init listens on a fifo in /run, /run/initctl, for messages. Telinit uses this to communicate with init. Does the first s...
It is a symlink, but programs can look at how they are called and perform different actions. This is extremely common in the Unix world. And so when you run the telinit comamnd, it runs in its own process space, separate from the init process. It sends a messgae to the init process. This may be sent via a FIFO, or ...
In sysvinit, do `telinit` and `init` run in the same process?
1,678,537,061,000
Gilles wrote an excellent reply about how Linux kernel shuts down at https://unix.stackexchange.com/a/122667/674 I was wondering how Linux OS shuts down (in cases of both systemvinit and systemd)? I am expecting something similar to the boot sequence of Linux OS. I am particularly wondering how the processes notify ...
With both sysvinit and systemd, shutting the operating system down starts by notifying the init process (the process with pid 1) that the system should shut down (or reboot, or power off). sysvinit does this by using the /run/initctl FIFO to communicate with init, asking it to switch to the corresponding runlevel. See...
How does Linux operating system shut down? [closed]
1,678,537,061,000
It seems that a server is not necessarily running as a daemon, e.g. X server. If I am not correct, please let me know. Is a daemon necessarily a server? Is there a daemon which is not a server? I guess there are quite a few, and I am not sure if the init processes under sysvinit and systemd are such examples. Thank...
Anything that is performing a task without being requested to do so by a client. I.e. a daemon that is not serving clients. I've recently played around with SSHGuard, a daemon that parses connection logs and that blocks abusive hosts. This is not a server. The DHCP client daemon that many Unices runs variations of...
Is there a daemon which is not a server? [closed]
1,678,537,061,000
I have lot of questions about scripts. How to configure the script that 1 It automatically turns on when the computer is turned on? 2 I was possible start and close the script with console? 3 After closing console the script still have been work?
That's depend on what OS you are running. A program that starts when a computer is turned on is generally called a service. Traditional Unix way is to use rc script. If you used systemd, that should still be supported. See How does systemd use /etc/init.d scripts? All scripts can be started from the console by design...
Linux bash scripting [closed]
1,393,437,350,000
So I received a warning from our monitoring system on one of our boxes that the number of free inodes on a filesystem was getting low. df -i output shows this: Filesystem Inodes IUsed IFree IUse% Mounted on /dev/xvda1 524288 422613 101675 81% / As you can see, the root partition has 81% of its ino...
I saw this question over on stackoverflow, but I didn't like any of the answers, and it really is a question that should be here on U&L anyway. Basically an inode is used for each file on the filesystem. So running out of inodes generally means you've got a lot of small files laying around. So the question really beco...
Find where inodes are being used
1,393,437,350,000
From the article Anatomy of the Linux file system by M. Tim Jones, I read that Linux views all the file systems from the perspective of a common set of objects and these objects are superblock, inode, dentry and file. Even though the rest of the paragraph explains the above, I was not that comfortable with that explan...
First and foremost, and I realize that it was not one of the terms from your question, you must understand metadata. Succinctly, and stolen from Wikipedia, metadata is data about data. That is to say that metadata contains information about a piece of data. For example, if I own a car then I have a set of information ...
What is a Superblock, Inode, Dentry and a File?
1,393,437,350,000
I want to see how many files are in subdirectories to find out where all the inode usage is on the system. Kind of like I would do this for space usage du -sh /* which will give me the space used in the directories off of root, but in this case I want the number of files, not the size.
find . -maxdepth 1 -type d | while read -r dir do printf "%s:\t" "$dir"; find "$dir" -type f | wc -l; done Thanks to Gilles and xenoterracide for safety/compatibility fixes. The first part: find . -maxdepth 1 -type d will return a list of all directories in the current working directory.  (Warning: -maxdepth is a GNU...
How do I count all the files recursively through directories
1,393,437,350,000
I had a problem (new to me) last week. I have a ext4 (Fedora 15) filesystem. The application that runs on the server suddenly stopped. I couldn't find the problem at first look. df showed 50% available space. After searching for about an hour I saw a forum post where the guy used df -i. The option looks for inodes us...
It seems that you have a lot more files than normal expectation. I don't know whether there is a solution to change the inode table size dynamically. I'm afraid that you need to back-up your data, and create new filesystem, and restore your data. To create new filesystem with such a huge inode table, you need to use ...
How can I increase the number of inodes in an ext4 filesystem?
1,393,437,350,000
Let's say when I do ls -li inside a directory, I get this: 12353538 -rw-r--r-- 6 me me 1650 2013-01-10 16:33 fun.txt As the output shows, the file fun.txt has 6 hard links; and the inode number is 12353538. How do I find all the hard links for the file i.e. files with the same inode number?
The basic premise is to use: find /mount/point -mount -samefile /mount/point/your/file On systems with findmnt you can derive the mount point like this: file=/path/to/your/file find "$(findmnt -o TARGET -cenT "$file")" -mount -samefile "$file" It's important not to search from / - unless the target file is on that f...
List all files with the same inode number?
1,393,437,350,000
It is well-known that empty text files have zero bytes: However, each of them contains metadata, which according to my research, is stored in inodes, and do use space. Given this, it seems logical to me that it is possible to fill a disk by purely creating empty text files. Is this correct? If so, how many empty tex...
This output suggests 28786688 inodes overall, after which the next attempt to create a file in the root filesystem (device /dev/sda2) will return ENOSPC ("No space left on device"). Explanation: on the original *nix filesystem design, the maximum number of inodes is set at filesystem creation time. Dedicated space is...
Can I run out of disk space by creating a very large number of empty files?
1,393,437,350,000
When I edit a file in the vi editor, the inode value of the file changes. But when edited with the cat command, the inode value does not change.
Most likely, you have set the backup option on, and backupcopy to "no" or "breakhardlink".
Why does inode value change when we edit in "vi" editor?
1,393,437,350,000
I find that under my root directory, there are some directories that have the same inode number: $ ls -aid */ .*/ 2 home/ 2 tmp/ 2 usr/ 2 var/ 2 ./ 2 ../ 1 sys/ 1 proc/ I only know that the directories' names are kept in the parent directory, and their data is kept in the inode of the directories themselves. I'm con...
They're on different devices. If we look at the output of stat, we can also see the device the file is on: # stat / | grep Inode Device: 801h/2049d Inode: 2 Links: 24 # stat /opt | grep Inode Device: 803h/2051d Inode: 2 Links: 5 So those two are on separate devices/filesystems. Inode nu...
Why do the directories /home, /usr, /var, etc. all have the same inode number (2)?
1,393,437,350,000
Say I am running a software, and then I run package manager to upgrade the software, I notice that Linux does not bring down the running process for package upgrade - it is still running fine. How does Linux do this?
The reason is Unix does not lock an executable file while it is executed or even if it does like Linux, this lock applies to the inode, not the file name. That means a process keeping it open is accessing the same (old) data even after the file has been deleted (unlinked actually) and replaced by a new one with the sa...
Why does a software package run just fine even when it is being upgraded?
1,393,437,350,000
I want to know how many files I have on my filesystem. I know I can do something like this: find / -type f | wc -l This seems highly inefficient. What I'd really like is to do is find the total number of unique inodes that are considered a 'file'. Is there a better way? Note: I would like to do this because I am devel...
The --inodes option to df will tell you how many inodes are reserved for use. For example: $ df --inodes / /home Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sda1 3981312 641704 3339608 17% / /dev/sda8 30588928 332207 30256721 2% /home $ sudo find / -xdev -print | wc...
How can I find the number of files on a filesystem?
1,393,437,350,000
This is a bit of a theoretical question, but it's important to use proper names for things. In UNIX/Linux file systems, .. points to the parent directory. However, we know that hard links cannot point to directories, because that has the potential to break the acyclic graph structure of the filesystem and cause comman...
It depends on the filesystem. Most filesystems follow the traditional Unix design, where . and .. are hard links, i.e. they're actual directory entries in the filesystem. The hard link count of a directory is 2 + n where n is the number of subdirectories: that's the entry in the directory's parent, the directory's own...
Is '..' really a hard link?
1,393,437,350,000
Unix file systems usually have an inode table, and the number of entries in this table is usually fixed at the time the file system is created. This sometimes leads to people with plenty of disk space getting confusing error messages about no free space, and even after they figure out what the problem is, there is no...
Say you did make the inode table a file; then the next question is... where do you store information about that file? You'd thus need "real" inodes and "extended" inodes, like an MS-DOS partition table. Given, you'd only need one (or maybe a few — e.g., to also have your journal be a file). But you'd actually have spe...
Why is the inode table usually not resizable?
1,393,437,350,000
There is literally nothing on google that I can find that will help me answer this question. I presume it is passing some other parameter to ls -i?
Yes, the argument -i will print the inode number of each file or directory the ls command is listing. As you want to print the inode number of a directory, I would suggest using the argument -d to only list directories. For printing the inode number the directory /path/to/dir, use the following command line: ls -id /p...
How do I find the inode of any directory?
1,393,437,350,000
If I run a command like this one: find / -inum 12582925 Is there a chance that this will list two files on separate mounted filesystems (from separate partitions) that happen to have been assigned the same number? Is the inode number unique on a single filesystem, or across all mounted filesystems?
An inode number is only unique on a single file system. One example you’ll run into quickly is the root inode on ext2/3/4 file systems, which is 2: $ ls -id / /home 2 / 2 /home If you run (assuming GNU find) find / -printf "%i %p\n" | sort -n | less on a system with multiple file systems you’ll see many, many dup...
Can two files on two separate filesystems share the same inode number? [duplicate]
1,393,437,350,000
I’m asking because string comparisons are slow, but indexing is fast, and a lot of scripts I write are in bash, which to my knowledge performs a full string lookup for every executable call. All those ls’s and grep’s would be a little bit faster without performing a string lookup on each step. Of course, this now delv...
The short answer is no. The longer answer is that linux user API doesn't support accessing files by any method using the inode number. The only access to the inode number is typically through the stat() system call which exposes the inode number, which can be useful for identifying if two filenames are the same file,...
Does Linux support invoking a program directly via its inode number?
1,393,437,350,000
I have a filesystem with many small files that I erase regularly (the files are a cache that can easily be regenerated). It's much faster to simply create a new filesystem rather than run rm -rf or rsync to delete all the files (i.e. Efficiently delete large directory containing thousands of files). The only issue wit...
Since you're using ext4 you could format the filesystem and the set the UUID to a known value afterwards. man tune2fs writes, -U UUID Set the universally unique identifier (UUID) of the filesystem to UUID. The format of the UUID is a series of hex digits separated by hyphens, like this c1b9d5a2-f162-11cf-9ece-002...
Reset ext4 filesystem without changing the filesystem UUID
1,393,437,350,000
The question is why exactly does a directory shrink after directory entries are removed? Is it due to how ext4 filesystem configured to retain directory metadata? Obviously removing the directory and recreating it isn't a solution, since it deletes original inode and creates a new one. What can be done to decrease the...
Quoting a developer (in a linux kernel thread ext3/ext4 directories don't shrink after deleting lots of files): On Thu, May 14, 2009 at 08:45:38PM -0400, Timo Sirainen wrote: > > I was rather thinking something that I could run while the system was > fully operational. Otherwise just moving the files to a temp direc...
Why directory with large amounts of entries does not shrink in size after entries are removed?
1,393,437,350,000
Device files are not files per se. They're an I/O interface to use the devices in Unix-like operating systems. They use no space on disk, however, they still use an inode as reported by the stat command: $ stat /dev/sda File: /dev/sda Size: 0 Blocks: 0 IO Block: 4096 block special ...
The short answer is that it does only if you have a physical filesystem backing /dev (and if you're using a modern Linux distro, you probably don't). The long answer follows: This all goes back to the original UNIX philosophy that everything is a file. This philosophy is part of what made UNIX so versatile, because y...
Why do special device files have inodes?
1,393,437,350,000
On many *nix systems like OS X and Ubuntu, We can see the inode of root directory is 2. Then what is the inode 1 used for?
Inode 0 is used as a NULL value to indicate that there is no inode. Inode 1 is used to keep track of any bad blocks on the disk; it is essentially a hidden file containing the bad blocks. Those bad blocks which are recorded using e2fsck -c. Inode 2 is used by the root directory, and indicates starting of filesystem in...
Why does '/' have the inode 2?
1,393,437,350,000
Possible Duplicate: How can I increase the number of inodes in an ext4 filesystem? I have a homemade NAS with Debian Wheezy 64bit. It has three disks - 2x2TB and 1.5TB, pooled together using RAID1/5 and LVM. The result is a LVM Logical Volume, about 3.16TB in size, formatted as ext4 and mounted as /home. However I...
From the mke2fs man page: Be warned that it is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter. So the answer is no. What you could do is shrink the existing ext4 volume (this requires unmounting the filesystem), use the fre...
Is it possible to change Inode count on an ext4 filesystem? [duplicate]
1,393,437,350,000
I changed the /home directory to a different partition and couldn't access the files from it, something I have been able to solve from this question - How do you access the contents of a previous mount after switching to a different the partition?. In case I had noted the directory's inode before would I be able to us...
You can rename a file (directory or whatever) using only knowledge of the inode using find, but if (a) the filesystem containing it is not mounted, or if (b) there is another filesystem mounted over a non-empty directory that contains the file you are interested in, the file is simply not accessible by your system. I...
Is it possible to rename a file or directory using the inode?
1,393,437,350,000
In an ext4 filesystem, suppose that file1 has inode number 1, and that file2 has inode number 2. Now, regardless of any crtime timestamp that might be available, is it wrong to assume that file1 was created earlier than file2 only because inode 1 is less than inode 2?
Lower inode number doesn't prove older. A simple case that would change that sequence is deleting a file which would free the inode. That inode therefore becomes available for future use.
Does inode number determine what files were created earlier than others?
1,393,437,350,000
I can do an ls -li to see a file's inode number, but how can I list information inside a particular inode by using that inode number.
If you have a ext2/3/4 filesystem you can use debugfs for a low-level look at an inode. For example, to play without being root: $ truncate -s 1M myfile $ mkfs.ext2 -F myfile $ debugfs -w myfile debugfs: stat <2> Inode: 2 Type: directory Mode: 0755 Flags: 0x0 Generation: 0 Version: 0x00000000 U...
How to see information inside inode data structure
1,393,437,350,000
What is the relation and the difference between xattr and chattr? I want to know when I set a chattr attribute in Linux what is happening inside the Linux kernel and inode metadata.
The attributes as handled by lsattr/chattr on Linux and some of which can be stored by quite a few file systems (ext2/3/4, reiserfs, JFS, OCFS2, btrfs, XFS, nilfs2, hfsplus...) and even queried over CIFS/SMB (when with POSIX extensions) are flags. Just bits than can be turned on or off to disable or enable an attribut...
Difference between xattr and chattr
1,393,437,350,000
I recently discovered on a machine with RHEL6: ls -lbi 917921 -rw-r-----. 1 alex pivotal 5245 Dec 17 20:36 application.yml 917922 -rw-r-----. 1 alex pivotal 2972 Dec 17 20:36 application11.yml 917939 -rw-r-----. 1 alex pivotal 3047 Dec 17 20:36 application11.yml 917932 -rw-r-----. 1 alex pivotal 2197 Dec 17 20:36 ...
I was able to reproduce that behavior. See for example: ls -lib 268947 -rw-r--r-- 1 root root 8 Dez 20 12:32 app 268944 -rw-r--r-- 1 root root 24 Dez 20 12:33 aрр This is on my system (Linux debian 4.9.0-7-amd64 #1 SMP Debian 4.9.110-3+deb9u2 (2018-08-13) x86_64 GNU/Linux). I have a UTF-8 locale and the character p ...
Same file name different INODES
1,393,437,350,000
I have several files with encoding issues in their file names (German umlauts, burned on CD with Windows, read by Windows and synced to Linux with Seafile. Something, somewhere went wrong...). Bash and zsh only show "?" instead of umlauts, stat shows something like $ stat Erg�nzung.doc File: ‘Erg\344nzung.doc’ Size: ...
You could try: find . -inum 12321475 -exec mv {} new-filename \; or find . -inum 12321475 -print0 | xargs -0 mv -t new-filename Generally I prefer xargs over exec. Google for why. It's tricky though. See Find -exec + vs find | xargs. Which one to choose?
"mv" file with garbled name by inode number?
1,393,437,350,000
A friend of mine who likes programming in the Linux environment, but doesn't know much about the administration of Linux recently ran into a problem where his OS (Ubuntu) was reporting "out of disk space on XXX volume." But when he went to check the volume, there was still 700 GB left. After much time wasted, he was e...
A single error number, ENOSPC, is used to report both situations, hence the same error message. To keep compliance with the ISO C and POSIX standards, the kernel developers have no choice but to use a single error number for both events. Adding a new error number would break existing programs. However, as sticking to ...
Why does the Linux kernel report "out of disk space" when in reality it is out of i-nodes
1,393,437,350,000
At first I used stat -c %i file (to help detect the presence of a jail), which seemed to work on any Linux distribution under the sun. On OS X' I had to use ls -i file | cut -d ' ' -f 1. Is there some way to find the inode number of a file in a shell script which is portable across *nix platforms and does not depend o...
Possible solution: The POSIX spec for ls specifies -i, so maybe it's portable. Does anyone know of a popular implementation of ls which does not support this, or prints it in a different way from the following example: $ ls -di / 2 /
Portable way to find inode number
1,393,437,350,000
I'm aware that this article exists: Why are hard links only valid within the same filesystem? But it unfortunately didn't click with me. https://www.kernel.org/doc/html/latest/filesystems/ext4/directory.html I'm reading operating system concepts by Galvin and found some great beneficial resources like linux kernel doc...
A "hard link" just is the circumstance that two (or more) entries in the hierarchy of your file system refer to the same underlying data structure. Your figure illustrates that quite nicely! That's it; that's all there is to it. It's like if you have a cooking book with an index at the end, and the index says "Bread:...
Why can't hard links reference files on other filesystems?
1,393,437,350,000
I am currently using backintime to take "snapshots" of my file system. It is similar to rsnapshot in that it, makes hard links to unchanged files. I have recently run out of inodes on my EXT4 filesystem. df -hi reveals I have used 9.4 million inodes. A rough count of the number of current directories times the number ...
That is a really bad idea. Every inode consumes 256 bytes (may be configured as 128). Thus just the inodes would consume 1TiB of space. Other file systems like btrfs can create inodes dynamically. Use one of them instead.
Drawbacks of increasing number of inodes in EXT4
1,393,437,350,000
I know that a directory is a file contained rows kind of “name = inode number”. When I request a path like /home/my_file.txt, next steps take place: Go to inode number 2 (root directory default inode) Get file to which inode #2 is pointing. Search through this file and find “home” entry. Get its inode number, for ex...
Your description of the process isn't quite right. The kernel keeps track of which paths are mount points. Exactly how it does that varies between kernel, but typically the information is stored in terms of paths. For example the kernel remembers “/ is this filesystem, /media/cdrom is this filesystem, /proc is this fi...
How a mount point directory entry is different from an usual directory entry in a filesystem
1,393,437,350,000
I'm interested in the way Linux mmaps files into the main memory (in my context its for executing, but I guess the mmap process is the same for writing and reading as well) and which size it uses. So I know Linux uses paging with usually 4kB pagesize (where in the kernel can I find this size?). But what exactly does t...
There is no direct relationship between the size of the executable and the size in memory. Here's a very quick overview of what happens when a binary is executed: The kernel parses the file and breaks it into section. Some sections are directly loaded into memory, in separate pages. Some sections aren't loaded at all...
Memory size for kernel mmap operation
1,393,437,350,000
I'm still confused about the concept of kernel and filesystem. Filesystems contain a table of inodes used to retrieve the different files and directories in different memories. Is this inode table part of the kernel? I mean, is the inode table updated when the kernel mounts another filesystem? Or is it part of the fil...
There is some confusion here because kernel source and documentation is sloppy with how it uses the term 'inode'. The filesystem can be considered as having two parts -- the filesystem code and data in memory, and the filesystem on disk. The filesystem on disk is self contained and has all the non-volatile data and me...
How Linux kernel sees the filesystems
1,393,437,350,000
I like the navigation and features of ncdu, but instead of ranking folders by size, I want to rank them by file-count. For example, folders containing more files are listed first, and you can navigate the hierarchy using your arrow keys. Are there any options to accomplish this? If not, I wonder how difficult it would...
If you press C (capital “C”, so ShiftC or C with Caps Lock on) while in ncdu, the display will be sorted by file count rather than size. c (lower-case “c”) will show the file count in addition to the size (regardless of the sort criterion). This shows the file count sort in action: This feature was added in ncdu 1.10...
ncdu - Rank by File-Count instead of Size
1,393,437,350,000
Note: Question although says vice versa but it really does not have any meaning since both of them point to the same inode and its not possible to say which is head and which is tail. Say I have a file hlh.txt [root@FREL ~]# fallocate -l 100 hlh.txt Now if I see the change time for hlh.txt [root@FREL ~]# stat hlh.txt...
This is a requirement on the unlink() library function by POSIX: Upon successful completion, unlink() shall mark for update the last data modification and last file status change timestamps of the parent directory. Also, if the file's link count is not 0, the last file status change timestamp of the file shall be mar...
Deleting a hard link's tail file changes the change time of the head or vice versa. Why?
1,393,437,350,000
I hope I've got this right: A file's inode contains data such as inode number, time of last modification, ownership etc. – and also the entry: »deletion time«. Which made me curious: Deleting a file means removing it's inode number, thus marking the storage space linked to it as available. There are tools to recover (...
When a file or directory is "deleted" its inode number is removed from the directory which contains the file. You can see the list of inodes that a given directory contains using the tree command. Example $ tree -a -L 1 --inodes . . |-- [9571121] dir1 |-- [9571204] dir2 |-- [9571205] dir3 |-- [9571206] dir4 |-- [9...
what does a "deleted file" entry look like in the journal
1,393,437,350,000
Softlinks are easily traceable to the original file with readlink etc... but I am having a hard time tracing hardlinks to the original file. $ ll -i /usr/bin/bash /bin/bash 1310813 -rwxr-xr-x 1 root root 1183448 Jun 18 21:14 /bin/bash* 1310813 -rwxr-xr-x 1 root root 1183448 Jun 18 21:14 /usr/bin/bash* ...
First, there is no original file in the case of hard links; all hard links are equal. However, hard links aren’t involved here, as indicated by the link count of 1 in ls -l’s output: $ ll -i /usr/bin/bash /bin/bash 1310813 -rwxr-xr-x 1 root root 1183448 Jun 18 21:14 /bin/bash* 1310813 -rwxr-xr-x 1 root root 11834...
How to effectively trace hardlink in Linux?