{"id":4083,"date":"2016-03-05T20:50:13","date_gmt":"2016-03-06T02:50:13","guid":{"rendered":"http:\/\/icesquare.com\/wordpress\/?p=4083"},"modified":"2016-03-05T23:23:10","modified_gmt":"2016-03-06T05:23:10","slug":"rhel-7-mariadb-mysql-error-1018-hy000-cant-read-dir-of-errno-24","status":"publish","type":"post","link":"https:\/\/icesquare.com\/wordpress\/rhel-7-mariadb-mysql-error-1018-hy000-cant-read-dir-of-errno-24\/","title":{"rendered":"RHEL 7 \/ MariaDB \/ MySQL: ERROR 1018 (HY000): Can&#8217;t read dir of &#8216;.&#8217; (errno: 24)"},"content":{"rendered":"<p>Recently, I decided to upgrade a database server from RHEL 6 (CentOS 6) to RHEL 7 (CentOS 7), which involves switching from MySQL 5.5 to MariaDB 5.5. Our server hosts about 100 databases, when I was testing them individually, I didn&#8217;t see any problem. However, when I ran the back up all databases one by one using mysqldump (i.e., running mysqldump command for each database, one after one, 100 times), something funny happened. Here is the error message:<\/p>\n<pre style=\"margin-top:100px;\">\r\n\r\n#The system was running a brunch of mysqldump commands, one by one (not via background)\r\n\r\nGot error: 1016: \"Can't open file: '.\/db_my_database\/tbl_mytable.frm' (errno: 24)\" when using LOCK TAB                                                                                                   LES\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\nmysqldump: Error: 'Out of resources when opening file '\/var\/tmp\/#sql_2d6c_2.MAI' (Errcode: 24)' when trying to dump tablespaces\r\n<\/pre>\n<p>At the mean time, I tried to access the database via MySQL terminal, <\/p>\n<pre>\r\nMariaDB [(none)]> SHOW DATABASES;\r\nERROR 1018 (HY000): Can't read dir of '.' (errno: 24)\r\n<\/pre>\n<p>This error message means the MySQL cannot access the file. If you google the message, you will notice that there are tons of solutions, and almost every of them suggests you to increase the open_files_limit variable in my.cnf.<\/p>\n<p>Therefore, I checked my configurations (\/etc\/my.cnf), and I noticed that the value was already set to 30000. I also checked the lsof command and I found something very interesting. Notice that I have 100 database, each of them contains about 60 tables. Each table has about 3 files. Depending on the timeout settings, if all database and tables are opened, the total number of opened file will be 100x60x3 = 18,000<\/p>\n<pre>\r\nsudo lsof -u mysql | wc\r\n1045   25811 239248\r\n<\/pre>\n<p>This result suggests that at the time of crashing, the mysql user (the system user that run the MariaDB service) was accessing 1045 files at the same time.<\/p>\n<p>So I was scratching my head. Why I already set the open_files_limit value to 30000 already, and the system crashed at 1045th files? I also verified the memory (command: free) and current process (command: top), and I didn&#8217;t find anything unusual. One last thing, I checked the open_files_limit value using MySQL terminal, and this is what I found:<\/p>\n<pre>\r\nMariaDB [(none)]> SHOW VARIABLES LIKE 'open_files_limit';\r\n+------------------+-------+\r\n| Variable_name    | Value |\r\n+------------------+-------+\r\n| open_files_limit | 1024  |\r\n+------------------+-------+\r\n<\/pre>\n<p>It seems that MariaDB didn&#8217;t honor the open_files_limit I set in config file, instead it uses the default one, which isn&#8217;t right. So after some investigations, I&#8217;ve noticed that RHEL 7 set up some security stuffs, such that you will need to set the open_file_limit variable at the system level rather than the application level. In the other words, whatever you put in the \/etc\/my.cnf, it won&#8217;t go through the security check at RHEL.<\/p>\n<p>Here is how to set the equivalent open_files_limit at the system level:<\/p>\n<pre>\r\nsudo mkdir -p \/etc\/systemd\/system\/mariadb.service.d\/\r\nsudo nano \/etc\/systemd\/system\/mariadb.service.d\/limits.conf\r\n<\/pre>\n<pre>\r\n#Add the following, for me, I like to set the open_files_limit to 30000:\r\n[Service]\r\nLimitNOFILE=30000\r\n<\/pre>\n<pre>\r\nsudo systemctl daemon-reload\r\nsudo systemctl restart mariadb\r\n<\/pre>\n<p>I tried to rerun the command again and that&#8217;s what I got:<\/p>\n<pre>\r\nMariaDB [(none)]> SHOW VARIABLES LIKE 'open_files_limit';\r\n+------------------+-------+\r\n| Variable_name    | Value |\r\n+------------------+-------+\r\n| open_files_limit | 30000 |\r\n+------------------+-------+\r\n1 row in set (0.00 sec)\r\n<\/pre>\n<p>That&#8217;s it! Did I save you from heart attack?<\/p>\n<p>One of the biggest selling points of RHEL is the stability. When we upgraded from RHEL 6 to RHEL 7 (clean install), we expected that everything should work fine without too much modifications. Unfortunately, what I saw is a broken system. I really don&#8217;t expect that this happens in an enterprise class product.<\/p>\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Recently, I decided to upgrade a database server from RHEL 6 (CentOS 6) to RHEL 7 (CentOS 7), which involves switching from MySQL 5.5 to MariaDB 5.5. Our server hosts <a class=\"more-link\" href=\"https:\/\/icesquare.com\/wordpress\/rhel-7-mariadb-mysql-error-1018-hy000-cant-read-dir-of-errno-24\/\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"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},"jetpack_post_was_ever_published":false},"categories":[94,144,6,69],"tags":[167,9,168],"class_list":["post-4083","post","type-post","status-publish","format-standard","hentry","category-computer-problems-computer-help-pc-support","category-sever-problem","category-technology","category-troubleshooting-technology","tag-mariadb","tag-mysql","tag-rhel"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p1sqzr-13R","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":3692,"url":"https:\/\/icesquare.com\/wordpress\/centos-7-epel-remi-location\/","url_meta":{"origin":4083,"position":0},"title":"CentOS 7 EPEL \/ REMI Location","author":"Derrick","date":"July 18, 2014","format":false,"excerpt":"CentOS 7 was released about a week ago, so I decided to give it a try. As you probably know, CentOS is a clone of Red Hat Enterprise Linux(RHEL). Typically, Red Hat put the new features in Fedora first. If things go well, they will move the new features to\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3914,"url":"https:\/\/icesquare.com\/wordpress\/zfs-linux-vs-freebsd\/","url_meta":{"origin":4083,"position":1},"title":"Running ZFS on Linux: Things you should know and be aware of","author":"Derrick","date":"February 29, 2016","format":false,"excerpt":"First Published: Feb 29, 2016 Last Revised: January 10, 2026 ZFS is a next-generation file system renowned for its reliability and advanced features. However, due to legal and licensing issues, it is not included by default in most Linux distributions. Fortunately, you can still install (ZFS on Linux) with just\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1028,"url":"https:\/\/icesquare.com\/wordpress\/mysql-starting-mysql-error-the-server-quit-without-updating-pid-file\/","url_meta":{"origin":4083,"position":2},"title":"MySQL: Starting MySQL&#8230;.. ERROR! The server quit without updating PID file","author":"Derrick","date":"November 12, 2010","format":false,"excerpt":"This step-by-step guide is mainly for FreeBSD, however the idea is the same for Linux. Every once a while, when I update my FreeBSD box, the system likes to shutdown my MySQL server. Therefore, I need to start it again after the update is done. Unfortunately, the upgrade process is\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3883,"url":"https:\/\/icesquare.com\/wordpress\/mysql-random-error-error-2013-hy000-lost-connection-to-mysql-server-at-reading-authorization-packet-system-error-0\/","url_meta":{"origin":4083,"position":3},"title":"MySQL Random Error: ERROR 2013 (HY000): Lost connection to MySQL server at &#8216;reading authorization packet&#8217;, system error: 0","author":"Derrick","date":"December 6, 2014","format":false,"excerpt":"Recently, I am experiencing a weird error when connecting to a MySQL server remotely: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0 Basically, this error is similar to the busy tone when you are making calls. The key thing is, it happens randomly.\u2026","rel":"","context":"In &quot;Everyday Computer Problem&quot;","block_context":{"text":"Everyday Computer Problem","link":"https:\/\/icesquare.com\/wordpress\/category\/everyday-computer-problem\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":923,"url":"https:\/\/icesquare.com\/wordpress\/freebsd-or-linux\/","url_meta":{"origin":4083,"position":4},"title":"FreeBSD or Linux in 6 Simple Questions","author":"Derrick","date":"February 18, 2016","format":false,"excerpt":"FreeBSD or Linux FreeBSD or Linux (Ubuntu\/RHEL)? This is a very old question. It's like asking iPhone or Android. There is no short answer. It all depends on your situation. To make things easier, I am going to break it down into six simple questions to help you making decision.\u2026","rel":"","context":"In &quot;Computer Problems&quot;","block_context":{"text":"Computer Problems","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/computer-problems-computer-help-pc-support\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5051,"url":"https:\/\/icesquare.com\/wordpress\/why-i-downgraded-from-almalinux-10-x86_64_v2-to-almalinux-9-on-my-servers\/","url_meta":{"origin":4083,"position":5},"title":"Why I Downgraded from AlmaLinux 10 x86_64_v2 to AlmaLinux 9","author":"Derrick","date":"December 9, 2025","format":false,"excerpt":"Recently, I installed AlmaLinux 10 x86_64_v2 on several servers, hoping it would breathe new life into my older hardware (purchased between 2010 and 2015). After a few days of testing, however, I decided to revert back to AlmaLinux 9. In this post, I\u2019ll explain the reasons behind this decision. The\u2026","rel":"","context":"In &quot;Technology&quot;","block_context":{"text":"Technology","link":"https:\/\/icesquare.com\/wordpress\/category\/technology\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4083","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/comments?post=4083"}],"version-history":[{"count":14,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4083\/revisions"}],"predecessor-version":[{"id":4097,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/posts\/4083\/revisions\/4097"}],"wp:attachment":[{"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/media?parent=4083"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/categories?post=4083"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/icesquare.com\/wordpress\/wp-json\/wp\/v2\/tags?post=4083"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}