{"id":9377,"date":"2022-05-13T23:56:02","date_gmt":"2022-05-13T21:56:02","guid":{"rendered":"https:\/\/monodes.com\/predaelli\/?p=9377"},"modified":"2022-05-13T23:56:02","modified_gmt":"2022-05-13T21:56:02","slug":"increase-open-files-limit-solution-for-too-many-open-files-24","status":"publish","type":"post","link":"https:\/\/monodes.com\/predaelli\/2022\/05\/13\/increase-open-files-limit-solution-for-too-many-open-files-24\/","title":{"rendered":"Increase &#8220;Open Files Limit&#8221;. Solution for &#8220;Too many open files (24)&#8221;"},"content":{"rendered":"<p><em><a href=\"https:\/\/rtcamp.com\/tutorials\/linux\/increase-open-files-limit\/\">Increase &#8220;Open Files Limit&#8221;. Solution for &#8220;Too many open files (24)&#8221;<\/a><\/em><\/p>\n<p><!--more--><!--nextpage--><\/p>\n<blockquote><p>If you are getting error \u201cToo many open files (24)\u201d then your application\/command\/script is hitting max open file limit allowed by linux. You need to increase open file limit as below:<\/p>\n<h2>Increase limit<\/h2>\n<h3>Per-User Limit<\/h3>\n<p>Open file:\u00a0<code class=\"\" data-line=\"\">\/etc\/security\/limits.conf<\/code><\/p>\n<p>Paste following towards end:<\/p>\n<pre class=\"no-highlight\">*         hard    nofile      500000\n*         soft    nofile      500000\nroot      hard    nofile      500000\nroot      soft    nofile      500000<\/pre>\n<p>500000 is fair number. I am not sure what is max limit but 999999 (Six-9) worked for me once as far as I remember.<\/p>\n<p>Once you save file, you may need to logout and login again.<\/p>\n<h4>pam-limits<\/h4>\n<p>I read at many places that an extra step is neede for limit to change for daemon processes. I did not need following yet, but if above changes are not working for you, you may give this a try.<\/p>\n<p>Open\u00a0<code class=\"\" data-line=\"\">\/etc\/pam.d\/common-session<\/code><\/p>\n<p>Add following line:<\/p>\n<pre class=\"no-highlight\">session required pam_limits.so<\/pre>\n<h3>System-Wide Limit<\/h3>\n<p>Set this higher than user-limit set above.<\/p>\n<p>Open\u00a0<code class=\"\" data-line=\"\">\/etc\/sysctl.conf\u00a0<\/code><\/p>\n<p>Add following:<\/p>\n<pre class=\"no-highlight\">fs.file-max = 2097152<\/pre>\n<p>Run:<\/p>\n<pre class=\"no-highlight\">sysctl -p<\/pre>\n<p>Above will increase \u201ctotal\u201d number of files that can remain open system-wide.<\/p>\n<h2>Verify New Limits<\/h2>\n<p>Use following command to see max limit of file descriptors:<\/p>\n<pre class=\"no-highlight\">cat \/proc\/sys\/fs\/file-max<\/pre>\n<p>Hard Limit<\/p>\n<pre class=\"no-highlight\">ulimit -Hn<\/pre>\n<p>Soft Limit<\/p>\n<pre class=\"no-highlight\">ulimit -Sn<\/pre>\n<p>if you are logged in as root:<\/p>\n<h3>Check limit for other user<\/h3>\n<p>Just replace <code class=\"\" data-line=\"\">www-data<\/code>\u00a0by linux username you wish to check limits for:<\/p>\n<pre class=\"no-highlight\">su - www-data -c 'ulimit -aHS' -s '\/bin\/bash'<\/pre>\n<h3>Check limits of a running process:<\/h3>\n<p>Find process-id (PID):<\/p>\n<pre class=\"no-highlight\">ps aux | grep process-name<\/pre>\n<p>Suppose, XXX is PID, then run following commands to check limits:<\/p>\n<pre class=\"no-highlight\">cat \/proc\/XXX\/limits<\/pre>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p class=\"excerpt\">Increase &#8220;Open Files Limit&#8221;. Solution for &#8220;Too many open files (24)&#8221;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"https:\/\/monodes.com\/predaelli\/2022\/05\/13\/increase-open-files-limit-solution-for-too-many-open-files-24\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"activitypub_content_warning":"","activitypub_content_visibility":"","activitypub_max_image_attachments":4,"activitypub_interaction_policy_quote":"anyone","activitypub_status":"","footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[72,278],"tags":[],"class_list":["post-9377","post","type-post","status-publish","format-standard","hentry","category-documentations","category-tricks"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p6daft-2rf","jetpack-related-posts":[{"id":14800,"url":"https:\/\/monodes.com\/predaelli\/2026\/01\/24\/ventoy-a-new-bootable-usb-solution\/","url_meta":{"origin":9377,"position":0},"title":"Ventoy A New Bootable USB Solution","author":"Paolo Redaelli","date":"2026-01-24","format":false,"excerpt":"Ventoy A New Bootable USB Solution Ventoy is an open source tool to create bootable USB drive for ISO\/WIM\/IMG\/VHD(x)\/EFI files.With Ventoy, you don't need to format the disk over and over, you just need to copy the ISO\/WIM\/IMG\/VHD(x)\/EFI files to the USB drive and boot them directly.You can copy many\u2026","rel":"","context":"In &quot;Software&quot;","block_context":{"text":"Software","link":"https:\/\/monodes.com\/predaelli\/category\/software\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2026\/01\/ventoy.webp?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":12892,"url":"https:\/\/monodes.com\/predaelli\/2025\/03\/06\/how-to-download-all-pdf-files-linked-from-a-single-page-using-wget\/","url_meta":{"origin":9377,"position":1},"title":"How to download all PDF files linked from a single page using wget","author":"Paolo Redaelli","date":"2025-03-06","format":false,"excerpt":"You can use wget to download all PDFs from a webpage by using: wget -r -l1 -H -t1 -nd -N -np -A.pdf -erobots=off --wait=2 --random-wait --limit-rate=20k [URL] -r: Recursive download. -l1: Only one level deep (i.e., only files directly linked from this page). -H: Span hosts (follow links to other\u2026","rel":"","context":"In &quot;Tricks&quot;","block_context":{"text":"Tricks","link":"https:\/\/monodes.com\/predaelli\/category\/documentations\/tricks\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11998,"url":"https:\/\/monodes.com\/predaelli\/2024\/10\/18\/open-indd-files-without-indesign\/","url_meta":{"origin":9377,"position":2},"title":"Open INDD files without InDesign","author":"Paolo Redaelli","date":"2024-10-18","format":false,"excerpt":"Open Photopea.com, press File - Open, and select any INDD file Source: Open INDD files without InDesign","rel":"","context":"In &quot;Senza categoria&quot;","block_context":{"text":"Senza categoria","link":"https:\/\/monodes.com\/predaelli\/category\/senza-categoria\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3200,"url":"https:\/\/monodes.com\/predaelli\/2017\/07\/03\/already\/","url_meta":{"origin":9377,"position":3},"title":"Already?","author":"Paolo Redaelli","date":"2017-07-03","format":false,"excerpt":"I have overestimated the capabilities of my Inforce 6410. To be truly honest I knew that most ARM boards and the OSes running on it are 32bit and this includes Raspberries, but \"everyone knows that 4Gb of address space is enough for everything\" me, now, mocking the famous \"640Kb ought\u2026","rel":"","context":"In &quot;Cryptocoins&quot;","block_context":{"text":"Cryptocoins","link":"https:\/\/monodes.com\/predaelli\/category\/cryptocoins\/"},"img":{"alt_text":"Inforce IFC 6410","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2016\/05\/wp-1462654662786-300x225.jpeg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":5026,"url":"https:\/\/monodes.com\/predaelli\/2018\/12\/10\/exploiting-developer-infrastructure-is-ridiculously-easy\/","url_meta":{"origin":9377,"position":4},"title":"Exploiting Developer Infrastructure Is Ridiculously Easy","author":"Paolo Redaelli","date":"2018-12-10","format":false,"excerpt":"The open-source ecosystem is broken Source: Exploiting Developer Infrastructure Is Ridiculously Easy That's why Debian has its own repositories. Exploiting Developer Infrastructure Is Ridiculously Easy The open-source ecosystem is broken Jarrod Overson Nov 27 Photo: Charles Deluvio\/Unsplash In late October, an issue was opened on an extremely popular node.js tool,\u2026","rel":"","context":"In &quot;Ethics&quot;","block_context":{"text":"Ethics","link":"https:\/\/monodes.com\/predaelli\/category\/ethics\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6167,"url":"https:\/\/monodes.com\/predaelli\/2019\/10\/09\/android-is-not-open-source\/","url_meta":{"origin":9377,"position":5},"title":"Android is NOT open source","author":"Paolo Redaelli","date":"2019-10-09","format":false,"excerpt":"Now I know I've done the-right-thing supporting Librem5. I knew that almost all phones comes with a proprietary OS, either the prison-ware iOS or proprietary derivative of Android. Yet I wasn't aware that the situation is SO bad. Read this. Android is not open source - The Quantified VC -\u2026","rel":"","context":"In &quot;Ethics&quot;","block_context":{"text":"Ethics","link":"https:\/\/monodes.com\/predaelli\/category\/ethics\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2019\/10\/x3mo7R1b52BI_whuA_YLXQ-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2019\/10\/x3mo7R1b52BI_whuA_YLXQ-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2019\/10\/x3mo7R1b52BI_whuA_YLXQ-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/monodes.com\/predaelli\/wp-content\/uploads\/sites\/4\/2019\/10\/x3mo7R1b52BI_whuA_YLXQ-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/9377","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/comments?post=9377"}],"version-history":[{"count":0,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/posts\/9377\/revisions"}],"wp:attachment":[{"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/media?parent=9377"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/categories?post=9377"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/monodes.com\/predaelli\/wp-json\/wp\/v2\/tags?post=9377"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}