Jump to content

Fixed: Black Screen after switching kernel


Dantes

Recommended Posts

 

Hiya peoples,

 

Finally figured out what caused my black screen after updating :D

 

After installing a new kernel (via apt)  the '/boot/dtb' symlink is not updated, and fails to boot properly.

lrwxrwxrwx 1 root root       31 Oct  7 11:38 dtb -> dtb-6.11.2-edge-rockchip-rk3588
lrwxrwxrwx 1 root root       38 Oct  7 08:49 Image -> vmlinuz-6.11.2-current-rockchip-rk3588
lrwxrwxrwx 1 root root       38 Oct  7 08:49 uInitrd -> uInitrd-6.11.2-current-rockchip-rk3588

 

So I wrote a systemd service that:

1. Runs before shutdown/reboot

2. Changes into the /boot directory

3. Reads the version from the dtb symlink

4. Reads the version from the Image symlink

5. Compares the versions

6. And if they do NOT match, creates a new dtb symlink that matches the Image symlink version.

 

[Unit]
Description=match dtb symlink with kernel version
DefaultDependencies=no
Before=shutdown.target

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'set -x;cd /boot;dtb=$(readlink dtb|sed 's,^dtb-,,');vmlinuz=$(readlink Image|sed 's,vmlinuz-,,');[ "$dtb" = "$vmlinuz" ] || ln -sf dtb-$vmlinuz dtb'
TimeoutStartSec=0

[Install]
WantedBy=shutdown.target


To use this:

1. sudo nano /etc/systemd/system/dtb-match-kernel.service and paste in the text above.

2. sudo systemd enable dtb-match-kernel.service

 

You can check the journal if it works with:

3. journalctl -u dtb-match-kernel.service

 

or the /boot directory

lrwxrwxrwx 1 root root       31 Oct  7 11:39 dtb -> dtb-6.11.2-current-rockchip-rk3588
lrwxrwxrwx 1 root root       38 Oct  7 08:49 Image -> vmlinuz-6.11.2-current-rockchip-rk3588
lrwxrwxrwx 1 root root       38 Oct  7 08:49 uInitrd -> uInitrd-6.11.2-current-rockchip-rk3588

 

Dantes

Edited by Dantes
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines