WSL and file modification detection / livereload troubles?

Hi

I try to develop my website with Hugo and meet some troubles.
I try to use it with postcss and tailwindcss. Project is in early stage, nearly out of the box…

I have a laptop running on manjaro and hugo works fine

I have a desktop running on windows 10 and develop my web sites with ubuntu 20.04 in WSL2, code edition is made with VSCode in Windows… and Hugo does not like it ! Page generation is veeeery slow (30 / 50 seconds) and most of the time file system modifications are not detected and of course livereload is not triggered.

Any clue ?

Sooo… let’s assume you are on my side and I am on your side: Would you want me to add information about any code and configuration of your setup? Because if not, you would be wrong :wink: From your description nobody can help you. Please post your repository and somebody will have a look into it.

Hi @davidsneighbour thank you.

Answering to you will be fast as i have nearly made nothing until yet

I made ‘hugo new site test-site’ , then pickup this theme https://github.com/dirkolbrich/hugo-theme-tailwindcss-starter , activate theme, copying sample site… and that’s where i am :slight_smile: no other code than this

Generation takes several ms in manjaro (livereload ok; site is ok) and nearly 40 to 50 seconds in WSL 2 (no livereload update; site is ok though not updated)

Do you want some logs or something more ? Because at this stage i don’t know what to look for. BTW I suspect the WSL

Windows 10 Pro build 20257.fe_release.201106-1554
Ubuntu 20.04.1 LTS in WSL version 2
Hugo Static Site Generator v0.78.2-959724F0 linux/amd64 BuildDate: 2020-11-13T10:08:14Z

Does WSL print anything when running hugo server? I am suspecting WSL too, but I would expect some kind of notice about “starting up the engine”. Can you try to run the following command and copy paste everything that comes up:

hugo server --minify --disableFastRender --i18n-warnings --navigateToChanged  --templateMetrics --templateMetricsHints --verbose --verboseLog --path-warnings --buildDrafts --buildExpired --buildFuture --watch --enableGitInfo --forceSyncStatic --log true --logFile hugo.log --verbose

That’s my go-to-verbose-mode hugo server command. Some things might be unimportant, but template metrics and verbosity are good for a start. We should see from the timestamps where it sleeps.

Here is the output (it’s the same after removing --enableGitInfo that causes the error)

ERROR 2020/11/16 17:16:45 Failed to read Git log: fatal: not a git repository (or any parent up to mount point /mnt)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

Template Metrics:

      cache     cumulative       average       maximum
  potential       duration      duration      duration  count  template
      -----     ----------      --------      --------  -----  --------
         56 1m45.4629889s  13.182873612s   26.3672032s      8  partials/head.html
          0 1m19.1027177s  26.367572566s   26.3680922s      3  _default/single.html
          0   26.3647805s   26.3647805s   26.3647805s      1  index.html
         50      1.5041ms     188.012µs       382.5µs      8  partials/dev-parameters.html
          0      1.0842ms       361.4µs       414.3µs      3  _default/list.html
          0       941.5µs     235.375µs       370.5µs      4  _internal/_default/rss.xml
        100       852.5µs     106.562µs       335.3µs      8  partials/header.html
          0       368.2µs       368.2µs       368.2µs      1  404.html
        100       315.3µs      39.412µs       129.7µs      8  partials/dev-size-indicator.html
          0       261.5µs       261.5µs       261.5µs      1  _internal/_default/sitemap.xml
        100        33.5µs       4.187µs        28.7µs      8  partials/footer.html

Built in 26419 ms
Error: Error building site: logged 1 error(s)

I also read this in reddit about WSL 2 : They changed the file sharing protocol, from using they own custom developed protocol to using the 9P protocol, which at this time might not support file changes event.. I will investigate

I found out the problem ! :slight_smile:

Let me explain

My web projects are stored on a D: Windows NTFS hard drive, in the WSL this drive is auto mounted as /mnt/d , I simlinked this in my home for quick access. THAT is what bothered Hugo

Now i copied my site in a pure Linux folder in my home and that is working perfectly :slight_smile:

In fact, it’s more a livereload issue with the 9P protocol than a Hugo issue :slight_smile: