diff --git a/libraries.drush.inc b/libraries.drush.inc
index 22b7d62da06a06d4e827d689126d42c61a5e25f1..3d9f7cd429584aee94f5843f5311fa9408ca87c7 100644
--- a/libraries.drush.inc
+++ b/libraries.drush.inc
@@ -62,8 +62,8 @@ function libraries_drush_invalidate_cache() {
  */
 function libraries_drush_list() {
   $libraries = array();
-  foreach (libraries_info() as $name => $info) {
-    $libraries[$name] = libraries_detect($name);
+  foreach (\Drupal::service('libraries.manager')->info() as $name => $info) {
+    $libraries[$name] = \Drupal::service('libraries.manager')->getLibrary($name);
   }
   ksort($libraries);
 
diff --git a/libraries.info.yml b/libraries.info.yml
index 1891a6ffb98379f684acce0c956333e14570a58e..63b084395d42e04368ff1ae05ef975232c95745f 100644
--- a/libraries.info.yml
+++ b/libraries.info.yml
@@ -2,3 +2,4 @@ name: Libraries
 type: module
 description: Allows version-dependent and shared usage of external libraries.
 core: 8.x
+core_version_requirement: ^8 || ^9
diff --git a/libraries.install b/libraries.install
index a2edea4928282ff1d92f9450917fe12d6f584911..666f84ecea70285d621e3e36dd7d245ab7d3b5db 100644
--- a/libraries.install
+++ b/libraries.install
@@ -23,6 +23,6 @@ function libraries_install() {
  */
 function libraries_uninstall() {
   if (is_dir('public://library-definitions')) {
-    file_unmanaged_delete_recursive('public://library-definitions');
+    \Drupal::service('file_system')->deleteRecursive('public://library-definitions');
   }
 }
diff --git a/libraries.module b/libraries.module
index 3006c345ceb1716bce03c98045f108430fb6a39f..e7fe5be54402e0115de738c7e2b9fb137b37fc74 100644
--- a/libraries.module
+++ b/libraries.module
@@ -11,6 +11,7 @@ use Drupal\libraries\ExternalLibrary\Asset\AttachableAssetLibraryRegistrationInt
 use Drupal\libraries\ExternalLibrary\Utility\LibraryAccessorInterface;
 use Drupal\libraries\ExternalLibrary\Utility\LibraryIdAccessorInterface;
 use Symfony\Component\Yaml\Parser;
+use Drupal\Core\Extension\Dependency;
 
 /**
  * Implements hook_library_info_build().
@@ -115,7 +116,7 @@ function libraries_get_libraries() {
   // Similar to 'modules' and 'themes' directories inside an installation
   // profile, installation profiles may want to place libraries into a
   // 'libraries' directory.
-  if ($profile = drupal_get_profile()) {
+  if ($profile = \Drupal::installProfile()) {
     $profile_path = drupal_get_path('profile', $profile);
     $searchdir[] = "$profile_path/libraries";
   };
@@ -167,7 +168,7 @@ function libraries_get_libraries() {
  * https://www.drupal.org/node/2170763
  */
 function libraries_scan_info_files() {
-  $profile = drupal_get_path('profile', drupal_get_profile());
+  $profile = \Drupal\Core\Extension\ExtensionList::getPath('profile', \Drupal::installProfile());
   $config = DrupalKernel::findSitePath(\Drupal::request());
 
   // Build a list of directories.
@@ -345,9 +346,9 @@ function libraries_prepare_files(&$library, $version = NULL, $variant = NULL) {
 function libraries_detect_dependencies(&$library, $version = NULL, $variant = NULL) {
   if (isset($library['dependencies'])) {
     foreach ($library['dependencies'] as &$dependency_string) {
-      $dependency_info = ModuleHandler::parseDependency($dependency_string);
-      $dependency = libraries_detect($dependency_info['name']);
-      if (!$dependency['installed']) {
+      $dependency = Dependency::createFromString($dependency_string);
+      $info = libraries_detect($dependency->getName());
+      if (!$info['installed']) {
         $library['installed'] = FALSE;
         $library['error'] = 'missing dependency';
         $library['error message'] = t('The %dependency library, which the %library library depends on, is not installed.', array(
@@ -355,12 +356,12 @@ function libraries_detect_dependencies(&$library, $version = NULL, $variant = NU
           '%library' => $library['name'],
         ));
       }
-      elseif (drupal_check_incompatibility($dependency_info, $dependency['version'])) {
+      elseif (!$dependency->isCompatible($info['version'])) {
         $library['installed'] = FALSE;
         $library['error'] = 'incompatible dependency';
         $library['error message'] = t('The version %dependency_version of the %dependency library is not compatible with the %library library.', array(
-          '%dependency_version' => $dependency['version'],
-          '%dependency' => $dependency['name'],
+          '%dependency_version' => $info['version'],
+          '%dependency' => $info['name'],
           '%library' => $library['name'],
         ));
       }
diff --git a/src/ExternalLibrary/LibraryManager.php b/src/ExternalLibrary/LibraryManager.php
index 17a62236e292b2ddf0b2a71e3914bf97c080bb9e..6b92d9dc9c1d01ab62f6784214c99102515db4b9 100644
--- a/src/ExternalLibrary/LibraryManager.php
+++ b/src/ExternalLibrary/LibraryManager.php
@@ -61,7 +61,9 @@ class LibraryManager implements LibraryManagerInterface {
   public function getRequiredLibraryIds() {
     $library_ids = [];
     foreach (['module', 'theme'] as $type) {
-      foreach (system_get_info($type) as $info) {
+      $service_id = 'extension.list.' . $type;
+      $extension_list = \Drupal::service($service_id);
+      foreach ($extension_list->getAllInstalledInfo() as $info) {
         if (isset($info['library_dependencies'])) {
           $library_ids = array_merge($library_ids, $info['library_dependencies']);
         }
diff --git a/tests/modules/libraries_test/libraries_test.module b/tests/modules/libraries_test/libraries_test.module
index 1a30ebc1c3c78ffab668b0b0a848bb370a2307cd..af1a4ac39a4c01a76cd561e1362c11d76af49e02 100644
--- a/tests/modules/libraries_test/libraries_test.module
+++ b/tests/modules/libraries_test/libraries_test.module
@@ -6,6 +6,7 @@
  */
 
 use Drupal\Component\Utility\SafeMarkup;
+use Drupal\Core\Messenger\MessengerTrait;
 
 /**
  * Implements hook_libraries_info().
@@ -461,7 +462,7 @@ function _libraries_test_callback(&$library, $version, $variant, $group) {
   // Only set the message for the top-level library to prevent confusing,
   // duplicate messages.
   if (!isset($version) && !isset($variant) && \Drupal::state()->get('libraries_test.cache', FALSE)) {
-    drupal_set_message(SafeMarkup::set("The <em>$group</em> callback group was invoked."));
+    \Drupal::messenger()->addMessage(SafeMarkup::set("The <em>$group</em> callback group was invoked."));
   }
 }
 
diff --git a/tests/modules/libraries_test/src/Controller/ExampleController.php b/tests/modules/libraries_test/src/Controller/ExampleController.php
index 217ebf2f8ab4028aff545bd7560818355f602957..522967c50bd11e170e77043a471b3d8f56833516 100644
--- a/tests/modules/libraries_test/src/Controller/ExampleController.php
+++ b/tests/modules/libraries_test/src/Controller/ExampleController.php
@@ -23,7 +23,7 @@ class ExampleController implements ContainerInjectionInterface {
    * more information.
    */
   private function buildPage($library, $variant = NULL) {
-    libraries_load($library, $variant);
+    \Drupal::service('libraries.manager')->load($library, $variant);
     // JavaScript and CSS files can be checked directly by SimpleTest, so we only
     // need to manually check for PHP files.
     $output = '';