Problem/Motivation

After upgrading a website to version 9.5.0, the following warning appeared in the site's Status report:

Deprecated themes enabled
Deprecated themes found: Classy, Stable.

My site is using Olivero as its default theme and Claro as the administration theme. Neither depends on Classy or Stable. I am unable to find a means to disable these unused deprecated themes. They do not appear on the list of themes on the "Appearance" page, where one normally uninstall unused themes. Screenshot:

My appearance page

There is a documentation page about Deprecated and obsolete modules and themes, but it just say that they are deprecated and suggests that one should use Starterkit theme generator instead. It doesn't tell one how to disable them.

The problem only affects legacy websites. A brand new install of Drupal 9.5.0 with Olivero and Claro installed does not get this warning.

I suspect that the reason this happens is that Bootstrap5 version 2.0.5 (which used Classy as its "base theme", which in turn used Stable) in the past was installed as the default theme. However, Bootstrap5 is no longer installed now.

Steps to reproduce

To reproduce, install Drupal 9.5.0 and set Bootstrap5 version 2.0.5 as the default theme. Then uninstall Bootstrap5 and revert to Olivero as its default theme. You shall now get the warning about these deprecated themes being enabled.

Proposed resolution

Determine if there is a dependency on a hidden theme

drush theme-uninstall classy
drush theme-uninstall stable

Workarounds

Method A

Removehidden: true from code>core/themes/classy/classy.info.yml and core/themes/stable/stable.info.yml
uninstall the themes
Add the line back to the files.

Method B

If you are using the config exporter, edit your config/core.extension.yml file and remove the "classy" and "stable" elements under "theme"

Remaining tasks

Comments

gisle created an issue. See original summary.

cilefen’s picture

I am unable to find a means to disable these unused deprecated themes.

What do you mean by that, specifically? Can you not disable them on the “appearance” UI?

gisle’s picture

No. I can not disable them by going to “Appearance” in the administrative UI. Going there:

Under "Installed themes", I see:

  • Olivero 9.5.0 (default theme)
  • Claro 9.5.0 (administration theme)

And under "Uninstalled themes", I see:

  • Bartik 9.5.0 (Deprecated)
  • Seven 9.5.0 (Deprecated)
  • Stark 9.5.0

The themes Classy and Stable are not listed at all on that page.

gisle’s picture

Issue summary: View changes
StatusFileSize
new48.63 KB

Added screenshot of "Appearence" page to the issue summary.

cilefen’s picture

Title: How to uninstall deprecated themes? » Deprecated themes cannot be disabled on the "Appearance" tab because they are hidden
Component: documentation » theme system
Category: Support request » Bug report
spokje’s picture

Can confirm this happens when following the steps to reproduce in the IS.

The not-being-able-to-disable bit is indeed because those themes are hidden (they have hidden: true in their .info,yml.
A workaround for now is to remove the that line from both core/themes/classy/classy.info.yml and core/themes/stable/stable.info.yml, uninstall them, and put the line back.

Both themes got installed by the dependency in themes/contrib/bootstrap5/bootstrap5.info.yml: base theme: classy

"Interestingly" when doing the same steps on 10.0.x/10.1.x, composer pulls in bootstrap5 versions 2.0.2, which doesn't seem to have the dependency on classy.

cilefen’s picture

Title: Deprecated themes cannot be disabled on the "Appearance" tab because they are hidden » Deprecated core themes cannot be disabled on the "Appearance" tab because they are hidden
cilefen’s picture

Priority: Normal » Major

I think this is major priority because it sets up a confusing situation for site owners.

gisle’s picture

Priority: Major » Normal

I can confirm that the workaround suggested in comment #6 works. After removing hidden: true in their .info,yml, they appear on the “Appearance” page and can be uninstalled. After doing so, the Warning in the Status report disappear.

gisle’s picture

Priority: Normal » Major

Didn't intend to alter Priority.

trolin’s picture

@Spokje, when I set the hidden attribute to false or delete that line entirely, the themes show up in Appearance but there is no uninstall option.

gisle’s picture

StatusFileSize
new6.74 KB

but there is no uninstall option.

Yes there is, at least for me.

Unisnatll stable

Of course, since Classy uses Stable, the "Unistall" link won't appear for Stable until you've uninstalled Classy.

spokje’s picture

@trolin Here's a Drupal Classic Reply(TM): Did you clear the caches?

By no means trying to be condescending BTW, but since it worked for @gisle, this is the only thing I can come up with that could be the difference between both situations.

INSTA-CROSSPOST-EDIT: And what @gisle said just above me.

tedfordgif’s picture

Status: Active » Needs work
StatusFileSize
new822 bytes

Here's an untested patch that shows enabled deprecated hidden themes (that's a mouthful). Ideally there'd also be some other indication added to the themes page (visual + text).

