date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,694,871,099,000 |
Debian 11 here with LXDE (Xorg + lightdm)
How could I change the driver used by X?
My X is using the default options, I have no /etc/X11/xorg.conf file, so I generate one with the command sudo X -configure :1 and after that copying the contents of /root/xorg.conf.new to /etc/X11/xorg.conf
After reboot I have a running... |
A little confusion by my side, so I have to make the appropriate corrections to get in, I think, a somewhat good explanation.
I'm working on several machines trying to make that driver change, and I mixed the results with the machine with radeon driver and the machine with the intel driver, my bad.
The problem is that... | Change default xorg.conf video driver |
1,694,871,099,000 |
I'm using debian 8.3 jessie stable with openbox, fbpanel, lightdm. When I'm in openbox session, I do not find an option to switch user without logging out the current user.
How can I switch user from openbox without logging out from current user session?
|
It can be done with the following command for lightdm:
/usr/bin/dm-tool switch-to-greeter
| openbox - How to switch user without logout? |
1,694,871,099,000 |
I have a system with multiple Desktop Environments installed (Ubuntu 14.04 with Unity and Xfce). I would like to configure (with a non-interactive script) a particular DE for a particular user.
How is this controlled? Would it be the same for e.g. KDE?
|
I figured it out. I'm writing the lightDM configuration when configuring autologin anyway, and that's where I'm specifying the user, so the right thing is to specify the system default at the same time: wiki.ubuntu.com/LightDM#Changing_the_Default_Session
However, when this bug is fixed: https://bugs.launchpad.net/lig... | What configuration determines which Desktop Environment to run? |
1,694,871,099,000 |
I'm on a Fedora Server 37 iso, so no DM/DE is pre-installed.
Install wayland, lightdm, and lightdm-gtk-greeter.
Edit lightdm's config to use lightdm-gtk-greeter
(Line 102) change greeter-session=example-gtk-gnome to greeter-session=lightdm-gtk-greeter
(Line 107) change user-session=default to user-session=qtile
Tr... |
or do I need an entire x server package along with wayland to get LightDM running?
LightDM requires the full featured Xorg server.
You may want to install GDM, the only display manager which works in pure Wayland mode as of April, 2023.
Addendum: Fedora 38 contains a GIT version of SDDM which can work in Wayland mod... | How to switch lightdm-gtk-greeter to use wayland only? (x11 not installed) |
1,694,871,099,000 |
Update 2: The behavior only happens when both monitors are enabled and when lightdm-gtk-greeter is active. Disconnecting or disabling (with xrandr) results in expected behavior.
Update: Seems to have nothing to do with light-locker actually. Setting dpms with a display-setup script for LightDM exhibits the same behavi... |
More of a mitigation than a solution, but one I'm happy with. Disabling output on the non-primary monitor on LightDM initialization and enabling dpms results in a successful monitor timeout that remains asleep. Configured as follows:
LightDM Config
[LightDM]
[Seat:*]
greeter-hide-users=false
display-setup-script=/etc... | LightDM displays wake immediately after sleep |
1,694,871,099,000 |
I am using Debian desktop for Lichee Pi and I am new this platform(linux).
After energizing, the graphical login screen appears.
But I don't have a real or virtual keyboard.
Can I enter this password from the command line? or can I skip this screen and switch to the desktop?
|
What you want is named autologin and what you need is to update lightdm's configuration file : /etc/lightdm/lightdm.conf.
Edit this file and search for the following lines :
[Seat:*]
#autologin-user=
#autologin-user-timeout=0
Uncomment the two lines (remove the #) and add your user name at the end of the second.
Ther... | How to enter password without Keyboard on graphical login screen? |
1,694,871,099,000 |
The interesting part is I found that I was able to login with xfce but not with either lightdm or gdm. (I am using Ubuntu 16.04)
|
Did you do something before this problem?
Maybe you run .Xauthority with sudo.
Log in using CTRL+ALT+F1 and type:
sudo chown yourusername ~/.Xauthority
| Stuck in a login-loop in lightdm and gdm, but not with xfce and other systems |
1,694,871,099,000 |
I'm trying to define Suru++ as the cursor theme for LightDM GTK+ greeter on Debian stretch. This is supposedly done by adding Suru++ to the list of alternatives for x-cursor-theme, and choosing it as the alternative:
user@debian:~$ sudo update-alternatives --install /usr/share/icons/default/index.theme x-cursor-theme ... |
The problem was that the value of the Inherits option in cursor.theme didn't match the name of the directory containing the theme.
Setting Inherits to Suru++ instead of Suru solved the problem.
| LightDM GTK+ greeter doesn't use the right cursor theme |
1,694,871,099,000 |
I've setup Winbind & Kerberos on my CentOS 7 server to allow network users to login. The network users can login fine through SSH, but not through the display manager. I've experienced the same issue whether using LightDM or GDM.
Local users are able to login just fine. For the network users, when they login it will ... |
Well I feel dumb... After battling with this problem for 3 days, The reason was that I had a .profile in /etc/skel that was setting SHELL=/bin/bash so pam_mkhomedir was adding this file for new domain users but it wasn't on my local account.
| AD Users Cannot Login Through GDM/LightDM |
1,694,871,099,000 |
I cannot change my login screen background to the desktop background in my elementary os which is based on ubuntu. I have decrypted my home folder according to this link:
http://www.howtogeek.com/116179/how-to-disable-home-folder-encryption-after-installing-ubuntu/
and when I ran the command to check for encryption I ... |
Got it!
1) Copy all the pics to /usr/share/backgrounds
2) Then take terminal and change directory to that folder.
cd /usr/share/backgrounds
3) Then for every image_name.jpg that you just added, type the command:
sudo chmod a+rw image_name.jpg
4) Now exit terminal and check your System settings -> Desktop . Yo... | cannot change my login screen background |
1,694,871,099,000 |
I have elementaryOS and after updated my Kernel to 3.11 I get black screen after boot.
If I type Ctrl + Alt + F1 to go to command prompt and then do sudo service lightdm restart, lightdm starts correctly.
Why its not starting at first? I had troubles with my X stack and drivers before but if that was the problem, I sh... |
It was a problem with the drivers. It is related to this: ElementaryOS Gala using more than 100% CPU constantly
After fixing this issue, everything works fine.
| lightdm fails to start properly on boot (works from terminal) |
1,694,871,099,000 |
osinfo :
cat /etc/*-release
DISTRIB_ID=neon
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenia... |
Thanks to steeldriver and his comment i could read this question on Ask Ubuntu: 16.04 LTS Update fails - Errors were encountered while processing util-linux.
I don't have a samsung printer/driver but it did get me to try to uninstall my dell printer driver.
To uninstall :
cd /opt/DELL/mfp/uninstall
sudo ./uninstall.s... | insserv: warning: script 'K07smfpd' missing LSB tags and overrides |
1,694,871,099,000 |
I need to edit /etc/lightdm/lightdm.conf using sed inside specific section, uncomment and set value.
This section is [Seat:*] and line is #autologin-user=
I expect this change:
Before:
[LightDM]
.
.
.
[Seat:*]
.
.
.
#autologin-user=
.
.
.
After:
[LightDM]
.
.
.
[Seat:*]
.
.
.
autologin-user=pi
.
.
.
I've tried this ... |
Try with this, given an altered input file sample:
[LightDM]
[Seat:*]
#autologin-user=
[Foo:*]
#autologin-user=
[Bar:*]
#autologin-user=
The command:
$ sed '/^\[Seat:\*\]$/,/\[/s/^#autologin-user=$/autologin-user=pi/' foo.txt
[LightDM]
[Seat:*]
autologin-user=pi
[Foo:*]
#autologin-user=
[Bar:*]
#autologin-user=
| Enable lightdm autologin using sed |
1,694,871,099,000 |
I am making an ansible check to see if lightdm is up before continuing a task in my playbook.
Is there a port number that lightdm creates once it's up?
|
Q: "Check to see if lightdm is up before continuing a task"
A: It's possible to use service_facts and select attributes of a particular service. For example the playbook
- hosts: localhost
vars:
my_service: 'lightdm.service'
tasks:
- service_facts:
- set_fact:
my_state: "{{ services|
... | lightdm port to listen if it is up |
1,601,415,487,000 |
So I thought about switching to LightDM. I switched by doing
sudo systemctl disable sddm
sudo systemctl enable lightdm
Then I restarted arch linux and everything ran fine. But then I thought about getting a better looking display manager. So I uncommented the line in /ect/lightdm/lightdm.conf that says this:
...-sess... |
If your system boots at all, you can always switch to a terminal and back to the DE with the Ctrl + Alt + F1, ... + F2, etc. key combo. There is no need to edit grub.
From a terminal you can edit the file you need then reboot.
| Arch Linux Not Working After I Change Display Manager To Lightdm |
1,601,415,487,000 |
I accidentally erased the plymouth package which removed many more packages. The system would still boot but the console hung. I added the packages lightdm and lightdm-gtk-greeter, and now I do get a kind of graphical desktop. Still things are not what they should be:
I do not have the vertical line of icons at the l... |
All actions with apt (apt-get) are logged. These files are available in /var/log/apt/. To view the most recent history log, execute:
less /var/log/apt/history.log
Than you can install all of the packages that are removed manually
apt install package1 package2 package3 ...
| lightdm config damaged |
1,601,415,487,000 |
I am using Debian Stretch with lightdm. Suddenly, I am no longer asked for a password when I log in. As soon as I fill in my username and press tab, the password field is removed and I can log in without ever entering it.
Moreover:
With a command line login, the situation is the same: I only have to enter my usern... |
The root cause was that there was no password set anymore for my user. I executed:
sudo journalctl -b | grep pam
And noticed:
lightdm[1193]: gkr-pam: no password is available for user
The problem was then solved by executing passwd at the terminal and setting a new password.
| Password for user is not asked anymore [closed] |
1,601,415,487,000 |
I am hoping someone can explain what dbus_enable is and what benefits it would bring should I include it.
Additionally I am not sure where this would be placed however I feel it may be added to the ~/.bash_profile file, like so:
# User specific environment and startup programs
dbus_enable=YES
The reason I ask this is... |
dbus_enable is a FreeBSD configuration option which controls whether dbus-daemon is started. This provides an interprocess communications bus, D-Bus, used by some desktop environments (including GNOME and KDE) and various other tools commonly used on Linux systems (not so much FreeBSD). The setting is stored in /etc/r... | What is dbus_enable? |
1,601,415,487,000 |
Using lightdm, I'm trying to set a wallpaper on the logging screen using lightdm-settings.
If I set an image under /usr/share/backgrounds it works.
If I set an image under /home/me/Images, the image is not loaded and background color is shown instead. Testing the image with lightdm --test-mode shows it works fine ; bu... |
You need to make sure the files are world readable, and that any directories leading up to them are executable for all users.
To recap, execute permission is required on a directory in order to read the files within it; merely making the files themselves readable to everyone is not enough if they are in a directory wh... | Lightdm do not have access to files under /home |
1,601,415,487,000 |
I am trying to let the login greeter of my Debian unstable machine show a custom wallpaper. It shows up quickly at boot, like half a second but then it fades into the default wallpaper.
What could be the reason?
Here is how I configured it and some info about my machine:
> sudo cat /etc/lightdm/lightdm-gtk-greeter.con... |
Had a similar problem and I managed to solve it by adding:
user-background=false
so the full file looks like this:
[greeter]
background=/usr/share/wallpaper/leaf.png
user-background=false
| My light-dm greeter only quickly shows my wallpaper then changes to the default one |
1,601,415,487,000 |
Upgrading Debian from stretch to buster, and I've had troubles starting xmonad.
What doesn't work
I previously started from the login manager, but now either with gdm3 or lightdm, I get thrown out directly.
Workaround
After I login from a raw console (Ctrl+Alt+F2), I can start xmonad if I create a file ~/.xinitrx and ... |
Problem solved, but was unrelated. I'll post how I debugged this problem.
I needed to check /var/log/Xorg.0.log, but the file was somehow truncated so that I missed the error.
login in another tty with Ctrl+Alt+F1.
save all new input in the log file to a separate file: tail -f /var/log/Xorg.0.log >> ~/tmp/Xorg.log
re... | Error when using xmonad on Debian Buster after distribution upgrade |
1,601,415,487,000 |
Symptom
Upgrading from a WQHD ViewSonic display to a giant 4K UHD ViewSonic display yields a No Signal error (via HDMI) after my workstation successfully makes it through GRUB and Plymouth screens. The Debian-branded Plymouth splash screen seems to display at 4K, but then it never displays the LightDM greeter; the new... |
I finally got to the bottom of most of this. For whatever reason this card, stock nouveau driver, etc. can't truly drive the monitor at 4K. XFCE and LightDM/GTK Greeter do work at 3K (2880x1620) by dialing back the resolution in the XFCE Display settings widget and configuring a resolution override via xrandr in /etc/... | No HDMI signal on TTY7 when running Buster + NVIDIA GT 640 + nouveau + 4K UHD |
1,601,415,487,000 |
On a normal working Linux machine the command w
report 2 users(because 2 users are connected)
w
19:23:19 up 1:53, 2 users, load average: 0,44, 0,63, 0,81
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
after reboot report correctly 1 user
w
19:26:44 up 1:03, 1 users, load average: 0,44, 0,... |
Solution found using a Xreset script
First I edit the script(if not exist create it)
vim /etc/lightdm/Xreset
#!/bin/sh
sessreg -d -l $DISPLAY $USER
chmod 755 /etc/lightdm/Xreset
Then I edit /etc/lightdm/lightdm.conf
session-cleanup-script=/etc/lightdm/Xreset
After reboot w report the correct number of user... | Why don't my wtmp/utmp reset the user count? |
1,601,415,487,000 |
I think I've been doing more than a dozen system reboots in the last few minutes to check this strange behavior.
It seems that the service of dropbox succedes or fails in running at startup depending on how much time I spend at the login screen where I enter the password. I've not done any timing, so I don't know what... |
As suggested in the first comment to the question, this wikipage solved the issue.
| dropbox service fails or succedes depending on time spent at the login screen |
1,389,293,469,000 |
Do changes in /etc/security/limits.conf require a reboot before taking effect?
For example, if I have a script that sets the following limits in /etc/security/limits.conf, does this require a system reboot before those limits will take effect?
* hard nofile 94000
* soft nofile 94000
* hard nproc 64000
* soft nproc 6... |
No but you should close all active sessions windows. They still remember the old values. In other words, log out and back in.
Every remote new session or a local secure shell take effect of the limits changes.
| do changes in /etc/security/limits.conf require a reboot? |
1,389,293,469,000 |
Right now, I know how to:
find open files limit per process: ulimit -n
count all opened files by all processes: lsof | wc -l
get maximum allowed number of open files: cat /proc/sys/fs/file-max
My question is: Why is there a limit of open files in Linux?
|
The reason is that the operating system needs memory to manage each open file, and memory is a limited resource - especially on embedded systems.
As root user you can change the maximum of the open files count per process (via ulimit -n) and per system (e.g. echo 800000 > /proc/sys/fs/file-max).
| Why is number of open files limited in Linux? |
1,389,293,469,000 |
How to limit process to one cpu core ?
Something similar to ulimit or cpulimit would be nice. (Just to ensure: I do NOT want to limit percentage usage or time of execution. I want to force app (with all it's children, processes (threads)) to use one cpu core (or 'n' cpu cores)).
|
Under Linux, execute the sched_setaffinity system call. The affinity of a process is the set of processors on which it can run. There's a standard shell wrapper: taskset. For example, to pin a process to CPU #0 (you need to choose a specific CPU):
taskset -c 0 mycommand --option # start a command with the given affin... | How to limit a process to one CPU core in Linux? [duplicate] |
1,389,293,469,000 |
I am running a docker server on Arch Linux (kernel 4.3.3-2) with several containers. Since my last reboot, both the docker server and random programs within the containers crash with a message about not being able to create a thread, or (less often) to fork. The specific error message is different depending on the pro... |
The problem is caused by the TasksMax systemd attribute. It was introduced in systemd 228 and makes use of the cgroups pid subsystem, which was introduced in the linux kernel 4.3. A task limit of 512 is thus enabled in systemd if kernel 4.3 or newer is running. The feature is announced here and was introduced in this ... | Creating threads fails with “Resource temporarily unavailable” with 4.3 kernel |
1,389,293,469,000 |
So I have 4 GB RAM + 4GB swap. I want to create a user with limited ram and swap: 3 GB RAM and 1 GB swap. Is such thing possible? Is it possible to start applications with limited RAM and swap avaliable to them without creating a separate user (and not installing any special apps - having just a default Debian/CentOS ... |
ulimit is made for this.
You can setup defaults for ulimit on a per user or a per group basis in
/etc/security/limits.conf
ulimit -v KBYTES sets max virtual memory size. I don't think you can give a max amount of swap. It's just a limit on the amount of virtual memory the user can use.
So you limits.conf would hav... | How to create a user with limited RAM usage? |
1,389,293,469,000 |
I operate a Linux system which has a lot of users but sometimes an abuse occurs; where a user might run a single process that uses up more than 80% of the CPU/Memory.
So is there a way to prevent this from happening by limiting the amount of CPU usage a process can use (to 10% for example)? I'm aware of cpulimit, but ... |
While it can be an abuse for memory, it isn't for CPU: when a CPU is idle, a running process (by "running", I mean that the process isn't waiting for I/O or something else) will take 100% CPU time by default. And there's no reason to enforce a limit.
Now, you can set up priorities thanks to nice. If you want them to a... | Limiting processes to not exceed more than 10% of CPU usage |
1,389,293,469,000 |
I'm looking for a way to limit a processes disk io to a set speed limit. Ideally the program would work similar to this:
$ limitio --pid 32423 --write-limit 1M
Limiting process 32423 to 1 megabyte per second hard drive writing speed.
|
That is certainly not trivial task that can't be done in userspace. Fortunately, it is possible to do on Linux, using cgroup mechanizm and its blkio controller.
Setting up cgroup is somehow distribution specific as it may already be mounted or even used somewhere. Here's general idea, however (assuming you have prope... | How to Throttle per process I/O to a max limit? |
1,389,293,469,000 |
We have an Ubuntu 12.04 server with httpd on port 80 and we want to limit:
the maximum connections per IP address to httpd to 10
the maximum new connections per second to httpd to 150
How can we do this with iptables?
|
iptables -A INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 15 --connlimit-mask 32 -j REJECT --reject-with tcp-reset
This will reject connections above 15 from one source IP.
iptables -A INPUT -m state --state RELATED,ESTABLISHED -m limit --limit 150/second --limit-burst 160 -j ACCEPT
In this 160 ... | Limit max connections per IP address and new connections per second with iptables |
1,389,293,469,000 |
Is there a method of slowing down the copy process on Linux?
I have a big file, say 10GB, and I'd like to copy it to another directory, but I don't want to copy it with full speed. Let's say I'd like to copy it with the speed of 1mb/s, not faster. I'd like to use a standard Linux cp command.
Is this possible? (If yes,... |
You can throttle a pipe with pv -qL (or cstream -t provides similar functionality)
tar -cf - . | pv -q -L 8192 | tar -C /your/usb -xvf -
-q removes stderr progress reporting.
The -L limit is in bytes.
More about the --rate-limit/-L flag from the man pv:
-L RATE, --rate-limit RATE
Limit the transfer to a maximum... | Make disk/disk copy slower |
1,389,293,469,000 |
I have a systemd service (a CI runner) that tends to bog the system down with very CPU intensive jobs. I caught the load average flying over 100 just now and want to put a stop to that nonsense.
Nothing else on the system is limited in any way, so the deal is that I want everything else to continue as it would run now... |
First of all, most of what comes up in search on the web has been deprecated. For example cgmanager is no longer supported on new systemd versions. Don't follow 99% of what comes up in web serches as far as using cpulimit, nice, cgset or other tools for this job. They either won't work at all as advertised (as in the ... | How to limit a systemd service to "play nice" with the CPU? |
1,389,293,469,000 |
On Unix systems path names have usually virtually no length limitation (well, 4096 characters on Linux)... except for socket files paths which are limited to around 100 characters (107 characters on Linux).
First question: why such a low limitation?
I've checked that it seems possible to work around this limitation ... |
Compatibility with other platforms, or compatibility with older stuff to avoid overruns while using snprintf() and strncpy().
Michael Kerrisk explain in his book at the page 1165 - Chapter 57, Sockets: Unix domain :
SUSv3 doesn’t specify the size of the sun_path field. Early BSD implementations used 108 and 104 byte... | Why is socket path length limited to a hundred chars? |
1,389,293,469,000 |
How can I limit the size of a log file written with >> to 200MB?
$ run_program >> myprogram.log
|
If your application (ie. run_program) does not support limiting the size of the log file, then you can check the file size periodically in a loop with an external application or script.
You can also use logrotate(8) to rotate your logs, it has size parameter which you can use for your purpose:
With this, the log file... | How to limit log file size using >> |
1,389,293,469,000 |
I'm tuning the nofile value in /etc/security/limits.conf for my oracle user and I have a question about its behavior: does nofile limit the total number of files the user can have open for all of its processes or does it limit the total number of files the user can have open for each of its processes?
Specifically, fo... |
Most of the values¹ in limits.conf are limits that can be set with the ulimit shell command or the setrlimit system call. They are properties of a process. The limits apply independently for each process. In particular, each process can have up to nofile open files. There is no limit to the number of open files cumula... | Are limits.conf values applied on a per-process basis? |
1,389,293,469,000 |
I am considering using btrfs on my data drive so that I can use snapper, or something like snapper, to take time based snapshots. I believe this will let me browse old versions of my data. This would be in addition to my current off site backup since a drive failure would wipe out the data and the snapshots.
From my u... |
While technically there is no limit on the number of snapshots, I asked on the BTRFS mailing list:
The (practical) answer depends to some extent on how you use btrfs.
Btrfs does have scaling issues due to too many snapshots (or actually the
reflinks snapshots use, dedup using reflinks can trigger the same scaling ... | Practical limit on the number of btrfs snapshots? |
1,389,293,469,000 |
I have /etc/security/limits.conf, that seems not been applied:
a soft nofile 1048576 # default: 1024
a hard nofile 2097152
a soft noproc 262144 # default 128039
a hard noproc 524288
Where a is my username, when I run ulimit -Hn and ulimit -Sn, it shows:
4096
1024
There's only one other file in the /etc/security/l... | ERROR: type should be string, got "\nhttps://superuser.com/questions/1200539/cannot-increase-open-file-limit-past-4096-ubuntu/1200818#_=_\nThere's a bug since Ubuntu 16 apparently.\nBasically:\n\nEdit /etc/systemd/user.conf for the soft limit, and add DefaultLimitNOFILE=1048576.\nEdit /etc/systemd/system.conf for the hard limit, and add DefaultLimitNOFILE=2097152.\n\nCredit goes to @mkasberg.\n" | /etc/security/limits.conf not applied |
1,389,293,469,000 |
There are plenty of questions and answers about constraining the resources of a single process, e.g. RLIMIT_AS can be used to constrain the maximum memory allocated by a process that can be seen as VIRT in the likes of top. More on the topic e.g. here Is there a way to limit the amount of memory a particular process c... |
I am not sure if this answers your question, but I found this perl script that claims to do exactly what you are looking for. The script implements its own system for enforcing the limits by waking up and checking the resource usage of the process and its children. It seems to be well documented and explained, and has... | How to limit the total resources (memory) of a process and its children |
1,389,293,469,000 |
When I enter text on stdin in an OS X Terminal, a single line is limited to 1024 characters. For example, cat > /dev/null beeps after I type (or paste) a line longer than this, and refuses to accept more characters. A problematic example is when I want to count characters from pasted text with cat | wc -c: the cat bl... |
Probably a limit of the terminal device line discipline internal line editor buffer.
You should be able to enter long lines by pressing Ctrl+D in the middle of it (so the currently entered part be sent to cat and the line editor flushed), or by disabling that line editor altogether.
For instance, if using zsh:
STTY=-i... | Terminal does not accept pasted or typed lines of more than 1024 characters [duplicate] |
1,389,293,469,000 |
I tested this on different GNU/Linux installations:
perl -e 'while(1){open($a{$b++}, "<" ,"/dev/null") or die $b;print " $b"}'
System A and D
The first limit I hit is 1024. It is easily raised by putting this into /etc/security/limits.conf:
* hard nofile 1048576
and then run:
ulimit -n 104... |
Check that /etc/ssh/sshd_config contains:
UsePAM=yes
and that /etc/pam.d/sshd contains:
session required pam_limits.so
In the comment below @venimus states the 1M limit is hardcoded:
The kernel 2.6.x source states ./fs/file.c:30:int sysctl_nr_open __read_mostly = 1024*1024; which is 1048676
The 1048576 is per... | Fixing ulimit: open files: cannot modify limit: Operation not permitted |
1,389,293,469,000 |
I want update my linux in one shell but by default wget or axel in updater use all the bandwidth.
How can I limit the speed in this shell?
I want other shells to have a fair share, and to limit everything in that shell – something like a proxy!
I use Zsh and Arch Linux.
This question focuses on process-wide or session... |
Have a look at trickle a userspace bandwidth shaper. Just start your shell with trickle and specify the speed, e.g.:
trickle -d 100 zsh
which tries to limit the download speed to 100KB/s for all programs launched inside this shell.
As trickle uses LD_PRELOAD this won't work with static linked programs but this isn't ... | Limiting a specific shell's internet bandwidth usage |
1,389,293,469,000 |
We have a regular job that does du summaries of a number of subdirectories, picking out worst offenders, and use the output to find if there are things that are rapidly rising to spot potential problems. We use diff against snapshots to compare them.
There is a top level directory, with a number (few hundred) of subdi... |
Take a look at ionice. From man ionice:
This program sets or gets the io scheduling class and priority for a program. If no arguments or just -p is given, ionice will query the current io scheduling class and priority for that process.
To run du with the "idle" I/O class, which is the lowest priority available, you ... | Can the "du" program be made less aggressive? |
1,389,293,469,000 |
In our cluster, we are restricting our processes resources, e.g. memory (memory.limit_in_bytes).
I think, in the end, this is also handled via the OOM killer in the Linux kernel (looks like it by reading the source code).
Is there any way to get a signal before my process is being killed? (Just like the -notify option... |
It's possible to register for a notification for when a cgroup's memory usage goes above a threshold. In principle, setting the threshold at a suitable point below the actual limit would let you send a signal or take other action.
See:
https://www.kernel.org/doc/Documentation/cgroup-v1/memory.txt
| receive signal before process is being killed by OOM killer / cgroups |
1,389,293,469,000 |
Is there a (technical or practical) limit to how large you can configure the maximum number of open files in Linux? Are there some adverse effects if you configure it to a very large number (say 1-100M)?
I'm thinking server usage here, not embedded systems. Programs using huge amounts of open files can of course eat... |
I suspect the main reason for the limit is to avoid excess memory consumption (each open file descriptor uses kernel memory). It also serves as a safeguard against buggy applications leaking file descriptors and consuming system resources.
But given how absurdly much RAM modern systems have compared to systems 10 year... | Largest allowed maximum number of open files in Linux |
1,389,293,469,000 |
I'm trying to increase the maximum number of open files for the current user
> ulimit -n
1024
I attempt to increase and fail as follows
> ulimit -n 4096
bash: ulimit: open files: cannot modify limit: Operation not permitted
So I do the natural thing and try to run with temp permission, but fail
> sudo ulimit -n 4096... |
ulimit is a shell built-in, not an external command. It needs to be built in because it acts on the shell process itself, like cd: the limits, like the current directory, are a property of that particular process.
sudo bash -c 'ulimit -n 4096' would work, but it would change the limit for the bash process invoked by s... | ulimit PICKLE: "Operation not permitted" and "Command not found" |
1,389,293,469,000 |
I am using convert to create a PDF file from about 2,000 images:
convert 0001.miff 0002.miff ... 2000.miff -compress jpeg -quality 80 out.pdf
The process terminates reproducible when the output file has reached 2^31-1 bytes (2 GB −1) with the message
convert: unknown `out.pdf'.
The PDF file specification allows for ... |
Your limitation does not stem indeed from the filesystem; or from package versions I think.
Your 2GB limit is coming from you using a 32-bit version of your OS.
The option to increase the file would be installing a 64-bit version if the hardware supports it.
See Large file support
Traditionally, many operating syste... | Get over 2 GB limit creating PDFs with ImageMagick |
1,389,293,469,000 |
According to Wikipedia, ZFS has the following limits:
Max. volume size: 256 trillion yobibytes (2128 bytes)
Max. file size: 16 exbibytes (264 bytes)
Max. number of files:
Per directory: 248
Per file system: unlimited
Max. filename length: 255 ASCII characters (fewer for multibyte character encodings such as Unicod... |
What internally limits these things?
Long answer
ZFS's limits are based on fixed-size integers because that's the fastest way to do arithmetic in a computer.
The alternative is called arbitrary-precision arithmetic, but it's inherently slow. This is why arbitrary-precision arithmetic is an add-on library in most pr... | What is the sense behind ZFS's limits? |
1,389,293,469,000 |
I want to backup 1 terabyte of data to an external disk.
I am using this command: tar cf /media/MYDISK/backup.tar mydata
PROBLEM: My poor laptop freezes and crashes whenever I use 100% CPU or 100% disk (if you want to react about this please write here).
So I want to stay at around 50% CPU and 50% disk max.
My questio... |
You can use pv to throttle the bandwidth of a pipe. Since your use case is strongly IO-bound, the added CPU overhead of going through a pipe shouldn't be noticeable, and you don't need to do any CPU throttling.
tar cf - mydata | pv -L 1m >/media/MYDISK/backup.tar
| Preventing tar from using too much CPU and disk (old laptop crashes if 100%) |
1,389,293,469,000 |
We have a script which runs on our web servers, triggered by customer action, which initiates a unix process to generate some cache files. Because this process acts upon files supplied by our customer, it sometimes misbehaves, running so long that the PHP process which spawns it times out or using so much CPU time tha... |
In addition to Gilles answer there is cpulimit tool that does exactly what you want - including modifing in runtime. Additionally it can limit to only certain CPUs/Cores IIRC.
| Can I limit a process to a certain amount of time / CPU cycles? |
1,389,293,469,000 |
I used to work with an HP-UX system and the old admin told me there is an upper limit on the number of zombie processes you can have on the system, I believe 1024.
Is this a hard fact ceiling? I think you could have any number of zombies just as if you can have any number of processes...?
Is it different value fro... |
I don't have HP-UX available to me, and I've never been a big HP-UX fan.
It appears that on Linux, a per-process or maybe per-user limit on how many child processes exists. You can see it with the limit Zsh built-in (seems to be analogous to ulimit -u in bash):
1002 % limit
cputime unlimited
filesize un... | Is there an upper limit to the number of zombie processes you can have? |
1,389,293,469,000 |
I want a user to run a specific process on the system with a negative nice value.
I can't simply fork the process to background as this specific program is a minecraft server and I rely on the command line to control the server.
My current bash script looks like this (the important part):
sleep 10 && \
sudo renice -n ... |
The pam_limits.so module can help you there.
It allows you to set certain limits on specific individual users and groups or wildcards or ranges of users and groups.
The limits you can set are typically ulimit settings but also on the number of concurrent login sessions, processes, CPU time, default priority and maxim... | How can I allow a user to prioritize a process to negative niceness? |
1,389,293,469,000 |
Occasionally some processes on my GNU/Linux desktop (such as gv and gnash) use up the physical memory and cause thrashing. Since these processes aren't important, I want them to be automatically killed if they use too much memory.
I think the /etc/security/limits.conf file and the -v option could be used for this. ... |
There's also the ulimit mechanism. There's a system call (in Linux, it's a C library function) ulimit(3) and a Bash builtin ulimit. Type ulimit -a to see all the things you can limit to. To see the current virtual memory limit say ulimit -v. You can set it by saying ulimit -v INTEGER-KILOBYTES.
Running ulimit changes ... | How to limit available virtual memory per process [duplicate] |
1,389,293,469,000 |
Could someone tell me how to set the default value of nice (as displayed by top) of a user? I have found that /etc/security/limits.conf is the place but if I put either:
username_of_a_guy - nice 19
username_of_a_guy soft nice 19
username_of_a_guy hard nice 19
It doesn't work (while it should, right?).
Note t... |
I believe the correct format is:
@users - priority 10
username - priority 19
This is an example of the settings I am using in production (obviously with real users/groups).
The nice setting is to determine the minimum nice value (i.e. maximum priority) someone can set their process t... | Set default nice value for a given user (limits.conf) |
1,389,293,469,000 |
The default PID max number is 32768. To get this information type:
cat /proc/sys/kernel/pid_max
32768
or
sysctl kernel.pid_max
kernel.pid_max = 32768
Now, I want to change this number... but I can't. Well, actually I can change it to a lower value or the same. For example:
linux-6eea:~ # sysctl -w kernel.pid_max... |
The value can only be extended up to a theoretical maximum of 32768 for 32 bit systems or 4194304 for 64 bit.
From man 5 proc:
/proc/sys/kernel/pid_max
This file (new in Linux 2.5) specifies the value at which PIDs wrap around
(i.e., the value in this file is one greater than the maximum PID). The
default val... | How to change the kernel max PID number? [duplicate] |
1,389,293,469,000 |
getrlimit(2) has the following definition
in the man pages:
RLIMIT_AS
The maximum size of the process's virtual memory (address space) in bytes. This limit affects calls to brk(2), mmap(2) and mremap(2), which fail with the error ENOMEM upon exceeding this limit. Also automatic stack expansion will fail (and generate ... |
Yes stacks grow dynamically. The stack is in the top of the memory growing downwards towards the heap.
--------------
| Stack |
--------------
| Free memory|
--------------
| Heap |
--------------
.
.
The heap grows upwards (whenever you do malloc) and the stack grows downwards as and when new fu... | What is "automatic stack expansion"? |
1,389,293,469,000 |
I know Linux supports multiple users being logged in at the same time.
But what's the maximum number of users that can be logged into Linux at the same time?
I see there are there are 69 tty files (ttyn or ttysn, where n is an integer, such as tty0, tty1, tty2... ) in my /dev directory. I assume that these files are ... |
When logging in using SSH, you use a pseudo-terminal (a pty) allocated to the SSH daemon, not a real one (a tty). Pseudo-terminals are created and destroyed as needed. You can find the number of ptys allowed to be allocated at one time at /proc/sys/kernel/pty/max, and this value can be modified using the kernel.pty.ma... | How many users does Linux support being logged in at the same time via SSH? |
1,389,293,469,000 |
In a python script, I am creating a bunch of symbolic links chained together.
example: link1->link2->link3->.......->somefile.txt
I was wondering how you can change the max number of symlinks to be greater than 20?
|
On Linux (3.5 at least), it's hardcoded to 40 (see follow_link() in fs/namei.c), and note that it's the number of links followed when resolving all the components of a path, you can only change it by recompiling the kernel.
$ ln -s . 0
$ n=0; repeat 50 ln -s $((n++)) $n
$ ls -LdF 39
39/
$ ls -LdF 40
ls: cannot access ... | How do you increase MAXSYMLINKS |
1,389,293,469,000 |
I am using Fedora 17 and over the last few days I am having an issue with my system. Whenever I try to start httpd it shows me:
Error: No space left on device
When I execute systemctl status httpd.service, I receive the following output:
httpd.service - The Apache HTTP Server (prefork MPM)
Loaded: loaded (/u... |
Here we see evidence of a problem:
tail: inotify resources exhausted
By default, Linux only allocates 8192 watches for inotify, which is ridiculously low. And when it runs out, the error is also No space left on device, which may be confusing if you aren't explicitly looking for this issue.
Raise this value with the ... | Httpd : no space left on device |
1,389,293,469,000 |
The default open file limit per process is 1024 on - say - Linux. For certain daemons this is not enough. Thus, the question: How to change the open file limit for a specific user?
|
On Linux you can configure it via limits.conf, e.g. via
# cd /etc/security
# echo debian-transmission - nofile 8192 > limits.d/transmission.conf
(which sets both the hard and soft limit for processes started under the user debian-transmission to 8192)
You can verify the change via:
# sudo -u debian-transmission bash ... | How to configure the process open file limit of a user? |
1,389,293,469,000 |
In Linux, there is open file limit. I can use ulimit -n to see open file limit, which is 1024 default. Then I also can see per process open file soft/hard limit by looking at /proc/$PID/limits. I see soft = 1024 and hard = 4096.
I am wondering what is the difference between these two output?
Also, do setRlimit() and ... |
ulimit -n sets the soft limit by default; you can add the -H option to view/set the hard limit.
For the most part, soft and hard limits behave like this:
root's processes (actually, any process with CAP_SYS_RESOURCE) may raise or lower any limit on any process.
any user's processes may lower any limit on other proces... | Difference between ulimit -n and /proc/$PID/limits |
1,389,293,469,000 |
Following ARG_MAX, maximum length of arguments for a new process it seems like ARG_MAX is wrongly (or at least ambiguously) defined on my Mac Mini 3,1 running Ubuntu 12.04:
$ getconf ARG_MAX # arguments
2097152
$ locate limits.h | xargs grep -ho 'ARG_MAX[ \t]\+[0-9]\+' | uniq | cut -d ' ' -f 8
131072
The actual lim... |
Yes, it's the length in bytes, including the environment.
Very roughly:
$ { seq 1 314290; env; } | wc -c
2091391
linux sysconf
The maximum length of the arguments to the exec(3) family of functions.
Must not be less than _POSIX_ARG_MAX (4096).
POSIX 2004 limits.h
Maximum length of argument to the e... | What is a canonical way to find the actual maximum argument list length? |
1,360,673,307,000 |
I have a standard Linux (Debian testing) laptop, with a swap partition.
I do a lot of experiments with it. Some of them are really memory hungry and the way Linux behaves by default is an issue for me... Let's give a stupid example:
Sit in front of the laptop
Open a terminal
Type python, then a = [0]*100000000
Now ... |
Someone suggested in your hear cgroups. Well, try to seek that direction as it can provide you with:
applied to a group of task you choose (thus not system wide but neither per process)
the limits are set for the group
the limits are static
they can enforce hard limit on memory and/or memory+swap
Something like that... | How to solve this memory issue gracefully? |
1,360,673,307,000 |
SERVER:/etc # ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
pending signals (-i) 96069
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files ... |
Use pam_limits(8) module and add following two lines to /etc/security/limits.conf:
root hard nofile 8192
root soft nofile 8192
This will increase RLIMIT_NOFILE resource limit (both soft and hard) for root to 8192 upon next login.
| How to modify ulimit for open files on SUSE Linux Enterprise Server 10.4 permanently? |
1,360,673,307,000 |
If I want to see all relevant log files of my apache2 server at once, I use
tail -f /var/kunden/logs/*log /var/kunden/logs/*log /var/log/apache2/*log |grep -v robots|grep -v favicon
But since those are too many files by now, I would like to encrease that limit.
How can I increase it for one ssh session? And How could... |
It is Important to know that there are two kinds of limits:
A hard limit is configurable by root only. This is the highest possible value (limit) for the soft limit.
A soft limit can be set by an ordinary user. This is the actual limit in effect.
Solution for a single session
In the shell set the soft limit:
ulimit ... | How to circumvent "Too many open files" in debian |
1,360,673,307,000 |
Multiple sessions of the same user. When one of them gets to the point that it can no longer run new programs, none of them can, not even a new login of that user. Other users can still run new programs just fine, including new logins.
Normally user limits are in limits.conf, but its documentation says "please note ... |
nproc was the problem:
[root@localhost ~]# ps -eLf | grep pascal | wc -l
4068
[root@localhost ~]# cat /etc/security/limits.d/20-nproc.conf
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 4096
root soft nproc ... | How can I tell which user limit I am running into? |
1,360,673,307,000 |
I recently installed Scientific linux 7 (64-bit) on my Dell box which has 2 cores (i.e. 2 logical CPUs). I haven't opened the computer to clean the fan, cooler, etc. for a while and the computer shuts down when using high (e.g. 100%) cpu on either (or both) cores for a few minutes (usually when noveau corrupts the dis... |
After a few days of intensive research I found two methods of lowering the cpu usage for processes. Generally if you want to lower the cpu usage of the entire machine, there are probably some programs which use the most long-lasting cpu and you should restrict those rather than burden the entire machine. And if you do... | Limit CPU usage % all processes and cores |
1,360,673,307,000 |
I have multiple users on a server. They upload and download their files through FTP. Sometimes some heavy transfer causes high load on the server. I am wondering, if there is any way to limit the ftp speed to avoid high load.
Any help would be much appreciated.
|
I found a way to limit ftp speed:
In the /etc/proftpd.conf insert this line:
TransferRate RETR,STOR,APPE,STOU 2000
This will limit ftp speed to 2 megabyte per second.
After changing the file you should restart the proftpd service:
/etc/init.d/proftpd restart
| How to limit ftp speed |
1,360,673,307,000 |
I need to read a large log file and send it over a local network using (netbsd) netcat between two VMs on the same host workstation.
I know that netcat has an interval, but as far as I can tell, the smallest interval you can use is 1 line/second.
Most of the files I need to send this way have hundreds of thousands of ... |
If you use bash and pipes, and are looking for an easy and dirty solution, you can try using sleep.
You can use this which act like cat but with a pause at each line. while read i; do echo "$i"; sleep 0.01; done. Here is an example at a little less than 100 lines per second.
$ time (seq 1 100 | while read i; do echo "... | How can I read lines at a fixed speed? |
1,360,673,307,000 |
I've just mounted a microSD card which has 17 partitions in my laptop and I'm getting the following error in the YaST partitioner:
Your disk /dev/mmcblk0 contains 17 partitions. The maximum number of partitions that the
kernel driver of the disk can handle is 7. Partitions above 7 cannot be accessed
and indeed - I ha... |
LVM is not overkill if you have 17 partitions. (IMHO)
As for the partition limit, it just happens to be the default. Probably no one expected that many partitions on a device that used to have only a few megs.
/usr/src/linux/Documentation/devices.txt:
179 block MMC block devices
0 = /dev/mmcblk... | /dev/mmcblk0 partitions limit |
1,360,673,307,000 |
When using Google Chrome I frequently get “Sorry Jim” tabs. The browser also frequently freezes and crashes.
Running it from terminal emulator show a long line of Too many open files:
[...:ERROR:shared_memory_posix.cc(231)] Creating shared memory in /dev/shm/.com.google.Chrome.0A3O7D failed: Too many open files
[...:E... |
Increase hard/soft limit.
/etc/security/limits.conf
Thus far a limit of 8192 seems to be enough. 4096 have proven to be to small.
Optionally only increase hard limit (if needed) and do:
ulimit -Sn 8192
from shell in which Chrome is started.
Note that the use of (the somewhat wide spread) way:
sudo sh -c "ulimit -n 8... | Chrome too many files open / crash / Sorry Jim |
1,360,673,307,000 |
My website is being DoS'ed by Google webspiders. Google is welcome to index my site, but sometimes it is querying a tagcloud on my site faster than my webserver can produce the results, making my webserver run out of resources.
How can I limit access to my webserver in such a way that normal visitors are not affected?... |
Try the mod_qos Apache module. The current version has the following control mechanisms.
The maximum number of concurrent requests to a location/resource
(URL) or virtual host.
Limitation of the bandwidth such as the maximum allowed number of
requests per second to an URL or the maximum/minimum of downloaded
kbytes p... | Throttling web crawlers |
1,360,673,307,000 |
I want to run a task with limits on the kernel objects that they will indirectly trigger. Note that this is not about the memory, threads, etc. used by the application, but about memory used by the kernel. Specifically, I want to limit the amount of inode cache that the task can use.
My motivating example is updatedb.... |
Following my own question on LKML this can be archived using Control Group v2:
Pre-requisits
Make sure your Linux kernel has MEMCG_KMEM enabled, e.g. grep CONFIG_MEMCG_KMEM "/boot/config-$(uname -r)"
Depending on the OS (and systemd version) enable the use of cgroups2 by specifying systemd.unified_cgroup_hierarchy=1 ... | Limit the inode cache used by a command |
1,360,673,307,000 |
I need to externally limit a process/session to a certain number of cores.
Are there any other possibilities than CPU affinity (I don't like the need to specify the actual cores) and cgroups (hard to integrate into our project)?
|
We went with cgroups in the end, since there really doesn't seem to be any other approach that would accomplish this.
Cgroups allow CPU utilization limiting through the kernel scheduler, using cpu.cfs_period_us and cpu.cfs_quota_us. This avoids the explicit specification of CPU cores.
| Externaly limiting number of CPU cores used |
1,360,673,307,000 |
In a Debian lenny server running postgresql, I noticed that a lack of semaphore arrays is preventing Apache from starting up.
Looking at the limits, I see 128 arrays used out of 128 arrays maximum, for semaphores. I know this is the problem because it happens on a semget call.
How do I increase the number of arrays?
P... |
If you read the manpage for semget, in the Notes section you'll notice:
System wide maximum number of semaphore sets: policy dependent (on Linux, this limit can be read and modified via the fourth field of /proc/sys/kernel/sem).
On my system, cat /proc/sys/kernel/sem reports:
250 32000 32 128
So do that on your ... | How do I increase the number of semaphore arrays in Linux? |
1,360,673,307,000 |
I have a packet rate limit (max. 10 per seconds) which is set by my internet provider. This is a problem if I want to use the AceStream player, because if I exceed the limit I get disconnected.
How can I restrict the internet access of this program?
I tried the suggested command:
iptables -A OUTPUT -m limit --limit 10... |
The solution you found was correct:
iptables -A OUTPUT -m limit --limit 10/s -j ACCEPT
But it is assuming a default policy of DROP or REJECT which is not usual for OUTPUT. You need to add:
iptables -A OUTPUT -j REJECT
Be sure to add this rule after the ACCEPT one. Either execute them in this order, or use -I instead... | set packet rate limit via iptables |
1,360,673,307,000 |
I am facing a problem where I have a fleet of servers which contain a lot of data. Each of the host runs many instances of a specific process p1, which makes several scp connections to other hosts in parallel to get the data it has to process. This in turn puts a lot of load on these hosts and many times they go down.... |
scp itself has no such feature. With GNU parallel you can use the sem command (from semaphore) to arbitrarily limit concurrent processes:
sem --id scp -j 50 scp ...
For all processes started with the same --id, this applies a limit of 50 concurrent instances. An attempt to start a 51st process will wait (indefinitely... | Limit maximum number of concurrent scp processes running on a host |
1,360,673,307,000 |
Let's say I'm running on a resource-constrained system, and I want to ensure that the applications I run open no more than 10 files total.
If I try to do it using setrlimit, something like:
if (fork() == 0) {
struct rlimit l = { 10, 10 };
setrlimit(RLIMIT_NOFILE, &l);
execl(EVIL_PROGRAM, args);
}
then EVI... |
Specifically for setrlimit
Here are some of the more useful command options that you may wish to look into; pulled'em from the man pages.
RLIMIT_NOFILE Specifies a value one greater than the maximum file descriptor number that can be opened by this process.
RLIMIT_NPROC The maximum number of processes (or, more pre... | Can I set a resource limit for the current process tree? |
1,360,673,307,000 |
Anyone understand the following code , running in bash ?
:(){ :|:& };:
It seems to be a "fork" bomb on Linux.
|
It's not that difficult to decipher in fact.
This piece of code just defines a function named : which calls two instances of itself in a pipeline: :|:&. After the definition an instance of this function is started.
This leads to a fast increasing number of subshell processes. Unprotected systems (systems without a pro... | Why is the following command killing a system? |
1,360,673,307,000 |
Which value is correct?(or they are all correct, but which one will take effect?)
$ cat /proc/sys/kernel/pid_max
32768
$ ulimit -a |grep processes
max user processes (-u) 77301
$ cat /proc/1/limits |grep processes
Max processes 77301 77301 p
|
All values is correct and have different meanings./proc/sys/kernel/pid_max is maximum value for PID, ulimit -u is maximum value for number of processes.
From man 5 proc:
/proc/sys/kernel/pid_max (since Linux 2.5.34)
This file specifies the value at which PIDs wrap around (i.e.,
the value ... | how to determine the max user process value? |
1,360,673,307,000 |
I would like to run a backup script in low CPU and disk I/O.
Is there any different between this:
#!/bin/bash
ulimit -e 19
ionice -c3 -p $$
and this:
#!/bin/bash
ionice -c3 -p $$
renice -n 19 -p $$
|
There is big difference between them.
ulimit -e only set the RLIMIT_NICE, which is a upper bound value to which the process's nice value can be set using setpriority or nice.
renice alters the priority of running process.
Doing strace:
$ cat test.sh
#!/bin/bash
ulimit -e 19
Then:
$ strace ./test.sh
.................. | Different between `ulimit -e` and `renice`? |
1,360,673,307,000 |
Sometimes when I write code I found that I made a stupid mistake and some loop takes almost all CPU time forever. Is there a way the running time of a program for example to 10 seconds in bash?
|
The timeout command will do this for you, i.e.
timeout 10s command
It will kill command after 10 seconds. Instead of s for seconds, you can also use m for minutes, h for hours or d for days.
| How to limit the running time of a program? |
1,360,673,307,000 |
I'm using Dropbox without the GUI in Linux. I would like to limit the upload rate, sometimes large files eats my internet bandwidth. Anyone knows how I do that?
|
You can start the Dropbox executable under trickle. This is a simple program that limits the bandwidth used by the program that it starts.
trickle -u 42 dropbox.py
| Control Dropbox upload rate on the command line |
1,360,673,307,000 |
I'm trying to write a bash script that will let me save a backup code (lots of numbers) in a file. I've finished the script but it's only letting me to save 4096 digits of the code.
I tried to do this:
# Ask for backup code
read -p "Backup code:" backupcode
# Check backup code length
l="${#backupcode}"
m=4096
if (( l ... |
There's no limit for the read command itself. But there's a limit for how much you can type on a single line in the terminal. To see this, try running the command wc -c and typing a very long line. You'll hit that same limit at 4096 bytes.
To input more than the limit, either arrange to make the code multi-line with e... | Is there a limit for the read command? |
1,360,673,307,000 |
What are the length limitations for using here-docs as part of bash command lines? I am finding that short here-docs work fine, but when they get longer there is some point or structure after which they break. When it fails, there are two symptoms. One is that the here-doc is abandoned early. The other is that one or ... |
I am not aware of any size limits for here-doc. I'm running kernel 3.9.1 and I've been experiencing the same issue here: when pasting large chunks of text in terminal some lines are truncated or missing. I found out (after some googling) that if you turn off line editing, pasting works fine (discussion here: Pasting l... | What are the bash shell length limitations for here-docs? |
1,360,673,307,000 |
I made a very simple bash script (echo at start, runs commands, echos at end) to add approx 7300 rules to iptables blocking much of China and Russia, however it gets through adding approximately 400 rules before giving the following error for every subsequent attempt to add a rule to that chain:
iptables: Unknown erro... |
OK, I figured it out.
I should have mentioned that I had a Virtuozzo container for my VPS. http://kb.parallels.com/en/746 mentions the following:
Also it might be required to increase numiptent barrier value to be
able to add more iptables rules:
~# vzctl set 101 --save --numiptent 400
FYI: The container has to b... | Can't add large number of rules to iptables |
1,360,673,307,000 |
I run DB2 on Linux where I have to allocate the vast majority of memory on the machine to shared memory segments.
This page is typical of the info that I've found about shmall/shmmax:
http://www.pythian.com/news/245/the-mysterious-world-of-shmmax-and-shmall/
My system is running fine now, but I'm wondering if there's ... |
Shared memory is not always a protected resource. As such many users can allocate shared memory. It is also not automatically returned to the memory pool when the process which allocated it dies. This can result in shared memory allocations which have been allocated but not used. This results in a memory leak that... | Linux - why is kernel.shmall so low by default? |
1,360,673,307,000 |
Chrome/Chromium won't load any websites and just shows the "Aw, Snap! Something went wrong..." page. Some sub-processes segfault.
When started in a Terminal, it will show lots of these:
[...ERROR:platform_thread_posix.cc(126)] pthread_create: Resource temporarily unavailable
While Chrome is still running, starting a... |
While investigating another issue, I may have found something relevant.
It wasn't possible to switch to another tty (Ctrl + Alt + F2):
A start job is running for Login Service...
Turns out this may be another systemd issue, which has its own limits.
The following config file was created, which apparently fixed the is... | Chrome/Chromium crashes ("Aw, snap!", segfault): "Resource temporarily unavailable" |
1,360,673,307,000 |
In the shell, as explained in this this Q&A in the context of expansion, depending on the system, the maximum length of a command's argument is initially constrained by the kernel setup. The maximum value is revealed at runtime using the getconf command (see also IEEE Std 1003.1, 2013 Edition):
# getconf ARG_MAX
20971... |
There is no standard way to retrieve the list of configuration variables that are supported on a system. If you program for a given POSIX version, the list in that version of the POSIX specification is your reference list. On Linux, getconf -a lists all available variable.
fpathconf isn't specific to PATH. It's about ... | Is the Linux implementation of the system configuration "variable" ARG_MAX different from other system variables and is it POSIX compliant? |
1,360,673,307,000 |
I'm trying to increase the default file descriptor limits for processes on my system. Specifically I'm trying to get the limits to apply to the Condor daemon and its sub-processes when the machine boots. But the limits are never applied on machine boot.
I have the limits set in /etc/sysctl.conf:
[root@mybox ~]# cat /e... |
Add ulimit -n 262144 to the condor init script.
| File descriptor limits are lost after a system reboot |
1,360,673,307,000 |
On Mac or Linux if you use the command ulimit -n you can see the page open limit for what seems to be an individual process according to this stackoverflow post.
So if a parent process spawns child processes and those child processes open files, do those files count against the open file limit for the parent?
|
The RLIMIT_NOFILE is on the maximum file descriptor value you may obtain/allocate, not on how many files may be open at a time.
Child processes inherit the limit, but other than that there's nothing that a child may do to influence the parent here. If the parent has some free fds in the range 0->limit-1, then it will ... | Do files opened by child processes count against the file open limit for the parent process? |
1,360,673,307,000 |
I've been seeing a strange behavior when messing up with the environment variables. I'm setting up a very long environment variable and this prevent launching any command:
( Ubuntu 14.04.5 LTS (GNU/Linux 4.4.0-66-generic x86_64) )
$ export A=$(python -c "print 'a'*10000000")
$ env
-bash: /usr/bin/env: Argument list t... |
The list of arguments and the environment of a command are copied in the same space in memory when a program starts. The error message is “Argument list too long”, but in fact the exact error is that the argument list plus the environment is too long.
This happens as part of the execve system call. Most if not all uni... | Setting a long environment variable breaks a lot of commands |
1,360,673,307,000 |
Please help me to find out how to limit number of program concurrent executions. I mean, particular program can be ran only, for example 5 times at once. I know how to limit proccess number for user, but how to do that for program, using PAM?
|
PAM is used to authorize logins and account modifications. It is not at all relevant to restricting a specific program.
The only way to apply a limit to the number of times a program can be executed is to invoke it through a wrapper that applies this limit. Users can of course bypass this wrapper by having their own c... | Limit number of program executions |
1,360,673,307,000 |
From Robert Love's Linux System Programming (2007, O'Reilly), this is what is given in the first paragraph (Chapter 1, Page 10):
The file position’s maximum value is bounded only by the size of the C type used to store it, which is 64-bits in contemporary Linux.
But in the next paragraph he says:
A file may be empt... |
He's saying it's bound by a 64-bit type, which has a maximum value of (2 ^ 64) - 1 unsigned, or (2 ^ 63) - 1 signed (1 bit holds the sign, +/-).
The type is not FILE; it's what the implementation uses to track the offset into the file, namely off_t, which is a typedef for a signed 64-bit type.1 (2 ^ 63) - 1 = 92233... | FILE size limitation according to Robert Love's textbook |
1,360,673,307,000 |
The following error occurs while using the below commands.Guide me to overcome this issue.
rpasa-vd1-363: cd /home/rpasa/DDEMO
No more processes.
|
You have hit our per-user process limit and you will have to talk to your system administrator to find out how many process you have running under your user account or you can try and run the ps command to see what processes you are running.
| Why the following error occurs in the terminal while using linux commands? |
1,428,257,586,000 |
How can I limit SSH login attempts per minute per IP ?
I want to disable login attempts during 5 seconds after a failure. Is this possible ? I'm not talking about ban a user after parsing logs like Fail2ban.
|
Question 1
This can be done with the module hashlimit.
iptables -A INPUT -p tcp --dport 22 -m hashlimit \
--hashlimit-mode srcip --hashlimit-above 3/minute -j DROP
Question 2
Netfilter does not see login failures only connections. You need a tool (like Fail2ban) which is active on both levels. You could create a ch... | How to temporarily ban an IP address, after "n" number of SSH login failures? |
1,428,257,586,000 |
I am running CentOS 7 on my VPS and I would like to limit bandwidth on a specific port. I have looked around extensively, and out of the solutions I can find, either it's a limit placed on an interface, or it's a vaguely described iptable setup that seems to have only been tried on CentOS 6.
In my case, my Shadowsock... |
Traffic can be limited using only Linux's Traffic Control.
Just to clarify, shadowsocks creates a tunnel with one side as a SOCKS5 proxy (sslocal, I'm assuming that's what is running on the OP's server considering the given ports), communicating with a remote endpoint (ssserver) which will itself communicate with the ... | Limit bandwidth on a specific port in CentOS 7? |
1,428,257,586,000 |
I have observed the following behavior:
[ec2-user@ip-10-66-68-55 ~]$ uname -a
Linux ip-10-66-68-55 3.4.103-76.114.amzn1.x86_64 #1
SMP Fri Sep 12 00:57:39 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
[ec2-user@ip-10-66-68-55 ~]$ ulimit -H -n; ulimit -S -n
1000
1000
[ec2-user@ip-10-66-68-55 ~]$ cat /etc/security/limits.d/80-... |
You should probably take a look inside /etc/pam.d/sudo file and check if pam_limits.so is required in it or in any of the other files it includes.
For example, the /etc/pam.d/sudo file in my system looks like below.
#%PAM-1.0
auth required pam_env.so readenv=1 user_readenv=0
auth required pam_env.so ... | does sudo always set process limits to the numbers from /etc/security/limits.d? |
1,428,257,586,000 |
I am increasing nproc limit for one of a development user account in my rhel6 system . After searching some rubust solution , I zerod at editing /etc/security/limits.conf with these two lines :
@dev_user hard nproc 4096
@dev_user soft nproc 4096
For some cases I have to deal wi... |
The settings specified in /etc/security/limits.conf are applied by pam_limits.so (man 8 pam_limits).
The pam stack is only involved during the creation of a new session (login). Thus you need to log out and back in for the settings to take effect.
| Increasing nproc limit for a non-root user . Only effective by restart |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.