# Default theme only works in maintenance mode

**URL:** <https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065>\
**Category:** Hosting farmOS\
**Created:** [July 7, 2024, 3:50pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065 "2024-07-07T15:50:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 7, 2024, 3:50pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/1 "2024-07-07T15:50:22Z")

</div>

Hello,

First time using farmOS installed in my own personal computer. Everything in the installation seemed to be ok but when I enter to the dashboard (ar any other page) the default theme is not applied:

 ![farmOS_bad](https://global.discourse-cdn.com/free1/uploads/farm_os/original/2X/e/e9a1691326f719e73171172c287a299c71b9463e.png)

But when I put the site into maintenance mode, the theme is correctly applied.

Any hint of what could be going on?

---

<div class="post-metadata">

**Author:** ![Farmer-Ed](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/farmer-ed/32/662_2.png) [@Farmer-Ed](https://farmos.discourse.group/u/Farmer-Ed)\
**Post date:** [July 8, 2024, 6:25am UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/2 "2024-07-08T06:25:06Z")

</div>

It could caused by a number of issues.

Things to check:

1. File permissions
2. settings.php config
3. Are you using any kind of reverse proxy?

It’s worth looking through this page, if you haven’t already [Installing farmOS | farmOS](https://farmos.org/hosting/install/)

And remember to clear caches after trying any fixes.

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 8, 2024, 12:28pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/3 "2024-07-08T12:28:17Z")

</div>

Hi Ed, thanks for answering.

1. Public, private and tmp file system path directories were set to `chmod 777`. I had tried 775 but it was not sufficient to pass all the errors in the _Requirements_ page prior installation. Is there any other directory I should check permissions?
2. What should I look specifically in the settings.php file?
3. Not that I’m aware of. All the proxy modules are inactive on the httpd.conf file and there are no other proxy configurations.

Checking the _Installing farmOS_ page:

- I believe I have all the system requirements checked.
- I’m using a packaged release: 3.2.2.
- I have tried clearing cache multiple times with no luck.

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 8, 2024, 12:41pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/4 "2024-07-08T12:41:36Z")

</div>

@bejuco Can you describe your setup in a little more detail? Are you hosting in Docker? Is the host OS Linux/Mac/Windows?

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 8, 2024, 1:29pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/5 "2024-07-08T13:29:44Z")

</div>

Of course. I have a Linux machine (kernel v.6.6.37 LTS) using EndevourOS. I’m using **apache (2.4.61)**, **php (8.3.9)** and **mariadb (11.4.2)**.

- First I created a database, a user and a password for farmOS using maridb.
- I didn’t use Docker. I installed the farmOS codebase directly on the host server (specifically on the `/srv/http` directory) using a packaged release tarball (v3.2.2).
- Then I configured apache to use a VirtualHost (to be able to run different sites on different ports like [this example](https://httpd.apache.org/docs/2.4/vhosts/examples.html#port)) with this configuration:

```auto
<VirtualHost 127.0.0.1:85>
	ServerName goyita-farmos.com
	DocumentRoot "/srv/http/farmOS/web"
	<Directory "/srv/http/farmOS/web">
		Options FollowSymLinks
		AllowOverride All
		Order allow,deny
	    Allow from all
		Require all granted
	</Directory>
</VirtualHost>

```

- Finally I got into the installation page and resolved all the requirements errors (missing php modules, non-writable or non-existent directories, etc.)

I did try to create a [development environment](https://farmos.org/development/environment/) but whenever I ran `docker compose up -d` and opened `http://localhost`, the broser had a _‘Connection was reset’_ error page. So I stopped trying. I think there is a conflict between the docker-proxy service and apache.

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 8, 2024, 5:20pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/6 "2024-07-08T17:20:55Z")

</div>

@bejuco Thanks!

That’s interesting that it works when you are in maintenance mode. It may be that maintenance mode disables “CSS/JS aggregation”, which I suspect is what’s causing your problem. You can test that yourself by going to /admin/config/development/performance and unchecking both boxes in the “Bandwidth optimization” section. (This is also where you can manually clear caches via the button at the top.)

If turning off CSS/JS aggregation fixes the problem, then that indicates that Drupal is unable to write CSS and JS files to your public files directory for some reason (usually permissions). So I would double check that. This looks like it describes what the permissions should be succinctly (and links to the much longer Drupal docs page for more details): [7 - What are the recommended directory permissions? - Drupal Answers](https://drupal.stackexchange.com/a/16994)

I wouldn’t recommend leaving CSS/JS aggregation turned off as a permanent solution. It indicates that there’s a deeper issue with Drupal’s ability to write files to the directories it needs to, which means other issues may arise besides this one.

You can also go to /admin/config/media/file-system to see how your public/private/temporary files directories are configured. That page may provide a warning/error if they are not correct… I forget.

Hope that helps!

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 8, 2024, 6:04pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/7 "2024-07-08T18:04:06Z")

</div>

Yep, the CSS/JS aggregation was it. I turned them off and and the theme is applied correctly. However, when I change the permissions of the different directories to the values recommended on the link you shared I get new problems.

I can’t toggle ON the CSS/JS Aggregation options. I get a _ **Set up the optimized assets file system path to make these optimizations available** _ message. I can only get rid of the message if I set 777 both on the `/default` and `/default/files` directories.

I don’t see any warnings or errors on the file-system page nor the status report page related to file paths.

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 8, 2024, 6:17pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/8 "2024-07-08T18:17:02Z")

</div>

@bejuco Who is the owner and group of the directories? The important thing is that they are writeable by the same user that Apache uses (often `www-data`).

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 8, 2024, 6:28pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/9 "2024-07-08T18:28:01Z")

</div>

@mstenta `root` in both cases. Apache is using the user/group `http`. So I guess I have to set permissions to that user/group?

Checking the status report page again I get a _Configuration files error_: _ **The directory sites/default is not protected from modifications and poses a security risk. You must change the directory’s permissions to be non-writable.** _

I’m sorry but is a little bit confusing for me. Directories should be writable only by the owners and the user Apache uses right?

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 8, 2024, 6:44pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/10 "2024-07-08T18:44:07Z")

