Categories
Debian Sysadmin Tech

Software RAID1 On Running Debian Stretch LVM + GRUB2

I needed to setup a software RAID1 on a Debian Stretch server where I had no KVM access, so I had to make do with just SSH and rescue access.

I was following this tutorial for How To Set Up Software RAID1 On A Running LVM System (Incl. GRUB2 Configuration) (Debian Squeeze) but ran into some problems. Not sure if it was the version of Debian being different or something else from the hosting pre-installed Debian.

saving /etc/mtab edit

When attempting to save the edit to /etc/mtab I was getting the error:

error writing /etc/mtab invalid argument

So, I ended up using sed:

sed -e "s/dev\/sda1/dev\/md0/" -i /etc/mtab

Doing a cat /etc/mtab showed the correct change but I doubt this made much of a difference and could probably have skipped this step. Not sure but it didn’t hurt.

creating /etc/grub.d/09_swraid1_setup

I added a few lines from /boot/grub/grub.cfg menuentry stanzas in the ### BEGIN /etc/grub.d/10_linux ### that looked to me were missing from the provided menuentry example.

Again, not sure if it made a difference but it worked.

pvmove Insufficient free space

When attempting to do the step:

pvmove -i 2 /dev/sda5 /dev/md1

I was getting the error:

Insufficient free space: X extents needed, but only Y available

As I ended up partially breaking the filesystem a couple of time, trying to solve this, I ended up just requesting a clean install and restarting the tutorial after the step:

sfdisk -d /dev/sda | sfdisk --force /dev/sdb

Booting into live rescue and following How to Shrink an LVM Volume Safely.

The idea on my case was to make ‘/dev/YOUR-VOLUME-GROUP/root’ 1GB smaller.

As my drive had Tb, I had to use the following to determine the GB:

pvs --units g

After that I rebooted back into the system and continued the tutorial and the pvmove problem was gone.

Other issues from live rescue on this particular hosting service:

The version of e2fsprogs and resize2fs was old and I was getting the error “has unsupported feature(s): metadata_csum” or “Filesystem has unsupported read-only feature(s) while trying to open”

I had to upgrade to ‘e2fsprogs-1.43.1’

When attempting to do:

wget http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.43.1/e2fsprogs-1.43.1.tar.gz

The server in live rescue wasn’t able to resolve DNS, so I had to use curl to hack something:

curl -o e2fsprogs-1.43.1.tar.gz http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.43.1/e2fsprogs-1.43.1.tar.gz

This showed me one of the download server domains from SourceForge and I pinged that domain to get the IP and used –resolve to be able to reach it, like this:

curl -o e2fsprogs-1.43.1.tar.gz http://cfhcable.dl.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.43.1/e2fsprogs-1.43.1.tar.gz --resolve cfhcable.dl.sourceforge.net:80:146.71.73.6 --resolve cfhcable.dl.sourceforge.net:443:146.71.73.6

After that I was able to install it:

tar xzf e2fsprogs-1.43.1.tar.gz
cd e2fsprogs-1.43.1
./configure
make
make install

And had to use ./e2fsprogs/e2fsprogs and ./resize/resize2fs as my commands.

Issues that I ignored

  • the ‘mount’ command was still displaying /dev/sda1 before the reboot
  • ‘update-grub’ was returning a few ‘grub-install: warning: Couldn’t find physical volume `(null)’.’ errors
  • the final ‘update-initramfs -u’ required me to do ‘update-initramfs -t -u’

Categories
Debian Sysadmin Tech

Debian install MailUtils needs configuration of Exim

When you first install MailUtils on Debian

apt-get install mailutils

The system will not send emails.

To test it:

echo "This is the body of the email" | mail -s "This is the subject line" myemail@gmail.com

and have a look at the logs:

cat /var/mail/mail

To fix this, it is needed to configure Exim:

dpkg-reconfigure exim4-config

You will be presented with a setup wizard of something like this:

The settings are pretty straight forward but you can just leave them with Internet Site and type your domain. The rest should work with the default settings.