Monthly Archives: January 2013

Display a future or past date in the bash shell

Here’s a quick and easy way to establish what the date will be in a specific number of days from today using the bash shell on Linux. Simply use the ‘-d’ option to the ‘date’ command.

Here’s the current timestamp:

-bash-3.2$ date
Thu Jan 17 15:04:28 GMT 2013

And this will be the date 60 days from now:

-bash-3.2$ date -d "now 60 days"
Mon Mar 18 15:04:31 GMT 2013

You can also use the same code to display dates from past. What was the date 94 days ago?

-bash-3.2$ date -d "now -94 days"
Mon Oct 15 15:07:35 GMT 2012

To get the last calendar day of the previous month:

date -d "-$(date +%d) day" +%Y-%m-%d

(Display the date days ago. So on 17 January, 17 days ago would be 31 December)

Thinkpad W530, Red Hat Enterprise Linux 6, Fedora and Windows 8 Multiboot

Now that we’ve successfully done a clean Windows 8 install on the W530 and got it dual booting with Fedora 17, it’s now time to add another distribution onto the laptop – Red Hat Enterprise Linux 6.

My first attempts to install RHEL 6.3 onto the W530 resulted in the graphics failing to load by the installer. This resulted in the screen displaying a strobing set of psychedelic colours. A few Red Hat Knowledge-base articles which might be relevant:

RHEL6 does not boot on Lenovo W520 Laptop with Discrete option selected to choose nVidia GPU

Blank screen during installation when using certain NVIDIA Quadro Graphics Adapters under Red Hat Enterprise Linux 6

Why won’t the Nvidia driver compile/install/load under Red Hat Enterprise Linux 6

I don’t recall exactly what settings I initially tried in the BIOS for display type which offers the following options:

  • “Integrated” – uses built-in Intel Integrated Graphics Controller”
  • “Discrete” – uses nVidia Graphics
  • “nVidia Optimus” – uses the built-in Intel Integrated Graphics Controller but allows the OS to use nVidia when needed (supported only with Windows 7 and Window 8)

Anyhow, I attempted to install with the following options on the kernel command line:

xdriver=vesa nomodeset

From what I can tell, that should have allowed the installer’s X Server to start successfully, but it did not. However, the installer helpfully told me that I could use a VNC client to perform the Red Hat install.

I told the installer to select /boot/efi as the EFI install partition, the one shared with Windows 8 and Fedora.

After the install, I was given the option to start Windows 8 or Red Hat Linux. The Fedora choice was no longer listed. Fortunately, there was a backup /boot/efi/EFI/redhat/grub.conf.rpmsave which contained the Fedora/Windows 8 option. It’s now just a case of merging the Red Hat and Fedora 8 grub files.

Here’s the result:

device (hd0,5) HD(2,96800,32000,ad8e8d71-db62-4c7a-8603-5bc6ce875d52)
 title Fedora (3.6.11-1.fc17.x86_64)
  root (hd0,5)
  kernel /vmlinuz-3.6.11-1.fc17.x86_64 rd.lvm=0 KEYTABLE=us SYSFONT=True rd.luks=0 root=UUID=a6f32b89-45ac-410f-8a1e-562b441304e3 ro LANG=en_US.UTF-8 rhgb quiet
  initrd /initramfs-3.6.11-1.fc17.x86_64.img
 title Windows 8
  set root=(hd0,gpt1)
  chainloader /EFI/Microsoft/Boot/bootmgfw.efi
 title Red Hat Enterprise Linux (2.6.32-279.el6.x86_64)
  root (hd0,8)
  kernel /vmlinuz-2.6.32-279.el6.x86_64 ro root=UUID=fe96af7b-07bd-451e-b4de-4eec673f4cca nomodeset rd_NO_LUKS KEYBOARDTYPE=pc KEYTABLE=us LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto rd_NO_LVM rd_NO_DM rhgb quiet xdriver=vesa
  initrd /initramfs-2.6.32-279.el6.x86_64.img
 title Windows 8
  rootnoverify (hd0,3)
  chainloader +1
title Fedora
  rootnoverify (hd0,6)
  chainloader +1