How To: Change Graphics Mode for GRUB Bootloader

unix-tutorial-blue

One of the remaining things to fix on my new Dell XPS 13 laptop has been the graphics mode in GRUB bootloader that got activated with my Ubuntu 19.04 install. Somehow GRUB is smart enough to recognise 4K resolution on the laptop, so the GRUB boot menu looks so tiny that I can’t read any text (there’s no scaling applied to fonts). I finally decided to fix this.

Graphics modes in GRUB bootloader

GRUB is a simple enough software solution that traditionally used text console for presenting boot menu. In the last few years it introduced graphics mode: you still see a text menu with boot options, but they’re rendered in a graphics mode rather than shown in text mode.

Turns out, there’s a special option in /boot/grub/grub.cfg file that allows you to select a graphics resolution:

set gfxmode=1024x768

Change graphics mode for GRUB

To update this value properly, I suggest you edit the GRUB_GFXMODE in /etc/default/grub file:

GRUB_GFXMODE=1024x768

IMPORTANT: 1920×1080 mode is NOT supported, so don’t specify it. 1024×768 is a safe resolution that should be available on most hardware systems. I’ll write another post soon expanding on GRUB bootloader graphics resolutions topic.

Once this is done, re-build all the grub configuration files:

$ sudo grub-update

To verify that our resolution of 1024×768 made it into the config, grep for it:

greys@xps:~ $ grep 1024 /boot/grub/grub.cfg 
set gfxmode=1024x768

That’s it, you can reboot your PC or laptop now to enjoy a different resolution.

See Also




Controlling Dell Laptop Keyboard Backlight from Command Line

dell-xps-keyboard-backlight-devices.png

I didn’t take me long to start wondering if there was a way to control keyboard backlight on my Dell XPS 3890 laptop, and of course there is a simple enough solution.

Check Current Keyboard Backlight Level

IMPORTANT: This is Dell laptops (if not Dell XPS model) specific.

Go to the /sys/devices/platform/dell-laptop/leds/dell::kbd_backlight directory and cat the file called brightess:

root@xps:/sys/devices/platform/dell-laptop/leds/dell::kbd_backlight # cat brightness
1

You can confirm the max value for brightness in a similar way:

root@xps:/sys/devices/platform/dell-laptop/leds/dell::kbd_backlight # cat max_brightness
2

Set Keyboard Backlight Brightness

If you just echo the numeric value you want, it will immediately apply it to your laptop’s keyboard.

IMPORANT: you  need to do it as root user.

Turning backlight off:

root@xps:/sys/devices/platform/dell-laptop/leds/dell::kbd_backlight # echo 0 > brightness

Setting it to max brightness:

root@xps:/sys/devices/platform/dell-laptop/leds/dell::kbd_backlight # echo 2 > brightness

I’m really excited! Must make this into a cronjob,

See Also

  1. Ubuntu 19.04
  2. Check For Available Updates with apt
  3. Use htop for monitoring CPU and memory

 




Check For Available Updates with apt

apt-list-upgradable-ubuntu-19-04

I’ve been updating software on Ubuntu 19.04 install on my Dell XPS laptop and realised that I haven’t shared this basic tip yet: it’s possible to use apt to quickly see available upgrades for installed packages.

List upgradable packages with apt

apt list command will show you all the packages installed in your Ubuntu, but if you specify the –upgradable flag it will just report the packages that have available updates:

root@xps:/ # apt list --upgradable 
Listing... Done 
bind9-host/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
brave-browser/disco 0.64.76 amd64 [upgradable from: 0.64.75] 
debconf-i18n/disco-updates,disco-updates 1.5.71ubuntu1 all [upgradable from: 1.5.71] 
debconf/disco-updates,disco-updates 1.5.71ubuntu1 all [upgradable from: 1.5.71] 
dnsutils/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
fonts-opensymbol/disco-updates,disco-updates 2:102.10+LibO6.2.3-0ubuntu0.19.04.1 all [upgradable from: 2:102.10+LibO6.2.2-0u
buntu2] 
gnome-control-center-data/disco-updates,disco-updates 1:3.32.1-1ubuntu4.1 all [upgradable from: 1:3.32.1-1ubuntu4] 
gnome-control-center-faces/disco-updates,disco-updates 1:3.32.1-1ubuntu4.1 all [upgradable from: 1:3.32.1-1ubuntu4] 
gnome-control-center/disco-updates 1:3.32.1-1ubuntu4.1 amd64 [upgradable from: 1:3.32.1-1ubuntu4] 
gnome-shell-extension-appindicator/disco-updates,disco-updates 29-1~ubuntu19.04.1 all [upgradable from: 28-1] 
libbind9-161/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libdns-export1104/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libdns1104/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libirs161/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libisc-export1100/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libisc1100/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libisccc161/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libisccfg163/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
liblwres161/disco-updates 1:9.11.5.P1+dfsg-1ubuntu2.4 amd64 [upgradable from: 1:9.11.5.P1+dfsg-1ubuntu2.3] 
libreoffice-avmedia-backend-gstreamer/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2] 
libreoffice-base-core/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2] 
libreoffice-calc/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2] 
libreoffice-common/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2] 
libreoffice-core/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2] 
libreoffice-draw/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-gnome/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-gtk3/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-help-en-gb/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-help-en-us/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-impress/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-l10n-en-gb/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-math/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-ogltrans/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-pdfimport/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-style-breeze/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-style-colibre/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-style-elementary/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-style-tango/disco-updates,disco-updates 1:6.2.3-0ubuntu0.19.04.1 all [upgradable from: 1:6.2.2-0ubuntu2]
libreoffice-writer/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2]
python3-debconf/disco-updates,disco-updates 1.5.71ubuntu1 all [upgradable from: 1.5.71]
python3-uno/disco-updates 1:6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 1:6.2.2-0ubuntu2]
ubuntu-settings/disco-updates,disco-updates 19.04.3.1 all [upgradable from: 19.04.3]
ubuntu-web-launchers/disco-updates,disco-updates 19.04.3.1 all [upgradable from: 19.04.3]
uno-libs3/disco-updates 6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 6.2.2-0ubuntu2]
ure/disco-updates 6.2.3-0ubuntu0.19.04.1 amd64 [upgradable from: 6.2.2-0ubuntu2]
root@xps:/ #

Confirm Number of Available Updates with apt

We can use wc command to count the number of available packages returned by apt list –upgradable. But because the output starts with line “Listing…”, we should probably use grep command to get rid of it:

root@xps:/ # apt list --upgradable | grep -v Listing | wc -l
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
45

We will see the same number of packages if we run apt update (but don’t press Y or Enter if you’re not ready to upgrade packages just yet):

root@xps:/ # apt upgrade
Reading package lists... Done
Building dependency tree 
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libgsasl7 libkyotocabinet16v5 libmailutils5 libntlm0 libpython2.7 libpython2.7-minimal libpython2.7-stdlib
mailutils-common
Use 'apt autoremove' to remove them.
The following packages will be upgraded:
bind9-host brave-browser debconf debconf-i18n dnsutils fonts-opensymbol gnome-control-center gnome-control-center-data
gnome-control-center-faces gnome-shell-extension-appindicator libbind9-161 libdns-export1104 libdns1104 libirs161
libisc-export1100 libisc1100 libisccc161 libisccfg163 liblwres161 libreoffice-avmedia-backend-gstreamer
libreoffice-base-core libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw libreoffice-gnome
libreoffice-gtk3 libreoffice-help-en-gb libreoffice-help-en-us libreoffice-impress libreoffice-l10n-en-gb
libreoffice-math libreoffice-ogltrans libreoffice-pdfimport libreoffice-style-breeze libreoffice-style-colibre
libreoffice-style-elementary libreoffice-style-tango libreoffice-writer python3-debconf python3-uno ubuntu-settings
ubuntu-web-launchers uno-libs3 ure
45 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
Need to get 187 MB of archives.
After this operation, 2,529 kB disk space will be freed.
Do you want to continue? [Y/n]