sidgrafix’s picture

If anyone runs into issue with no uninstall option for theme "seven" (line hidden: true does not exist) adding it appears to remove it from the installed section.

- it was thee only way I could get it removed!

However, it is still listed on status page as being installed (nothing listed in this thread appears to allow uninstall of seven)

Edit: found issue for my situation "The use of contributed Adminimal theme" once removed uninstall becomes available.. I just switched base theme for adminimal to use claro (dirty but works)

gisle’s picture

sidgrafix,
I think that what you found for your situation is what applies in general: If an installed theme depends on another theme, you shall not be able to uninstall the base theme. This is by design. It is not a bug.

desierto’s picture

StatusFileSize
new157.59 KB

Once I edit to show the 2 themes in Appearance, I also have no uninstall option on my Stable or Classy. I upgraded Bootstrap5 to the latest 2.0.5 version (and cleared caches) to see if that would help and it did not.

No uninstall on classy and stable

gisle’s picture

desierto,
that is correct. This is working as designed. See my comment #16 above. Also see the section "Steps to reproduce in the issue summary" and comment #6.

You need to uninstall Bootstrap5 version 2.0.5 if you want to be able to uninstall Classy and Stable. The reason for this is that Bootstrap5 2.0.5 is set up with Classy as a base theme, and it in turn depends on Stable. There is the 3.0.x development branch that tries to fix this, but no stable release. You may want to look at the Bootstrap5 Issue queue for issues affecting the 3.0.x branch. For example, see #3314491: Split D9 and D10 branches as classy removal breaks functionality.

gisle’s picture

Issue summary: View changes

