11

When installing:

sudo apt-get install \
    linux-image-extra-$(uname -r) \
    linux-image-extra-virtual

I am getting:

W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.

I found that someone else has had a similar issue: apt-get update mdadm scary warnings

So I followed the instructions:

/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf

Then:

update-initramfs -u

But the output is:

update-initramfs: Generating /boot/initrd.img-4.10.0-30-generic
W: mdadm: /etc/mdadm/mdadm.conf defines no arrays.

lsb_release -a

LSB Version:    core-9.20160110ubuntu5-amd64:core-9.20160110ubuntu5-noarch:security-9.20160110ubuntu5-amd64:security-9.20160110ubuntu5-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:    17.04
Codename:   zesty

vim /etc/mdadm/mdadm.conf

# mdadm.conf
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays

# This configuration was auto-generated on Thu, 10 Aug 2017 15:23:15 +0000 by mkconf

/etc/fstab

LABEL=cloudimg-rootfs   /        ext4   defaults        0 0
/var/swap.1 swap swap defaults 0 0

I think this started happening after I added:

/var/swap.1 swap swap defaults 0 0

Is there something else I need to do?

I am running a VM with the help of Vagrant.

UPDATE 1

I found another similar question to mine": https://askubuntu.com/questions/834903/i-dont-have-a-raid-but-get-the-warning-mdadm-conf-defines-no-arrays

I added:

ARRAY <ignore> devices=/dev/sda1

I added 1 at the end because I don't have /dev/sda stand alone.

Filesystem      Size  Used Avail Use% Mounted on
udev            473M     0  473M   0% /dev
tmpfs            97M  3.1M   94M   4% /run
/dev/sda1        19G  4.8G   15G  26% /
tmpfs           483M     0  483M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           483M     0  483M   0% /sys/fs/cgroup
vagrant_        384G   48G  337G  13% /vagrant
vagrant_www_    384G   48G  337G  13% /vagrant/www
tmpfs            97M     0   97M   0% /run/user/1000

I am doing this right? What does this do?

The warnings to have gone away.

jnbdz
  • 897
  • 5
  • 22
  • 43

4 Answers4

15

This warning is normal. Ignore it.

update-initramfs needs to figure out what kernel modules will be needed to boot your system. In this case, it's checking whether the RAID modules will be needed, by running mdadm to check whether your root filesystem is on a RAID array. Since you don't have any RAID arrays at all, mdadm prints a warning -- but this is OK, because update-initramfs has found what it needed to know.

1

Regarding your update, you should be using /dev/sda. /dev/sda1 refers to a disk partition, while /dev/sda refers to the physical disk itself. Try running the lsblk tool and judging by the output you posted from df -h, you should get something along the lines of:

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0   19G  0 disk
└─sda1   8:1    0   19G  0 disk /

RAID arrays can be split into separate partitions so they are treated as functionally identical to physical devices.

EmberQuill
  • 11
  • 1
0

If you're like me, you try to keep warnings-free logs. I add the following to any script where that mdadm.conf warning might lead someone else to think the script is buggy.

grep "ARRAY devices" /etc/mdadm/mdadm.conf >/dev/null || echo "ARRAY devices=/dev/sda" | sudo -A tee -a /etc/mdadm/mdadm.conf >/dev/null;

It does what you describe having done in your "UPDATE 1", but in a nice easy set it and forget it way.

The first phrase quietly checks the mdadm.conf file for any array devices.
The || causes the next phrase to be executed, if no arrays devices are defined, or quit immediately if any have been defined.

The middle phrase echoes the setting text.

The | pipes the setting text through to the tee command.

The sudo -A phrase runs tee as root, automatically if an ASK_PASS service is running, or pauses for user input otherwise.

The tee -a command appends the config text to the end of the file and to the console.

The >/dev/null lines swallow verbose output.

0

I had after an debian 9 Update this Error

/etc/mdadm/mdadm.conf defines no arrays.

First I make the Check: update-initramfs -u

Second I write this in the root shell grep "ARRAY devices" /etc/mdadm/mdadm.conf >/dev/null || echo "ARRAY devices=/dev/sda" | sudo -A tee -a /etc/mdadm/mdadm.conf >/dev/null;

Third I make the Check again update-initramfs -u

And there was no error in the shell

Then I checked the mdam.conf kate /etc/mdadm/mdadm.conf

Solution

This configuration was auto-generated on Fri, 30 Mar 2018 13:01:54 +0200 by mkconf

ARRAY devices=/dev/sda