See Also




Make BIND9 named Use Only IPv4

Screen Shot 2019-05-01 at 17.41.33.pngHaving recently built a centralised log server with RSyslog on one of my Raspberry Pi systems at home office, I’m finally getting to reap the rewards: small and not so small errors get noticed and resolved at last.

Network Unreachable Resolving IPv6 in named

I notice getting lots of named errors like this:

May 1 16:13:04 becky named[545]: network unreachable resolving 'ns-1683.awsdns-18.co.uk/A/IN': 2600
:9000:5301:5200::1#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'ns-1244.awsdns-27.org/A/IN': 2600:9
000:5306:5b00::1#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'ns-1683.awsdns-18.co.uk/AAAA/IN': 2
600:9000:5301:5200::1#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'ns-573.awsdns-07.net/AAAA/IN': 2600
:9000:5301:c800::1#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'ns-1244.awsdns-27.org/AAAA/IN': 260
0:9000:5306:5b00::1#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'ns-573.awsdns-07.net/A/IN': 2600:90
00:5305:4700::1#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'ns-573.awsdns-07.net/AAAA/IN': 2600
:9000:5305:4700::1#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'flickr.com/DS/IN': 2001:503:231d::2
:30#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'yf2.yahoo.com/A/IN': 2406:8600:b8:f
e03::1003#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'yf1.yahoo.com/A/IN': 2406:8600:b8:f
e03::1003#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'yf2.yahoo.com/AAAA/IN': 2406:8600:b
8:fe03::1003#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'yf1.yahoo.com/AAAA/IN': 2406:8600:b
8:fe03::1003#53
May 1 16:13:04 becky named[545]: network unreachable resolving 'yahoodns.net/DS/IN': 2001:503:39c1:
:30#53

Since they all looked like IPv6 addresses, I figured IPv6 would be the explanation. Since I’m not using IPv6 yet, the logical step to resolve issues was to disable IPv6.

Switch BIND9 named to using IPv4 only

By editing the /etc/default/bind9 file, it’s very easy to enfore IPv4 ONLY mode.

Change OPTIONS line from this:

OPTIONS="-u bind"

to this:

OPTIONS="-u bind -4"

Now we just need to restart named daemon. Confusingly enough, it’s done by restarting the  service:

greys@becky:/ $ sudo systemctl restart bind9

let’s quickly confirm bind9 status:

