Saturday, December 31, 2016

Configure Postfix To Deliver Mail From Desktop (root, user) To My Gmail Account

I'm using Ubuntu 16.04 LTS and I want to use the command line to send messages to my regular email account. There are administrative tasks that sends mail to root / administrator but to simplify my tasks I want these messages to be sent to my regular email account in Gmail.

I installed postfix first.

#apt install postfix mailutils

Then accepted some basic configurations that were prompted when installing postfix.
 
    General type of mail configuration?: Internet Site
    System mail name: a hostname that will be used in mail headers, a FQDN is preferred, desktop, home
    Root and postmaster mail recipient: root
    Other destinations to accept mail for: $myhostname, desktop, localhost.localdomain, localhost
    Force synchronous updates on mail queue?: No
    Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.0.0/24
    Mailbox size limit: 0
    Local address extension character: +
    Internet protocols to use: all

If you need to return to these settings, type:

#dpkg-reconfigure postfix

You need to create a password file which Postfix will use to authenticate with Gmail. In Ubuntu such a file should be placed in /etc/postfix/sasl/sasl_passwd. So I used my favorite text editor and:

#nano /etc/postfix/sasl/sasl_passwd

I entered:

"[smtp.gmail.com]:587  emailaddr:app password"            - do this without the quotes, okay.

Save and close the file.

Protect this file.

#chmod 600 /etc/postfix/sasl/sasl_passwd

Make sure the following entries are present in /etc/postfix/main.cf so open the file and add or modify the file.

relayhost = [smtp.gmail.com]:587
smtp_use_tls = yes
smtp_sasl_auth_enable = yes
smtp_sasl_security_options =
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

Use postmap to compile and hash the contents of /etc/postfix/sasl/sasl_passwd. So type:

#postmap /etc/postfix/sasl/sasl_passwd

Then restart postfix by typing:

#systemctl restart postfix.service

That's it. You can check your work by sending a test email.

$echo -e "Hello. This is a test message."|mail -s "Test Message" username@gmail.com





Friday, December 30, 2016

1st Impressions On Wave8, the Tablet

Hello Reese

I am using the new Wave8 tablet from PLDTHome customer retention. It is fun to use a slightly larger screen. The brightness is different in IPS screens. I have to download the app for neutral brightness.

The mail app is fine. The compose window have a bigger keyboard I agree with. No SMS though because this device is WiFi only. But it has android 6 marshmallow so it should be more secure than my zenfone android 5, right?

It has 12 GB storage. It is a little cramped.

New Tablet - Wave8 From PLDT Home



PLDT Home's customer retention bait is a device called the Wave8. This is a Android Marshmallow device. It has an IPS screen.


Friday, December 23, 2016

fstab2

To find the UUID, use 'blkid' as root. This will generate a list of
devices and their respective UUID's. Like so:

#blkid
/dev/mapper/sda5_crypt: UUID="DLkZz4-D3rH-dODr-eaO3-h1Oa-MLe2-9OVQMz"
TYPE="LVM2_member"
/dev/mapper/ubuntu--vg-root: UUID="d05b055d-032c-4f91-88d1-f8983d3474f6"
TYPE="ext4"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/sda1: UUID="3f4ce798-b0c8-4c04-a83d-3628838cb6ca" TYPE="ext2"
PARTUUID="68d8d639-01"
/dev/sda5: UUID="a0497c16-a3ae-4610-820c-3bb61b52af1f"
TYPE="crypto_LUKS" PARTUUID="68d8d639-05"
/dev/sdb1: UUID="e3284314-1258-cac3-1b6c-243c748be2fe"
UUID_SUB="f30caf8e-a9f4-672c-eb72-113d4520fc53" LABEL="desktop:0"
TYPE="linux_raid_member" PARTUUID="8e34b25a-01"
/dev/sdc1: UUID="e3284314-1258-cac3-1b6c-243c748be2fe"
UUID_SUB="fa3fadd3-be1d-9195-489a-f52ad5392fa8" LABEL="desktop:0"
TYPE="linux_raid_member" PARTUUID="1e02b459-01"
/dev/sdd1: UUID="e3284314-1258-cac3-1b6c-243c748be2fe"
UUID_SUB="7aaf10aa-aa0f-e6f3-78fc-b27d21901954" LABEL="desktop:0"
TYPE="linux_raid_member" PARTUUID="1b0cf221-01"
/dev/md0: UUID="ueXOJC-T7SH-8udq-3Ezs-XrHN-fiIj-lvlL0Y" TYPE="LVM2_member"
/dev/mapper/ubuntu--vg-swap_1:
UUID="9295b9f3-e8dc-4411-b717-29e960b735b6" TYPE="swap"
/dev/mapper/ubuntu--vg-Music--lv:
UUID="8ea3af6e-2aab-4f03-8850-2eb475743fc9" TYPE="ext4"
/dev/mapper/ubuntu--vg-Videos--lv:
UUID="924cdfea-58bd-42ff-8bf6-a4796bf5b584" TYPE="ext4"

