Permission denied: config.toml

I’ve been using Hugo for a couple of months, built some test sites, now working on a personal photo album–it’s great and I love it. I’m a Windows user but have dabbled with Linux long enough to understand basic commands, file permissions, and so forth. My test sites and first forays with Hugo have been using WSL (Windows Subsystem for Linux), then I moved everything to a dedicated Linux box. After testing some initial scripts using GitHub actions and a self-hosted runner on Linux, I’m setting up a Raspberry Pi 3 with Ubuntu Server 64-bit and getting excited about automating the upkeep of several websites.

After installing Ubuntu and adding a USB-connected external drive to store the files for the websites and modifying /etc/fstab to autoload and running chown -R <myuser> * && chgrp -R <myuser> * to make sure all files were completely owned by my user account, I followed the recommended installation instructions by installing snap then using snap to install Hugo–it seemed to install quickly and smoothly.

With my repository pulled down from GitHub, I ran Hugo for the first time but immediately got the following error:

Error: "/blah/blah/blah/config.toml:1:1": open /blah/blah/blah/config.toml: permission denied

I double-checked file permissions, all files are read/write by user/group/world, files owned by me; I created a test folder and test file, edited, deleted file and folder, edited config.toml, renamed to hugo.toml, renamed back, kept running Hugo after each change, rebooted, tried again–all same error.

I’ve searched for this error and found a few old threads here and there, with things like “don’t use snap” or “check your file permissions” and other unhelpful stuff. The only thing I can think of is that my tests on Windows WSL used v0.92.2 and the Linux box used v0.110 (I think) and now that I’m freshly installing, I noticed snap installed v0.111.3-<biglonghex>+extended. Is there something up with the newest version? Should I uninstall from snap and manually install the binaries from GitHub?

Anything else?

Thanks,
David.

I’m guessing, but the Hugo snap is strictly confined, by design, to your $HOME directory. It sounds like your project files are outside of your $HOME directory.

Try installing the binary instead. See docs.

2 Likes

I hadn’t thought of that! Can snap can do that?

A quick look… running command -v hugo shows /snap/bin/hugo which points to /usr/bin/snap (a binary)! So, snap is totally in control!

Removing…

  • Removed Hugo from snap
  • Removed Snap from system
  • Installed Hugo from apt
  • Rebuilt site without problem!

That worked well–thank you!

2 Likes

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