<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ervin Barta</title>
    <description>The latest articles on DEV Community by Ervin Barta (@ervinb).</description>
    <link>https://dev.to/ervinb</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F375691%2Fb8a86f83-8537-44b1-a7f6-c0eb4078fd63.jpeg</url>
      <title>DEV Community: Ervin Barta</title>
      <link>https://dev.to/ervinb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ervinb"/>
    <language>en</language>
    <item>
      <title>From Zero to Encyrpted Secrets in 2 Minutes with SOPS and GPG</title>
      <dc:creator>Ervin Barta</dc:creator>
      <pubDate>Thu, 10 Dec 2020 20:37:43 +0000</pubDate>
      <link>https://dev.to/ervinb/from-zero-to-encyrpted-secrets-in-2-minutes-with-sops-and-gpg-2l9a</link>
      <guid>https://dev.to/ervinb/from-zero-to-encyrpted-secrets-in-2-minutes-with-sops-and-gpg-2l9a</guid>
      <description>&lt;p&gt;You probably heard about &lt;a href="https://github.com/mozilla/sops"&gt;mozilla/sops&lt;/a&gt;, but even if the readme is amazingly detailed, a from-scratch example is always nice to have.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sops&lt;/code&gt;, in a nutshell, bridges the gap between various key management services (PGP, AWS KMS, GCP KMS, Azure Key Vault) and you.&lt;br&gt;
This post will attempt to get you on your feet as fast as possible, in 3 simple steps: from "&lt;em&gt;I have no idea what to do with my hands&lt;/em&gt;" to "&lt;em&gt;No way it's that easy!&lt;/em&gt;".&lt;/p&gt;

&lt;p&gt;Install the dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;sops gnupg
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And run these 3-ish commands to convince yourself:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Clone the example repository&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;git clone https://github.com/ervinb/sops-gpg-example.git
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;sops-gpg-example

&lt;span class="c"&gt;# Import the encryption key&lt;/span&gt;
&lt;span class="c"&gt;## The path is Keybase specific and it will work on any platform - no need to use your local filesystem path&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;gpg &lt;span class="nt"&gt;--import&lt;/span&gt; &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;keybase fs &lt;span class="nb"&gt;read&lt;/span&gt; /keybase/team/sopsgpgexample/pgp/key.asc&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="c"&gt;## Or if you don't have Keybase set up yet&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;gpg &lt;span class="nt"&gt;--import&lt;/span&gt; &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;curl &lt;span class="nt"&gt;-L&lt;/span&gt; https://gist.githubusercontent.com/ervinb/288c44a45cf2614a0684bea333b3aa36/raw/sops-gpg-example.asc&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Decrypt and open the file&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;sops secrets/mysecrets.dev.enc.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your day-to-day interaction with this would be only the last line. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;gpg --import&lt;/code&gt; has to be executed only once, after which the key will be part of the local keychain (persists reboots as well).&lt;br&gt;
That's literally all there is to it, after following the below steps.&lt;/p&gt;
&lt;h2&gt;
  
  
  Do it yourself
&lt;/h2&gt;

&lt;p&gt;Start the stopwatch - we have 2 minutes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Generate a PGP key
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt; gpg &lt;span class="nt"&gt;--batch&lt;/span&gt; &lt;span class="nt"&gt;--generate-key&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="no"&gt;EOF&lt;/span&gt;&lt;span class="sh"&gt;
     %no-protection
     Key-Type: default
     Subkey-Type: default
     Name-Real: Foo Bar
     Expire-Date: 0
