Olav Grønås Gjerde

profile image
Full stack system architect with passion for Unix, Java, Python and databases.
Twitter @olavgg
2 months ago

Delayed start for service in systemd on Debian

I had an issue when I configured SR-IOV on Mellanox NIC where libvirt would start before the network was ready.

The fix for this is to enable 2 services

sudo systemctl enable systemd-networkd.service systemd-networkd-wait-online.service

Then edit the libvirt systemd file: /usr/lib/systemd/system/libvirtd.service and add:

After=systemd-networkd-wait-online.service
Wants=systemd-networkd-wait-online.service

Now libvirt will start when the network is ready and when all the virtual functions are ready.

2 months ago

KVM Debian 12 bookworm - virsh start VM with error message: failed to open /dev/vfio/62 Permission denied

So I was playing around with SR-IOV and adding a network pool with virtual functions for my virtual machines. Unfortunately I got stuck with and error message when I tried to start my virtual machine.

failed to open /dev/vfio/62 Permission denied

Then it is most likely AppArmor denying libvirt access to /dev/vfio

You can fix this by editing /etc/apparmor.d/local/abstractions/libvirt-qemu Add:

/dev/vfio/* rw,

And restart your VM for success:

4 months ago

Micronaut Test and Flyway. How to clean database for each run.

I had a case where I needed to clean the database when running tests with Micronaut. This is a simple configuration. Just add clean_schema to your application-test.yml

Example:

jpa:
  default:
    properties:
      hibernate:
        show_sql: true
        format_sql: true
datasources:
  default:
    driver-class-name: org.postgresql.Driver
    db-type: postgres
    schema-generate: NONE
    dialect: POSTGRES
    url: jdbc:postgresql://localhost:5432/my_example_test
    username: example_test
    password: example_pw
flyway:
  datasources:
    default:
      enabled: true
      clean-schema: true

View older blog posts ⇾