Too many files (only on non root user)

Hello, my name is Mario and this is my first post.

I have a problem with the command hugo serve when I run it under non root permission on linux .

I checked the permission of the files : all of them have user and group to “mario” (my standard user). I checked both the files in the root folder of the site /home/mario/Projects/mio_sito_new/basic/ and /tmp/hugo_cache
I add also that it used to work flawlessly until some days ago, I did a system update but I didn’t touch the hugo installation.
The system is Ubuntu 21.10 with hugo version
Hugo Static Site Generator v0.80.0/extended linux/amd64 BuildDate: 2021-02-09T18:47:48Z (ubuntu 0.80.0-6)

I also checked the other messages in forum matching “too many files” words and I saw that the problem could be in the ulimit flag, but the output of ulimit is unlimited . Moreover the problems affected an older version of Hugo

This is the output when run with user “mario” :

➜ hugo serve
Start building sites … 

                   | EN  
-------------------+-----
  Pages            | 17  
  Paginator pages  |  0  
  Non-page files   |  6  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Built in 16 ms
Watching for changes in /home/mario/Projects/mio_sito_new/basic/{archetypes,assets,content,data,layouts,static}
Error: too many open files

and this is the output of sudo hugo serve

Start building sites … 

                   | EN  
-------------------+-----
  Pages            | 17  
  Paginator pages  |  0  
  Non-page files   |  6  
  Static files     |  1  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Built in 16 ms
Watching for changes in /home/mario/Projects/mio_sito_new/basic/{archetypes,assets,content,data,layouts,static}
Watching for config changes in /home/mario/Projects/mio_sito_new/basic/config/_default, /home/mario/Projects/mio_sito_new/basic/config/development
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)

Do you have any hints on how to troubleshoot the problem ?
Thank you,
Mario

If you update to a newer Hugo version (=> 0.85), you should be able to work around the problem with:

hugo server --poll 700ms

The above will use a poll strategy when watching for changes.

To fix your original problem, you need to adjust the ulimit on your system.

1 Like

Thank you for the fast answer. I checked again the ulimit manual (explained in man bash) and I was mislead by the output of ulimit without parameters. Setting ulimit -n 4096 (it was 1024) solved my problem, thank you

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.