&lt;/span&gt;&lt;span class="no"&gt;   EOF
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The key is created without a passphrase because of the &lt;code&gt;%no-protection&lt;/code&gt; option. Otherwise a &lt;code&gt;Passphrase: &amp;lt;pass&amp;gt;&lt;/code&gt; would be required.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a sops configuration file with the key's fingeprint. This is the ✨ magic ✨ ingredient,
which makes the onboarding so frictionless.
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;gpg &lt;span class="nt"&gt;--list-keys&lt;/span&gt;
   pub   rsa2048 2020-12-06 &lt;span class="o"&gt;[&lt;/span&gt;SC]
         7E6DC556C66C43D928A95EA3715A56B718EAF0B6
   uid           &lt;span class="o"&gt;[&lt;/span&gt;ultimate] Foo Bar
   sub   rsa2048 2020-12-06 &lt;span class="o"&gt;[&lt;/span&gt;E]

   &lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;cat&lt;/span&gt; .sops.yaml
   creation_rules:
     - path_regex: secrets/.&lt;span class="k"&gt;*&lt;/span&gt;&lt;span class="se"&gt;\.&lt;/span&gt;dev&lt;span class="se"&gt;\.&lt;/span&gt;enc&lt;span class="se"&gt;\.&lt;/span&gt;yaml&lt;span class="err"&gt;$&lt;/span&gt;
       pgp: 7E6DC556C66C43D928A95EA3715A56B718EAF0B6
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This is also perfect if you want more control over the secrets, like using different keys for different environments.&lt;br&gt;
   For example &lt;code&gt;secrets/*.dev.enc.yaml&lt;/code&gt; could use one key, and &lt;code&gt;secrets/*.prod.enc.yaml&lt;/code&gt; another one. More details on this &lt;a href="https://github.com/mozilla/sops#using-sops-yaml-conf-to-select-kms-pgp-for-new-files"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;sops&lt;/code&gt; to edit and create new secrets
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;sops secrets/mysecrets.dev.enc.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Then it just a question of distributing the keys to the right people and/or environment.&lt;/p&gt;

&lt;p&gt;Which brings us to Keybase.&lt;/p&gt;
&lt;h4&gt;
  
  
  Note for Linux users
&lt;/h4&gt;

&lt;p&gt;I've found that both on Fedora and Ubuntu, for whatever reason, creating a new file with &lt;code&gt;sops&lt;/code&gt; throws the following cryptic error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;sops secrets/new.dev.enc.yaml
&amp;lt;save the file &lt;span class="k"&gt;in &lt;/span&gt;the editor&amp;gt;
File has not changed, exiting.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The solution is to create the file first and encrypt it in-place afterwards:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;vi secrets/new.dev.enc.yaml
&lt;span class="nv"&gt;$ &lt;/span&gt;sops &lt;span class="nt"&gt;-i&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; secrets/new.dev.enc.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Distributing the key to firends and family
&lt;/h2&gt;

&lt;p&gt;To extract the PGP key from your local keychain, use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;gpg &lt;span class="nt"&gt;--list-keys&lt;/span&gt;
&lt;span class="nt"&gt;-------------------------------&lt;/span&gt;
pub   rsa2048 2020-12-06 &lt;span class="o"&gt;[&lt;/span&gt;SC]
      7E6DC556C66C43D928A95EA3715A56B718EAF0B6
uid           &lt;span class="o"&gt;[&lt;/span&gt;ultimate] Foo Bar
sub   rsa2048 2020-12-06 &lt;span class="o"&gt;[&lt;/span&gt;E]

&lt;span class="nv"&gt;$ &lt;/span&gt;gpg &lt;span class="nt"&gt;--armor&lt;/span&gt; &lt;span class="nt"&gt;--export-secret-keys&lt;/span&gt; 7E6DC556C66C43D928A95EA3715A56B718EAF0B6 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; key.asc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--armor&lt;/code&gt; makes it so that the output is ASCII (&lt;code&gt;.asc&lt;/code&gt;) formatted, and not in binary (default).&lt;/p&gt;

&lt;p&gt;One of the most seamless ways to distribute keys and other sensitive files is Keybase. It has a low barrier of entry, and you can control the granularity of access with "teams".&lt;br&gt;
It also integrates nicely with the filesystem.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Keybase
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;   &lt;span class="nv"&gt;$ &lt;/span&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;keybase
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;Create an account&lt;/li&gt;
&lt;li&gt;Store the secret key under a team's folder&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After that, you grab the universal path and import the key to anywhere with &lt;code&gt;gpg&lt;/code&gt; installed.&lt;/p&gt;
&lt;h2&gt;
  
  
  Use it in your applications
&lt;/h2&gt;

&lt;p&gt;To use the decrypted values in your application, you can just add a line to your setup scripts to run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sops &lt;span class="nt"&gt;-d&lt;/span&gt; secrets/mysecret.dev.enc.yaml &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; configuration.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(make sure to add the decrypted files to &lt;code&gt;.gitignore&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;For Terraform projects use &lt;a href="https://github.com/carlpett/terraform-provider-sops"&gt;terraform-sops&lt;/a&gt;, and if you're into Terragrunt,&lt;br&gt;
it has a built-in &lt;a href="https://terragrunt.gruntwork.io/docs/reference/built-in-functions/#sops_decrypt_file"&gt;sops_decrypt_file&lt;/a&gt; function.&lt;/p&gt;

&lt;p&gt;You will be running &lt;code&gt;sops&lt;/code&gt; only to create or edit secrets, otherwise, it will be invisible (and incredible).&lt;/p&gt;

</description>
      <category>devops</category>
      <category>security</category>
    </item>
    <item>
      <title>Casually removing root files</title>
      <dc:creator>Ervin Barta</dc:creator>
      <pubDate>Tue, 28 Apr 2020 20:36:37 +0000</pubDate>
      <link>https://dev.to/ervinb/casually-removing-root-files-3eh9</link>
      <guid>https://dev.to/ervinb/casually-removing-root-files-3eh9</guid>
      <description>&lt;p&gt;You're walking at &lt;code&gt;$HOME&lt;/code&gt;, minding your own business.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;whoami&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; user

&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /home/user
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But something is bothering your feet. It's like if a little rock has fallen into your shoe. You take it off, to see what's going on.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lah&lt;/span&gt; ./left-shoe
&lt;span class="nt"&gt;----------&lt;/span&gt; 1 root root 4 May 30 13:20 little-rock
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;That's odd. It's there, but it doesn't seem to be yours. It's left there by &lt;code&gt;root&lt;/code&gt;, the Rock Tamer, and only he can decide its fate.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# bash -c "echo 'You stay here' &amp;gt; /home/user/left-shoe/little-rock"&lt;/span&gt;
&lt;span class="c"&gt;# chmod 0000 /home/user/left-shoe/little-rock&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You reach into your pocket for your phone, to speed dial him with &lt;code&gt;sudo&lt;/code&gt;. Suddenly, you feel powerful (from watching Gladiator last night), and decide to put back the phone, and try your luck.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-f&lt;/span&gt; ./left-shoe/little-rock
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;ls&lt;/span&gt; &lt;span class="nt"&gt;-lah&lt;/span&gt; ./left-shoe/little-rock
&lt;span class="nb"&gt;ls&lt;/span&gt;: cannot access little-rock: No such file or directory
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You look down at your shaking hands, trying to figure out if this is the real world. It is. You did it. Without the Rock Tamer. But how?&lt;/p&gt;

&lt;p&gt;The little rock in your shoe had absolutely no idea what's coming. As seen from it's incarnation, nobody had &lt;a href="http://linuxcommand.org%20lc3_lts0090.php"&gt;any permissions&lt;/a&gt; on it (&lt;code&gt;--- --- ---&lt;/code&gt;). No reads, no writes, no throwing by anyone (owner, group, others).&lt;/p&gt;

&lt;h2&gt;
  
  
  The catch
&lt;/h2&gt;

&lt;p&gt;What happened is, the Rock Tamer forgot that you are even more powerful&lt;br&gt;
than him, when you're at &lt;code&gt;$HOME&lt;/code&gt;. Let's see why.&lt;/p&gt;

&lt;p&gt;To be able to do anything with a file, the first step is to look it up in its&lt;br&gt;
directory. Listing a directory's contents is controlled by the execute flag. If&lt;br&gt;
a user has execute permissions on a directory, he can see what's inside it. Also,&lt;br&gt;
the execute flag on the directory gives access to its files' &lt;code&gt;inode&lt;/code&gt;s, which is&lt;br&gt;
crucial in this context, as the removal process &lt;a href="https://linux.die.net/man/2/unlinkat"&gt;unlinks&lt;/a&gt; the file.&lt;/p&gt;

&lt;p&gt;Next, the removing part. Renaming or removing a file doesn't involve the &lt;code&gt;write()&lt;/code&gt; system call. Practically, we don't need any permissions to remove the file, nor do we care about its owner. The only requirement is to have write permissions on the parent directory (and the execute flag on the parent directory).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;$HOME&lt;/code&gt; directory naturally fulfills both of these requirements from the user's perspective.&lt;/p&gt;
&lt;h2&gt;
  
  
  The contra-catch
&lt;/h2&gt;

&lt;p&gt;If the Rock Tamer, really didn't want anyone to mess around with his rocks, he would've done:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# chattr +i /home/user/left-shoe/little-rock&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This operation makes the file immutable, which among other things, prevents its removal. Excerpt from the &lt;a href="https://linux.die.net/man/1/chattr"&gt;man page&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;A file with the &lt;span class="s1"&gt;'i'&lt;/span&gt; attribute cannot be modified: it cannot be deleted or renamed, no &lt;span class="nb"&gt;link &lt;/span&gt;can be created to this file and no data can be written to the file. Only the superuser or a process possessing the CAP_LINUX_IMMUTABLE capability can &lt;span class="nb"&gt;set &lt;/span&gt;or clear this attribute.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Moonwalks away.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>linux</category>
    </item>
    <item>
      <title>Fixing Fedora black screen on boot (AMDGPU)</title>
      <dc:creator>Ervin Barta</dc:creator>
      <pubDate>Tue, 28 Apr 2020 20:28:09 +0000</pubDate>
      <link>https://dev.to/ervinb/fixing-fedora-black-screen-on-boot-amdgpu-2pim</link>
      <guid>https://dev.to/ervinb/fixing-fedora-black-screen-on-boot-amdgpu-2pim</guid>
      <description>&lt;p&gt;Having your OS hang on you with a black screen, is not the best start of a day.&lt;br&gt;
The main suspects are usually a failing mount in &lt;code&gt;/etc/fstab&lt;/code&gt;, the GPU driver, a kernel upgrade or all three.&lt;br&gt;
In my case, the kernel was upgraded and it wasn't booting. Starting the previous one did work however.&lt;/p&gt;

&lt;p&gt;To quickly weed out the GPU, you can try booting with &lt;code&gt;nomodeset&lt;/code&gt;. While on the GRUB screen, press 'e' (for edit) and add &lt;code&gt;nomodeset&lt;/code&gt; to the boot options.&lt;br&gt;
This disables KMS (&lt;a href="https://fedoraproject.org/wiki/Features/KernelModesetting#Summary"&gt;Kernel mode setting&lt;/a&gt;), which moved the loading of the GPU driver from user space to kernel space. This is why it's stuck at boot when the driver doesn't load properly.&lt;/p&gt;

&lt;p&gt;Having &lt;code&gt;nomodeset&lt;/code&gt; in the boot options will prevent the &lt;code&gt;amdgpu&lt;/code&gt; kernel module from being loaded and hopefully you can boot into the OS to find the root cause.&lt;/p&gt;

&lt;p&gt;By being in the OS now (rescue mode works too), we can investigate what went wrong, by looking into the &lt;em&gt;previous&lt;/em&gt; boot log.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;journalctl &lt;span class="nt"&gt;--system&lt;/span&gt; &lt;span class="nt"&gt;--list-boot&lt;/span&gt;
...
&lt;span class="nt"&gt;-12&lt;/span&gt; db5d180a75ea46b98bd5abfd6ddf2de3
&lt;span class="nt"&gt;-11&lt;/span&gt; 36ba4e53a6864702bdc72b243fb64a80
&lt;span class="nt"&gt;-10&lt;/span&gt; 964a1285dd5545b699bae81282077fa3 &lt;span class="c"&gt;# &amp;lt;&amp;lt; offending boot!&lt;/span&gt;
&lt;span class="nt"&gt;-9&lt;/span&gt; 932f400f4d1c4078b8c972cb841a1c57
&lt;span class="nt"&gt;-8&lt;/span&gt; 8d0abb5acb284d7d90b7ff5814c63389
&lt;span class="nt"&gt;-7&lt;/span&gt; 444fe6eb8ebe43e98373523414a9be05
...

&lt;span class="c"&gt;# show the previous boot by providing its ID&lt;/span&gt;
&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;journalctl &lt;span class="nt"&gt;--boot&lt;/span&gt; 964a1285dd5545b699bae81282077fa3
...
kernel: amdgpu 0000:03:00: Direct firmware load &lt;span class="k"&gt;for &lt;/span&gt;amdgpu/navi10_gpu_info.bin failed with error &lt;span class="nt"&gt;-2&lt;/span&gt;
kernel: amdgpu 0000:03:00: Failed to load gpu_info firmware &lt;span class="s2"&gt;"amdgpu/navi10_gpu_info.bin"&lt;/span&gt;
kernel: amdgpu 0000:03:00: Fatal error during GPU init
kernel: &lt;span class="o"&gt;[&lt;/span&gt;drm] amdgpu: finishing device.
kernel: &lt;span class="nt"&gt;------------&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="nb"&gt;cut &lt;/span&gt;here  &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="nt"&gt;------------&lt;/span&gt;
kernel: sysfs group &lt;span class="s1"&gt;'fw_version'&lt;/span&gt; not found &lt;span class="k"&gt;for &lt;/span&gt;kobject &lt;span class="s1"&gt;'0000:03:00.0'&lt;/span&gt;
kernel: WARNING: CPU: 1 PID: 422 at fs/sysfs/group.c:278 sysfs_remove_group+0x74/0x80
kernel: Modules linked &lt;span class="k"&gt;in&lt;/span&gt;: amdgpu&lt;span class="o"&gt;(&lt;/span&gt;+&lt;span class="o"&gt;)&lt;/span&gt; amd_iommu_v2 gpu_sched i2c_algo_bit ttm crc32c_intel drm_kms_helper e1000e&lt;span class="o"&gt;(&lt;/span&gt;+&lt;span class="o"&gt;)&lt;/span&gt; n&amp;gt;
kernel: CPU: 1 PID: 422 Comm: systemd-udevd Not tainted 5.5.10-100.fc30.x86_64 &lt;span class="c"&gt;#1&lt;/span&gt;
kernel: Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./Z270 Extreme4, BIOS P1.20 11/03/2016
kernel: RIP: 0010:sysfs_remove_group+0x74/0x80
kernel: Code: ff 5b 48 89 ef 5d 41 5c e9 39 be ff ff 48 89 ef e8 c1 b9 ff ff eb cc 49 8b 14 24 48 8b 33 48 c7 c7 e8 &lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
kernel: RSP: 0018:ffffb941003d7a20 EFLAGS: 00010282
kernel: RAX: 0000000000000000 RBX: ffffffffc0884a00 RCX: 0000000000000007
kernel: RDX: 0000000000000007 RSI: 0000000000000092 RDI: ffff91f15ec99cc0
kernel: RBP: 0000000000000000 R08: 00000000000003c9 R09: 0000000000000003
kernel: R10: 0000000000000000 R11: 0000000000000001 R12: ffff91f1599020b0
kernel: R13: ffff91f150b34d98 R14: ffff91f159da5bc0 R15: 0000000000000000
kernel: FS:  00007f63a53f9940&lt;span class="o"&gt;(&lt;/span&gt;0000&lt;span class="o"&gt;)&lt;/span&gt; GS:ffff91f15ec80000&lt;span class="o"&gt;(&lt;/span&gt;0000&lt;span class="o"&gt;)&lt;/span&gt; knlGS:0000000000000000
kernel: CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
kernel: CR2: 000055c153964000 CR3: 0000000452912004 CR4: 00000000003606e0
kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
kernel: DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
kernel: Call Trace:
kernel:  amdgpu_device_fini+0x43d/0x471 &lt;span class="o"&gt;[&lt;/span&gt;amdgpu]
kernel:  amdgpu_driver_unload_kms+0x4a/0x90 &lt;span class="o"&gt;[&lt;/span&gt;amdgpu]
kernel:  amdgpu_driver_load_kms.cold+0x39/0x5b &lt;span class="o"&gt;[&lt;/span&gt;amdgpu]
...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Zooming in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Direct firmware load for amdgpu/navi10_gpu_info.bin failed with error -2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;a href="https://wiki.archlinux.org/index.php/AMDGPU#Loading"&gt;AMDGPU&lt;/a&gt; is not loading after the kernel upgrade.&lt;/p&gt;

&lt;p&gt;Naturally, the first step is to see if the &lt;code&gt;amdgpu/navi10_gpu_info.bin&lt;/code&gt; file is there. In my case it was there, but if it's missing for you, &lt;a href="https://askubuntu.com/a/1124256"&gt;download it&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;As you probably already now by all the purple links in your Google search results, this error can be caused by almost anything. However, before dwelling into re-installing the driver and whatnot, give this simple solution a go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Solution
&lt;/h2&gt;

&lt;p&gt;After digging around a lot and searching for everything with &lt;code&gt;amd&lt;/code&gt; in its name,&lt;br&gt;
I've found that there are some &lt;code&gt;amdgpu-pro&lt;/code&gt; related files in the &lt;code&gt;/etc/dracut.conf.d/&lt;/code&gt; directory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://fedoraproject.org/wiki/Dracut"&gt;Dracut&lt;/a&gt; is generating the initial ramdisk which boots the system (more on this), so it looked fishy. One of the files had the previous kernel version in its name. The natural instinct in this case is remove it into oblivion.&lt;/p&gt;

&lt;p&gt;After restarting, sure enough, the new kernel was able to boot and the &lt;code&gt;amdgpu&lt;/code&gt; firmware loaded properly. At one point I did install the &lt;code&gt;amdgpu-pro&lt;/code&gt; driver, but removed it soon after. &lt;code&gt;amdgpu-uninstall&lt;/code&gt; didn't do a proper job in cleaning up after itself.&lt;/p&gt;

&lt;p&gt;After the next kernel update, this happened again. The &lt;code&gt;amdgpu-pro&lt;/code&gt; driver was long removed but there were some remnants still.&lt;/p&gt;

&lt;p&gt;Putting together &lt;code&gt;kernel upgrade&lt;/code&gt; + &lt;code&gt;new device related file appearing&lt;/code&gt; results in &lt;a href="https://wiki.archlinux.org/index.php/Dynamic_Kernel_Module_Support"&gt;DKMS&lt;/a&gt;. DKMS rebuilds third-party kernel modules with each new version:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Dynamic Kernel Module Support (DKMS) is a program/framework that enables generating Linux kernel modules whose sources generally reside outside the kernel source tree. The concept is to have DKMS modules automatically rebuilt when a new kernel is installed.&lt;/p&gt;

&lt;p&gt;This means that a user does not have to wait for a company, project, or package maintainer to release a new version of the module.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Checking DKMS status confirms this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ dkms status
amdgpu-pro, 16.50-362463.el7: added
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Searching the installed packages revealed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ dnf list installed | grep amd
amdgpu-pro-dkms.noarch                             16.50-362463.el7                     @amdgpu-pro-local

$ sudo dnf remove amdgpu-pro-dkms.noarch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Uninstalling the &lt;code&gt;amdgpu-pro-dkms.noarch&lt;/code&gt; package will not remove the generated files, it has to be don manually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo rm -rf /etc/dracut.conf.d/amdgpu*
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Lastly, the current initramfs is regenerated to exclude the old module.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ sudo dracut --force
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;From this point on, every new kernel worked out of the box.&lt;/p&gt;

</description>
      <category>fedora</category>
      <category>linux</category>
      <category>troubleshooting</category>
    </item>
  </channel>
</rss>