greys@becky:/ $ sudo systemctl status bind9
● bind9.service - BIND Domain Name Server
Loaded: loaded (/lib/systemd/system/bind9.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2019-05-01 16:33:56 UTC; 3s ago
Docs: man:named(8)
Process: 3062 ExecStop=/usr/sbin/rndc stop (code=exited, status=0/SUCCESS)
Main PID: 3067 (named)
CGroup: /system.slice/bind9.service
└─3067 /usr/sbin/named -f -u bind -4

May 01 16:33:56 becky named[3067]: automatic empty zone: EMPTY.AS112.ARPA
May 01 16:33:56 becky named[3067]: configuring command channel from '/etc/bind/rndc.key'
May 01 16:33:56 becky named[3067]: command channel listening on 127.0.0.1#953
May 01 16:33:56 becky named[3067]: managed-keys-zone: loaded serial 788
May 01 16:33:56 becky named[3067]: zone 0.in-addr.arpa/IN: loaded serial 1
May 01 16:33:56 becky named[3067]: zone 127.in-addr.arpa/IN: loaded serial 1
May 01 16:33:56 becky named[3067]: zone localhost/IN: loaded serial 2
May 01 16:33:56 becky named[3067]: zone 255.in-addr.arpa/IN: loaded serial 1
May 01 16:33:56 becky named[3067]: all zones loaded
May 01 16:33:56 becky named[3067]: running

That’s it! Problem solved – no more IPv6 errors in named logs.

See Also




How To Install TTF Fonts in Linux

Screenshot from 2019-04-28 21-38-29.png

I really like the Hack font – it’s used in my terminal apps on MacOS, Linux and even Windows workstations. This short post demonstrates how to install Hack font, but you can use the steps to configure any other TrueType Font (TTF) on your system.

Step 1: Download the TTF font files

In my case, I downloaded the Hack v3 ZIP archive.

Naturally, you need to unpack it:

greys@xps:~/Downloads $ unzip Hack-v3.003-ttf.zip 
Archive: Hack-v3.003-ttf.zip
creating: ttf/
inflating: ttf/Hack-Bold.ttf 
inflating: ttf/Hack-BoldItalic.ttf 
inflating: ttf/Hack-Italic.ttf 
inflating: ttf/Hack-Regular.ttf 
greys@xps:~/Downloads $

Step 2: Copy TTF files into local fonts directory

First you’re going to have to create it in your own homedir:

greys@xps:~/Downloads $ mkdir -p ~/.local/share/fonts 

Now let’s copy the font files into that local fonts directory:

greys@xps:~/Downloads $ ls ttf/* 
45-hack.conf Hack-BoldItalic.ttf Hack-Bold.ttf Hack-Italic.ttf Hack-Regular.ttf 
greys@xps:~/Downloads $ cp ttf/*ttf ~/.local/share/fonts/

Step 3: Refresh fonts cache with fc-cache command

Just run the fc-cache command like this:

greys@xps:~/Downloads $ fc-cache -f -v 

This command will show a list of fonts locations that it inspects and caches for system use. Among the lines of output you can see my home directory:

/usr/share/fonts/type1: caching, new cache contents: 0 fonts, 1 dirs
/usr/share/fonts/type1/gsfonts: caching, new cache contents: 35 fonts, 0 dirs
/usr/X11R6/lib/X11/fonts: skipping, no such directory
/usr/local/share/fonts: caching, new cache contents: 0 fonts, 0 dirs
/home/greys/.local/share/fonts: caching, new cache contents: 4 fonts, 0 dirs
/homee/greys/.fonts: skipping, no such directory
/usr/share/fonts/X11: skipping, looped directory detected

Step 4: Review available fonts

This should now report that your graphics system (X11/Xorg) has access, the list will include the newly installed fonts Hack:

greys@xps:~/Downloads $ fc-list | grep Hack
/storage/greys/.local/share/fonts/Hack-Regular.ttf: Hack:style=Regular 
/storage/greys/.local/share/fonts/Hack-Bold.ttf: Hack:style=Bold 
/storage/greys/.local/share/fonts/Hack-BoldItalic.ttf: Hack:style=Bold Italic 
/storage/greys/.local/share/fonts/Hack-Italic.ttf: Hack:style=Italic

That’s it! Since I wanted this Hack font specifically for terminal use, I went and updated my default profile in GNOME Terminal app:

Screenshot from 2019-04-28 21-30-50.png

to enjoy the font:

Screenshot from 2019-04-28 21-30-17.png

See Also




Ubuntu 19.04 Released

2019-04-19_22-20-31

Pretty cool! Next version of Ubuntu, 19.04 (Disco Dingo) has just been released. I couldn’t wait to try it in my VirtualBox setup – seems there are lots of performance improvements that are noticeable even in a virtual machine!

Seems 2GB is the minimum RAM for Ubuntu 19.04

The installer kept freezing on me, I coudln’t understand why. I even upgraded VirtualBox from 6.0.4 to 6.0.6 – quite a few bugs fixed, you know. But this didn’t help with my issue and eventually I realised: Ubuntu 19.04 needs more than 1GB of RAM to work properly. Once I upgraded VM RAM to 2GB, the installer worked just fine:

Ubuntu 19.04 runs on Linux Kernel 5.0.0

One of the reasons Ubuntu 19.04 is promised to be such an improvement performance wise: it’s running on Linux Kernel 5.0.0:

2019-04-19_22-24-07

Have you installed Ubuntu 19.04 yet? What do you think?

See Also




screenFetch in Linux Mint

screenfetch-linux-mint-19-1-xps.png

Great stuff, I have just installed Linux Mint 19.1 on my Dell XPS 13 laptop! Naturally, one of the first things to be run is the screenFetch utility.

Install screenFetch on Linux Mint

Based on Ubuntu Linux, Linux Mint enjoys abundant software repositories, which means it’s super easy to install screenFetch on the new system:

root@xps:~# apt-get install screenfetch
Reading package lists... Done
Building dependency tree 
Reading state information... Done
Recommended packages:
scrot
The following NEW packages will be installed:
screenfetch
0 upgraded, 1 newly installed, 0 to remove and 245 not upgraded.
Need to get 50.6 kB of archives.
After this operation, 236 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 screenfetch all 3.8.0-8 [50.6 kB]
Fetched 50.6 kB in 0s (308 kB/s) 
Selecting previously unselected package screenfetch.
(Reading database ... 249721 files and directories currently installed.)
Preparing to unpack .../screenfetch_3.8.0-8_all.deb ...
Unpacking screenfetch (3.8.0-8) ...
Setting up screenfetch (3.8.0-8) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

screenFetch in Linux Mint 19.1

This is the output of screenFetch on my laptop:

screenfetch-linux-mint-19-1-xps.png

See Also




How To List Files in Ubuntu/Debian Package

dpkg -L

 

If you’re ever looking for a specific list of files included with one of the packages on your Ubuntu/Debian/Mint Linux setup, here’s how you can do it using the dpkg command:

# dpkg --listfiles libcurl4-openssl-dev
/.
/usr
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu/pkgconfig
/usr/lib/x86_64-linux-gnu/pkgconfig/libcurl.pc
/usr/lib/x86_64-linux-gnu/libcurl.a
/usr/lib/x86_64-linux-gnu/libcurl.la
/usr/share
/usr/share/doc
/usr/share/doc/libcurl4-openssl-dev
/usr/share/doc/libcurl4-openssl-dev/copyright
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/curl-config.1.gz
/usr/share/aclocal
/usr/share/aclocal/libcurl.m4
/usr/include
/usr/include/curl
/usr/include/curl/curlver.h
/usr/include/curl/mprintf.h
/usr/include/curl/stdcheaders.h
/usr/include/curl/easy.h
/usr/include/curl/curlrules.h
/usr/include/curl/multi.h
/usr/include/curl/curlbuild.h
/usr/include/curl/typecheck-gcc.h
/usr/include/curl/curl.h
/usr/bin
/usr/bin/curl-config
/usr/lib/x86_64-linux-gnu/libcurl.so
/usr/share/doc/libcurl4-openssl-dev/changelog.Debian.gz
/usr/share/doc/libcurl4-openssl-dev/NEWS.Debian.gz

The same can also be done with the shorter version of the command line option: dpkg -L

One of the most typical things to check next would be to verify the integrity of all these files in the package – usually dpkg keeps checksums for all the files installed.

Verifying integrity of files instlaled by the package:

# dpkg --verify libcurl4-openssl-dev
??5?????? /usr/include/curl/curl.h

In this example I have gone and edited the comment in the curl.h header file, just to change it enough for dpkg to pick it up. Since checksums are used for highlighting differences and also because most of package installed files are binaries or special non-cleartext formats, you don’t see the text-based diff but instead just get an indication that certain file differs from the original version installed by dpkg.

The shorter version of the same is dpkg -V.




How To Check RAID Progress with /proc/mdstat

I explained how to read the /proc/mdstat in my recent post How To Identify RAID Arrays in Linux, so today is a super quick follow up using one of my systems.

I use Synology NAS in my office and disks in the storage array are getting old, so I decided to swap them out one by one in the next few months. Synology runs a Linux based proprietary OS called DSM, and ultimately it relies on software RAID configured and managed with md devices. So all the setup is done using web-based GUI, but I always like double-checking what’s going on by logging directly onto the appliance.

Here’s how I use /proc/mdstat to track the faulty disk replacement:

# cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4]
md2 : active raid6 sda5[9] sdb5[1] sdh5[7] sdg5[6] sdf5[8] sde5[4] sdd5[3] sdc5[2]
 17552612736 blocks super 1.2 level 6, 64k chunk, algorithm 2 [8/7] [_UUUUUUU]
 [==>..................] recovery = 13.4% (393456896/2925435456) finish=1578.6min speed=26731K/sec

This tells me:

  • md2 is the name of a RAID array device
  • RAID type is RAID6 (confirmed by raid6 personality AND level 6 words)
  • my array consists of 8 disks (sda5/sdb5/…/sdh5)
  • RAID block size is 64K
  • 7 devices are up (that’s what each of the Us mean in the [_UUUUUUU] section)
  • 1 device is down (that’s what the underscore _ means in [_UUUUUUU])
  • Array is going through a recovery procedure, we’re 13.4% there with another 26 hours (finish=1578.6min) to go
  • Speed of the RAID array recovery (effectively that’s the speed of populating the new disk with parity-based data from other disks in the array) is 26.1MB/sec (speed=26731K/sec)



Enable Text Console Support in Ubuntu

There are three ways to access the command line interface in Ubuntu, as on any Linux and UNIX distribution. One is launching the terminal emulator program within the graphical user interface. The other two are about accessing the console directly, independent of the graphical user interface and the windowing system powering it (typically X server), and that’s what we’re concerned with here.

The quickest way to get to the console in Ubuntu is to just press Ctrl-Alt-F1. You will immediately be thrown out of the GUI and into the clean Linux console where you can log in and use the command line. Multiple console terminals are available this way if you press Ctrl-Alt-F2, Ctrl-Alt-F3, and so on.

However, what you might want is to get into the text console when you boot into Ubuntu instead of booting directly into the graphics mode. For that you’ll need to make some configuration changes to your GRUB bootloader. The configuration file you will need to modify is /etc/default/grub, and it is a good idea to make a backup of it first in case you ever want to come back to the original configuration:

sudo cp /etc/default/grub /etc/default/grub.backup

With that out of the way you can start modifying the configuration file by opening it, with superuser privileges, in a text editor such as nano:

sudo nano /etc/default/grub

Enter your password and the file will open. Then look for this line: GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”. Using nano you can search for this line by pressing the Ctrl-W shortcut and typing that line in. You just need to comment it out by putting a hash character in front of it so it looks like this:

# GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

As you might guess this disables booting with the splash screen, and the “quiet” mode, meaning it wouldn’t hide the console output during boot.

Next enable the text mode finding GRUB_CMDLINE_LINUX and adding the “text” option to it. The line will then look like this:

GRUB_CMDLINE_LINUX="text"

This will ensure that you see the text output, but still doesn’t enable the console login. For that find the #GRUB_TERMINAL line, which is likely commented out, uncomment it by removing the # character, and add the “console” option to it so it reads like this:

GRUB_TERMINAL=console

Finally save the file, which in nano you can do by pressing Ctrl-X and then enter, and make sure to update GRUB with the new configuration using the update-grub command:

sudo update-grub

Now you can reboot and Ubuntu should boot in the text mode, and allow you to log in to the console and run the desired commands.