</div>

> [@bejuco](#):
>
> `root` in both cases. Apache is using the user/group `http`. So I guess I have to set permissions to that user/group?

OK if the user and group of `sites/default/files` is `root`, and the permissions are `755`, that means that only the `root` user is allowed to write to it.

One option would be for you to change the owner and group of `sites/default/files` to `http` (if that’s the user that Apache is running its workers under).

> [@bejuco](#):
>
> Checking the status report page again I get a _Configuration files error_: _ **The directory sites/default is not protected from modifications and poses a security risk. You must change the directory’s permissions to be non-writable.** _

This error would be shown if you use `777` permissions. This means that ALL USERS are able to write to that directory, which is a security risk.

> [@bejuco](#):
>
> I’m sorry but is a little bit confusing for me. Directories should be writable only by the owners and the user Apache uses right?

Correct. So you can either make the `sites/default/files` directory owned by `http` and give it `755` permissions, or you can make it owned by `root` (or some other user) with a group of `http` and 775 permissions. I prefer to just make it owned by `www-data` in my case (`http` in yours).

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 8, 2024, 7:27pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/11 "2024-07-08T19:27:41Z")

</div>

@mstenta Just configured the folders to be owned by `root` and with a group of `http` with 775 permissions. Still no luck. When I toggle ON the CSS/JS Aggregates, the theme is not applied. Maybe is something that must be done prior the installation process?

What other issues could arise if I left the aggregates turned off?

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 9, 2024, 3:12pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/12 "2024-07-09T15:12:32Z")

</div>

@bejuco Are you 100% sure that Apache’s workers are running as the `http` user? Is it possible that it is actually `www-data` (this is most common in my experience, but can vary based on distro, and I’m not familiar with EndeavorOS). I’m not sure what else could cause the problem.

> [@bejuco](#):
>
> Maybe is something that must be done prior the installation process?

Nope. I’ve helped people debug this problem many times. It is almost always a permissions issue (or something weird because of Windows hosts related to permissions), and once the permissions are corrected it works. You do not need to reinstall.

BUT… you may need to clear the cache! And by that I mean Drupal’s cache, which I pointed to in a previous comment. There is a button in the Performance configuration page to do so. After you change the permissions make sure you clear the cache and then turn on aggregation.

> What other issues could arise if I left the aggregates turned off?

Aggregation turned off isn’t a big issue by itself. It will reduce your performance because you’ll be loading potentially dozens of separate CSS+JS files with each request, instead of 1 or 2.

The bigger issue is that Drupal can’t write files. This means you can’t upload anything to farmOS. No photos, documents, CSV imports, etc… There may be other important things that Drupal needs to write other than that, I’m not sure.

If your site is not publicly exposed to the internet, then maybe you don’t need to worry about setting perms to 777. But I prefer to do things correctly and understand “why” something is or isn’t working properly, so it can be fixed properly.

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 9, 2024, 10:04pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/13 "2024-07-09T22:04:13Z")

</div>

Hi @mstenta. I’m sure. The `httpd.conf` has

```auto
User http
Group http

```

and this is the output of `ps aux | grep -E '(apache|httpd)'`:

> **Summary**
>
> ```auto
> root 721 0.0 0.1 397680 28832 ? Ss 16:39 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 786 0.0 0.2 400360 34740 ? S 16:39 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 787 0.1 0.2 404676 46980 ? S 16:39 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 788 0.0 0.2 402312 36504 ? S 16:39 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 789 0.0 0.2 400264 34680 ? S 16:39 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 790 0.0 0.2 402312 36664 ? S 16:39 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 3002 0.0 0.2 402312 36616 ? S 16:40 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 3051 0.0 0.0 397924 10404 ? S 16:40 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 3052 0.0 0.0 397924 10404 ? S 16:40 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 3053 0.0 0.0 397924 10404 ? S 16:40 0:00 /usr/bin/httpd -k start -DFOREGROUND
> http 3054 0.0 0.0 397924 10404 ? S 16:40 0:00 /usr/bin/httpd -k start -DFOREGROUND
> pierre 3305 0.0 0.0 9024 2288 pts/0 S+ 16:42 0:00 grep --color=auto -E (apache|httpd)
> 
> ```

I did clear the Drupal’s cache. Every time I change `chmod` I restart apache, clear browser chache and Drupal’s cache with that button.

> [@mstenta](#):
>
> This means you can’t upload anything to farmOS. No photos, documents, CSV imports, etc…

But I have been able to upload files in farmOS. I did it with various .geojson for land assets and a .jpeg for a plant type. They are in the /sites/default/private/files/farm directory 🤔

> [@mstenta](#):
>
> If your site is not publicly exposed to the internet, then maybe you don’t need to worry about setting perms to 777. But I prefer to do things correctly and understand “why” something is or isn’t working properly, so it can be fixed properly.

I was thinking about that. It’s gonna be a local project so It’s not that bad. But I agree with you, I’d prefer to know everything is correctly set.

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 10, 2024, 5:06pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/14 "2024-07-10T17:06:00Z")

</div>

> [@bejuco](#):
>
> But I have been able to upload files in farmOS.

Huh! Well I’m stumped then. I assumed that file uploads didn’t work too. 🤔

Could it be that the `sites/default/files/css` and `js` directories specifically have the wrong owner/permissions? Those are where Drupal writes the aggregated files so they can be loaded quickly.

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 10, 2024, 6:42pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/15 "2024-07-10T18:42:00Z")

</div>

> [@mstenta](#):
>
> Could it be that the `sites/default/files/css` and `js` directories specifically have the wrong owner/permissions?

Well, those directories don’t exist! In the `sites/default/files` directory there’s only a `config_zQvXnUZ...` folder and a `php` folder. Maybe that’s the problem?

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 10, 2024, 6:57pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/16 "2024-07-10T18:57:28Z")

</div>

Oh. Well… Drupal _should_ create those directories itself, on-demand I believe. And as long as Apache can write to the parent directory it should be able to do that. You could try creating them yourself (and make them writable by Apache) and see if that allows you to turn on aggregation. Still curious why it didn’t create them itself though…

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 10, 2024, 8:15pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/17 "2024-07-10T20:15:22Z")

</div>

I tried creating the directories but when I clear Drupal’s cache, they are deleted, both with CSS/JS aggregate on and off.

---

<div class="post-metadata">

**Author:** ![mstenta](https://yyz2.discourse-cdn.com/free1/user_avatar/farmos.discourse.group/mstenta/32/4_2.png) [@mstenta](https://farmos.discourse.group/u/mstenta)\
**Post date:** [July 10, 2024, 8:33pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/18 "2024-07-10T20:33:55Z")

</div>

Hmm OK. I’m skimming through an issue on [Drupal.org](http://Drupal.org) that might help, starting with this comment:

[https://www.drupal.org/project/drupal/issues/3381293#comment-15206160](https://www.drupal.org/project/drupal/issues/3381293#comment-15206160)

There are a few comments that follow from there that might be worth trying in your environment.

Someone describes an issue (in their case it was Nginx, not Apache), where Nginx was sending the requests directly to the filesystem for the aggregated files, rather than letting Drupal process them, thus Drupal never got the chance to create them. Not sure if the same thing is happening in your case.

Please let me know if you figure it out. It might be helpful to add something to farmOS docs if it’s a missing configuration.

---

<div class="post-metadata">

**Author:** ![bejuco](https://avatars.discourse-cdn.com/v4/letter/b/ecd19e/32.png) [@bejuco](https://farmos.discourse.group/u/bejuco)\
**Post date:** [July 10, 2024, 9:57pm UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/19 "2024-07-10T21:57:54Z")

</div>

Thanks for all your help @mstenta. I’ll let you know any workaround.

---

<div class="post-metadata">

**Author:** ![lmcmullen](https://avatars.discourse-cdn.com/v4/letter/l/c57346/32.png) [@lmcmullen](https://farmos.discourse.group/u/lmcmullen)\
**Post date:** [July 15, 2024, 3:46am UTC](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065/20 "2024-07-15T03:46:00Z")

</div>

> [@mstenta](#):
>
> /admin/config/media/file-system

I’m having the same issue with a fresh install of FarmOS 3.2.2 on Ubuntu 24.04. Do install, do the initial configuration, and the webapp renders with just text as shown above. I also didn’t have the /var/www/html/farmOS/web/sites/default/css or /var/www/html/farmOS/web/sites/default/js directories. I created them and chown/chmod to match the default dir. Did the drush cr and restarted apache2. No love.

Looking at the access log, all the GET calls for css and js files return a 404.

What’s also odd is that none of the links work… on the page. All return 404.

[Next page](https://farmos.discourse.group/t/default-theme-only-works-in-maintenance-mode/2065.md?page=2)