Removed "Support question" from the issue summary. This is no longer a support request (this was resolved/answered by comment #6).

Webbeh’s picture

Issue summary: View changes

Adding next steps (from Needs Work [NW] status change) into Issue Summary (IS).

trolin’s picture

@Spokje, I just realized that I never acknowledged your comment #13. No offense taken, but yes, I did clear caches with no effect. I also tried installing Bootstrap5, then removing it, but Classy and Stable still have no uninstall options.

noah’s picture

@trolin: I had the same issue, and discovered when I tried to uninstall via Drush that one of my installed themes has Stable as its base_theme—maybe that's why you don't see the uninstall option after unhiding?

trolin’s picture

@noah, you win the prize. I'm using theme danland which depends on classy which depends on stable. Thanks for the tip.

xem8vfdh’s picture

workaround #6 worked for me.

I also didn't see an uninstall button on Stable noted in #11. Once i clicked uninstall on Classy, the Stable panel shifted and now there was an uninstall button there.

Another way to achieve this, if you are using the config exporter, is to edit your config/core.extension.yml file and remove the "classy" and "stable" elements under "theme"

astringer’s picture

Just reiterating #6 worked for me, if you simply need to get this done now.

boinkster’s picture

Confirming that #24 worked for me - do a 'drush cim' after the edit.

disparil’s picture

In my case I cannot uninstall Classy and Stable, because my custom theme (News+ Lite) is based on Classy .

Time to update my custom theme to a new Drupal9 base theme.

danielveza’s picture

Version: 9.5.x-dev » 10.1.x-dev
Status: Needs work » Needs review
Issue tags: +Bug Smash Initiative
StatusFileSize
new1.07 KB
new2.88 KB
new2.8 KB

Updated the patch for this and added a test. Happy for opinions on if this is the right approach & the wording of the status message.

The last submitted patch, 28: 3328016-28-test-only.patch, failed testing. View results

danielveza’s picture

StatusFileSize
new2.88 KB
new582 bytes

Fixing CCF from my earlier patch. Tests only patch in #28 is unchanged.

Status: Needs review » Needs work

The last submitted patch, 30: 3328016-30.patch, failed testing. View results

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bcobin’s picture

I'm on 9.5.10 and prepping to upgrade to Drupal 10 - I see no uninstall option as shown in #12. I could drush pm-uninstall, I suppose, but I'm using a subtheme of Bootstrap5 2.0.9. So if the following from #18 holds true for 2.0.9...

You need to uninstall Bootstrap5 version 2.0.5 if you want to be able to uninstall Classy and Stable. The reason for this is that Bootstrap5 2.0.5 is set up with Classy as a base theme, and it in turn depends on Stable.

I'm afraid that I could end up completely borking the site. Any ideas? Suggestions greatly appreciated!

gisle’s picture

To prepare for Drupal 10, upgrade from Bootstrap5 version 2.0.5 to version 3.0.9. Then the uninstall link should appear.

bcobin’s picture

Thanks for the quick response!

I installed Bootstrap5 3.0.9 and it seemed to work initially - cleared caches and crashed.

Reading watchdog via Drush I got the following:

Drupal\Core\Theme\MissingThemeDependencyException:
Base theme stable9 has not been installed.
in Drupal\Core\Theme\ThemeInitialization->getActiveThemeByName() (line 115 of /[site]

Saw this post:

https://designkojo.com/base-theme-stable9-has-not-been-installed

Enabled stable9 using Drush:

drush theme-enable stable9

Site came back up and seems to be working, but I get a DB upgrade warning.

Trying to update DB results in the following:

[site]# drush updb
 ------------ ------------------------- ------------- ----------------------- 
  Module       Update ID                 Type          Description            
 ------------ ------------------------- ------------- ----------------------- 
  bootstrap5   install_stable9           post-update   Enable new theme:      
                                                       stable9.               
  bootstrap5   uninstall_stable_classy   post-update   Uninstall old themes:  
                                                       stable and classy.     
 ------------ ------------------------- ------------- ----------------------- 


 Do you wish to run the specified pending updates? (yes/no) [yes]:
 > yes

>  [warning] Post update function bootstrap5_post_update_install_stable9 not found in file bootstrap5.post_update.php
>  [error]  Update failed: bootstrap5_post_update_install_stable9 
 [error]  Update aborted by: bootstrap5_post_update_install_stable9 
 [error]  Finished performing updates. 

At least the site seems to be working - any ideas here? Jeez...

Thanks for your help!

bcobin’s picture

Update: Commenting out hidden: true in stable9.info.yml eliminates the DB error - let's see if I can make the transition to Drupal 10 and get rid of the deprecated themes there.

bwoods’s picture

Patch #30 works for me, thank you!

daveban’s picture

As has been mentioned above, if a theme depends on Classy or Stable, then the uninstall for those will not appear, by design.

To find out if you have an unexpected dependency, run the drush uninstall command:

drush theme-uninstall classy

drush theme-uninstall stable

For me, those told me I had a dependency in my main site theme that needed to be looked at, something like:

The base theme stable cannot be uninstalled, because theme site_theme depends on it.

joachim’s picture

The workaround needs to be detailed on this CR https://www.drupal.org/node/3305674 as otherwise people upgrading from 9 to 10 with Classy or Stable installed can't remove them.

urix’s picture

To find out if you have an unexpected dependency, run the drush uninstall command:

drush theme-uninstall classy

drush theme-uninstall stable

Thanks, worked for me.
It happens that SimpleBlog theme is dependent on Classy theme, which is strange - because SimpleBlog is compatible with D10.

quietone’s picture

Issue summary: View changes

I summarized the workarounds in the Issue Summary

mariohernandez’s picture

I was seeing a bunch of weirdly named themes in my site's appearance page and it was cased by this line in my settings.local.php:

$settings['extension_discovery_scan_tests'] = TRUE;

I changed it to FALSE and that fixed the issue for me.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.