Copy and paste the UUID when referring to the device they point to.

fstab

fstab is a file (actually /etc/fstab) showing the partitions that are
automatically mounted by the kernel when it is booted. The kernel reads
the fstab file and follows it.

It is recommended that instead of a device name, a UUID is used. A UUID
is a universally unique identifier for the device. This hexadecimal
value doesn't change even as you remove hard drives or replace them, or
move their connections around. In other words the hard drives don't get
lost in the shuffle. If you have more than one hard drive in the box
like me that would be a tremendous help keeping tabs.

The fstab lists the root partition and swap partition. Ubuntu plans to
use a swap file by Ubuntu 17.04 but fstab rules still applies. Each
partition contains the name or UUID, mount point, filesystem type, mount
options, etc. Don't worry about the details, fstab is automatically
generated for you upon installation. You do get extra points for
modifying it for security, and if you have more esoteric plans for your
partitions.

I use 4 hard drives and an SSD. For this discussion's purpose the SSD is
like the hard drives and it's also where I boot and keep my root
partition. I have the 4 hard drives formed into a RAID array. I then
virtually created logical volumes to utilize the entire storage
available. In my case, that's 1 SSD plus the RAID array.

I understand that putting noexec, nosuid on fstab options for a
partition makes it more secure but not all partitions should have them.
I put them in my LV's which contain music and video. I also got advised
to put them in the shared memory partition - /dev/shm.

The jury is still out if I should put it in my /home partition.

Before modifying the /etc/fstab file, I created a backup file and saved
it as /etc/fstab.backup. If I missed something and the system won't
boot, I can just go back to the working fstab file as before.

After modifying fstab, reboot to check if the changes made are fine.

Tuesday, December 20, 2016

How Did I Get Started With Linux?

I started my journey in Linux from Windows XP. I spent half the time
trying to regain control of my computer. I spent too many minutes
checking malware and viruses. I spent too many minutes wondering why my
machine is getting slow. Then I ask myself if there's a better way.

A better way is not a new GUI. A better way is not surrendering control
to the machine and letting it handle the way I work. When I first
install a Linux distribution, I was surprised at its speed, then I
checked if I can work with the alternative applications. Using Linux is
empowering. You figure things out with other people online asking the
same questions. Then I read. Then I do and test. Then I learn.

I don't create code. I do know how to work a script. I examine logs.
Then I read. Then I learn. This is something I wouldn't do if I'm using
Microsoft or OSX, although you can code on those platforms.

Sunday, December 18, 2016

State Of My Blogging 2016



This is how my wordpress blog appears on the desktop, December 2016. Evoking mystery and unknown adventure with shadows and light. I'm using 2016 theme from the Wordpress resource.

Wednesday, December 14, 2016

Smartctl Knows If It Slips

I have smartctl configured to run short tests on all my hard drives but I wonder if it slips one, what would happen.

donato@desktop:~$ less /var/log/syslog|grep sdd
Dec 14 08:30:31 desktop smartd[1444]: Device: /dev/sdd [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 74 to 68
Dec 14 08:30:31 desktop smartd[1444]: Device: /dev/sdd [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 26 to 32
Dec 14 08:30:31 desktop smartd[1444]: Device: /dev/sdd [SAT], old test of type S not run at Sat Dec 10 23:00:00 2016 PHT, starting now.
Dec 14 08:30:31 desktop smartd[1444]: Device: /dev/sdd [SAT], starting scheduled Short Self-Test.

This is part of the logs in the 14th reporting that indeed smartctl did not run the test once. It started a short test immedietely.

Monday, December 12, 2016

With Mom At VMMC


Creatinine, uric acid and triglycerides are still above normal.

Prescriptions and medicines.


Donato Roque@Asus_Z00AD
SMS:639185721710

Sunday, December 11, 2016

SSMTP Instead Of Postfix

I am using Ubuntu 16.04 LTS. I was trying to send email from the command
line to my Gmail address. So instead of monitoring tools sending info
and warning emails to root I want them to arrive in my proper email
address.

I tried Postfix but after a month of trying to make it work and looking
at mail logs, I give up. I removed it and installed ssmtp instead. The
configuration is very simple. Open the file:

#nano /etc/ssmtp/ssmtp.conf

and make sure these appears on the file:

mailhub=smtp.gmailaddress.com:587
Authuser=gmailaddress
Authpass=AppPassword
UseTLS=YES
UseSTARTTLS=YES

Close and save the file. Then test it with:

$echo "Test email for SSMTP" | mail -s "Test Email" gmailaddress.com

Check if you receive the email. If not then you could check the mail
logs with:

#tail /var/log/mail.log

Ordered A Hard Drive Online

I ordered a 3 TB internal hard drive from Lazada, an online shopping
website. I'm paying 4,699 cash on delivery for it. That places this
drive at 1.56 per GB. But it would stick out among the 2 TB Hard drives
I am already using. My last purchased hard drive is a Seagate 2 TB
costing 3,200 cash last July 2016. My oldest hard drive is a Seagate
Barracuda 1 TB at least 5 years old but has 31,100 hours on it according
to smartctl. If you want a complete information on hour hard drive just
type:

#smartctl -a /dev/sda

The command will print out SMART information gathered from monitoring
your hard drives.

The Simplest Explanation

After that accidental reboot a few days ago, I keep getting something from the logs. It's about the kernel unable to resolve /dev/sdd1
symlinks, about ata6 fails. This is a drive which is a member of
/dev/md0, a RAID5 array I use. I checked the RAID with:

$mdadm --detail /dev/md0

and the supposed 3 working devices making up this RAID5 array is now 2,
with 1 removed as reported in the logs.

This is happening for a couple of days now, sometimes more than once a
day. I would add the device back to the array but the kernel will
complain about ata6 (/dev/sdd) and remove it from the array. I already
checked this hard drive (/dev/sdd 1 TB). SMART marks this hardware OK
and I ran an extended self-test on it to satisfy my self. Is this a
software or a hardware problem?

I opened the desktop box panel so I can inspect the cables for the
drives. It's always the cables, it's always the loose connection.

Monday, December 5, 2016

Vice President Leni Robredo Resigns Cabinet

"I read the news today oh boy". VP Leni Robredo resigned her Cabinet job as Housing Secretary. She was sent an SMS from Malacanang that she is not to attend the Cabinet meetings starting December 5 anymore. Perhaps PDuterte figured she's the leak in the Marcos Reinstatement - Bato Call issue. In any case PDuterte cannot work with her anymore. Malacanang *just* sent an SMS to the Vice President. Bastos talaga.

Clearly, right from the start the President and the Vice President have differences. First, Leni says *Marcos Is Not A Hero* and PDuterte says by law he deserves a heroes burial. Second, Leni wants the EJK to stop, PDuterte want to intensify and prolong EJK. But I also believe that PDuterte wants another one to sit as Vice President - Bong Bong Marcos. PDuterte has behaved and shown publicly his preference. Leni has resigned the Cabinet but She is elected as Vice President, only the people can remove her from that position.

Sunday, December 4, 2016

Accidental Reboot / Shutdown Causes Errors In The Hard Drive

I accidentally pressed the hardware reset because it's too close to the headphone jacks. I've got big fingers what can I say. So it's a couple of seconds later that I noticed that the computer (the monitor) has restarted. Except that the initial restart sequence is throwing me to a console with a bad ata status:DRDY message. I've seen this before. It's a bad shutdown for one or more of the hard drives / raid device.
I checked the status of the RAID device and confirmed it. I've got an inactive array. So I issued:

#mdadm /dev/md0 --stop

to stop the array and restart it with:

#mdadm --assemble /dev/md0 /dev/sdb1 /dev/sdc1 /dev/sdd1

but no go, so again i tried this:

#mdadm --assemble --force /dev/md0 /dev/sdb1 /dev/sdc1 /dev/sdd1

I check the status of the array after I started it.

#mdadm --detail /dev/md0

root@desktop:~# mdadm --detail /dev/md0
/dev/md0:
        Version : 1.2
  Creation Time : Tue Sep  6 02:59:21 2016
     Raid Level : raid5
     Array Size : 1953260544 (1862.77 GiB 2000.14 GB)
  Used Dev Size : 976630272 (931.39 GiB 1000.07 GB)
   Raid Devices : 3
  Total Devices : 2
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Sun Dec  4 22:59:12 2016
          State : clean, degraded
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 512K

           Name : desktop:0  (local to host desktop)
           UUID : e3284314:1258cac3:1b6c243c:748be2fe
         Events : 2849

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       4       0        0        4      removed

One of the devices comprising this array is removed. Maybe due to corrupt data or something else. I figured i could do more if I reboot with this degraded array into my desktop. So I did. I used the Gnome SMART checker (it's what I call it). Refreshed the status and the devices checks out.

So figuring out that the device is not really bad (according to SMART). I added it back to the array with:

#mdadm --manage --add /dev/md0 /dev/sdd1

I checked the status of the array with:

#mdadm --detail /dev/md0

/dev/md0:
        Version : 1.2
  Creation Time : Tue Sep  6 02:59:21 2016
     Raid Level : raid5
     Array Size : 1953260544 (1862.77 GiB 2000.14 GB)
  Used Dev Size : 976630272 (931.39 GiB 1000.07 GB)
   Raid Devices : 3
  Total Devices : 3
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Sun Dec  4 23:11:48 2016
          State : clean, degraded, recovering
 Active Devices : 2
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 1

         Layout : left-symmetric
     Chunk Size : 512K

 Rebuild Status : 4% complete

           Name : desktop:0  (local to host desktop)
           UUID : e3284314:1258cac3:1b6c243c:748be2fe
         Events : 2853

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       3       8       49        2      spare rebuilding   /dev/sdd1

All I have to do now is wait for it to rebuild the device back to the array.

/dev/md0:
        Version : 1.2
  Creation Time : Tue Sep  6 02:59:21 2016
     Raid Level : raid5
     Array Size : 1953260544 (1862.77 GiB 2000.14 GB)
  Used Dev Size : 976630272 (931.39 GiB 1000.07 GB)
   Raid Devices : 3
  Total Devices : 3
    Persistence : Superblock is persistent

  Intent Bitmap : Internal

    Update Time : Sun Dec  4 23:14:22 2016
          State : clean
 Active Devices : 3
Working Devices : 3
 Failed Devices : 0
  Spare Devices : 0

         Layout : left-symmetric
     Chunk Size : 512K

           Name : desktop:0  (local to host desktop)
           UUID : e3284314:1258cac3:1b6c243c:748be2fe
         Events : 2890

    Number   Major   Minor   RaidDevice State
       0       8       17        0      active sync   /dev/sdb1
       1       8       33        1      active sync   /dev/sdc1
       3       8       49        2      active sync   /dev/sdd1

It took just 10 minutes.

Guake!

Guake is a drop-down terminal application in GNOME. Installing Guake is easy. Use your distribution's package manager, most distros hav...