Thursday, 28 April 2016

SSD optimisations on ASUS TP300LA running Fedora 23

Please leave a comment if you spot anything that is wrong (share if you know more than what I have discovered; or better still, warn me if I am doing something stupid etc. etc.)

References

Enable TRIM Support

First and foremost, ensure your SSD supports TRIM. Some SSDs have issues with their TRIM implementations. Researching that is also crucial. For example issues with continuous TRIM are discussed at Continuous TRIM by mount flag.
Does your SSD support trim? [Sandisk SDSSDHII-960G-G25 960GB Ultra II]
[mochapenguin@tp300la ~]$ su -c 'hdparm -I /dev/sda' | grep TRIM
Password:
* Data Set Management TRIM supported (limit 16 blocks)
* Deterministic read ZEROs after TRIM

Enabled TRIM support following the Phoronix article on Tweaking Your Fedora Installation For Maximum Productivity & Features
Enable fstrim.timer service
sudo systemctl enable fstrim.timer sudo systemctl start fstrim.timer

Edit /etc/crypttab and add discard
/etc/crypttab
luks-x-b3b728ea5e7c UUID=x-b3b728ea5e7c  none    luks,discard fc23home            UUID=x-deaft04500f2  none    luks,discard

Update initramfs
sudo dracut -f

Reboot. And verify.
Test if TRIM is working
[mochapenguin@tp300la ~]$ sudo fstrim -v /
[sudo] password for mochapenguin:
/: 686.4 GiB (736991698944 bytes) trimmed

Profile-Sync-Daemon

PSD is designed to manage browser profile(s) in tmpfs and to periodically sync back to the physical disc, thereby reducing writes to SSDs. This is useful where there is ample spare RAM on the system.

Browsers store their profile and cache in various locations as described below:

Firefox

cache
/home/mochapenguin/.cache/mozilla/firefox/<profile-id>.default
profile
/home/mochapenguin/.mozilla/firefox/<profile-id>.default

I took the approach of moving the cache folder into the profile folder (so PSD can sync it to tempfs) and create a symlink (so the browser works on as before).

Created a folder named cache within the profile folder, moved the cache folder contents there and created a symlink to it.

create symlink from Code
ln -s /home/mochapenguin/.mozilla/firefox/<profile-id>.default/cache /home/mochapenguin/.cache/mozilla/firefox/<profile-id>.default

Google Chrome

cache
/home/mochapenguin/.cache/google-chrome
profile
/home/mochapenguin/.config/google-chrome

Created a folder named CacheFedoraUser within the profile folder, moved the cache folder contents there and created a symlink to it.
create symlink from Code
ln -s /home/mochapenguin/.config/google-chrome/CacheFedoraUser /home/mochapenguin/.cache/google-chrome

Midori

cache
/home/mochapenguin/.cache/midori
profile
/home/mochapenguin/.config/midori

Created a folder named cache within the profile folder, moved the contents of the cache folder there and created a symlink to it.

create symlink
ln -s /home/mochapenguin/.config/midori/cache /home/mochapenguin/.cache/midori
profile-sync-daemon parse
[mochapenguin@tp300la ~]$ psd p
Profile-sync-daemon v5.68 on Fedora 23 (Workstation Edition)
 Systemd service is currently active.  Systemd resync service is currently active.  Overlayfs v23 is currently active.
Psd will manage the following per /run/psd.conf settings:

 browser/psname:  firefox/firefox
 owner/group id:  mochapenguin/1000
 sync target:     /home/mochapenguin/.mozilla/firefox/am4vgccx.default
 tmpfs dir:       /tmp/mochapenguin-firefox-am4vgccx.default
 profile size:    104M
 overlayfs size:  0
 recovery dirs:   none

 browser/psname:  google-chrome/chrome
 owner/group id:  mochapenguin/1000
 sync target:     /home/mochapenguin/.config/google-chrome
 tmpfs dir:       /tmp/mochapenguin-google-chrome
 profile size:    83M
 overlayfs size:  62M
 recovery dirs:   none

 browser/psname:  midori/midori
 owner/group id:  mochapenguin/1000
 sync target:     /home/mochapenguin/.config/midori
 tmpfs dir:       /tmp/mochapenguin-midori
 profile size:    1.4M
 overlayfs size:  0
 recovery dirs:   none

Enable overlayfs

Decided to use the overlayfs for the profile sync. This may be optional but I understand it helps making the sync efficient.

load up the overlay module manually (first time)
sudo modprobe overlay

Load up the overlay module as above, enable overlay in psd.conf and restart the service. The output of the profile-sync-daemon parse command should now show "Overlayfs v23 is active".
Added the below file to get the overlayfs module to be loaded on boot from this finding on FedoraForum.

/etc/modules-load.d/overlayfs.conf
overlay

Wednesday, 27 April 2016

WIP - ASUS TP300LA - Windows 10 + Fedora 23 - dual boot

Work in Progress

Purchased an ASUS TP300LA notebook last Christmas. Documenting my journey here. Please leave a comment if you spot anything that is wrong (share if you know more than what I have discovered; or better still, warn me if I am doing something stupid etc. etc.)

Most important - recovery drive

It came with Windows 8.1. I make sure I create a recovery drive so that I can recover the system if I mess things up. Made a USB Recovery Drive (TODO - USB size).

SSD

It had a 500GB HDD built in. I was keen on replacing that with an SSD. Got a 960GB SanDisk Ultra II SSD. Swapped the drives and used the recovery drive to restore the system.

At that point in time it had partitions sda1 (305MB RE), sda2 (100MB EFI), sda3 (128MB MS reserved), sda4 (C drive), and sda5 (ASUS recovery drive).

Windows 10

Then upgraded to Windows 10. This created a 450MB partition (Windows 10 boot, I believe) at the end of the C drive partition.

I wanted to move all boot partitions etc before the partition for the C drive, reduce the C drive partition and blitz the ASUS recovery drive - thereby creating room for a Fedora install.

Using GParted, I moved the 450MB partition before the C drive partition. Reduced the C drive to under 100GB. That left under half the C drive free for installing software if I decided to use Windows 10 (unlikely to be very much). ASUS recovery partition was deleted (since we have a Recovery USB Drive now anyway).

Fedora 23 Workstation install

Installed Fedora 23 x64 Workstation. 

The plan is to have an encrypted swap, /home and /tmp for security. 

During installation, selected Custom Partitioning. Defined the partition manually. ~ 500MB for /boot, LUKS encrypted 6GB (same size as the RAM) for swap, 100GB at the end of the drive for /home (LUKS encrypted) and the remaining in between for /

Below screenshot shots how things looked.



Encrypting /home

Boot up to the Fedora Login prompt. Press CTRL + ALT + F2 to bring up the console. Log in as root. Following commands are used to make a copy of /home

Code
[root] mkdir homebackup [root] cp -a /home/* homebackup/ # Make a new dm-crypt device cryptsetup --verify-passphrase -v luksFormat /dev/sda9 # cryptsetup luksOpen /dev/sda9 fc23home # verify cryptsetup luksDump /dev/sda9 # mkfs.ext4 /dev/mapper/fc23home # remove lost+found rm -rf /home/* # cp -a homebackup/* /home
Code
/etc/crypttab /etc/fstab
Now I have a dual boot Windows 10 + Fedora 23 Workstation on my ASUS TP300LA.

Good things noticed:
  • Hibernation works great 

Tuesday, 26 April 2016

Fedora 23 - User interface customisations

Customisations applied on my Fedora 23 machine

Custom Shortcuts

If you are used to Windoze shortcuts and want to use the same, this is what you can do:

Go to Settings (drop down menu from the top right corner > spanner + screwdriver icon





Click on the Keyboard icon. Then the Shortcuts tab.
 
Select Custom Shortcuts, Click on the + button and define the shortcuts





1. Terminal - Super + T





Define the shortcut and click the Add button
 




Click on the text Disabled to define a new accelerator key combination.
 








Name: 




NameCommandShortcut
Terminal
gnome-terminal
Win + T
Firefox
firefoxWin + F
Nautilus
nautilusWin + E




Tuesday, 17 November 2015

Acer Aspire Switch 10 (SW5-012)


Purchased one of these handy devices recently. These are suited for light activity like media consumption (watching movies, listening to music etc), typing up articles, blogs etc. 

Bear in mind, they are not for gaming or programming.

Update BIOS

The device came with BIOS version 1.05.

The following updates were available at the Acer website. Picked the latest and greatest one. I would want to upgrade the system to Windows 10 when that is available. It needs to be verified that the device has driver support for Windows 10 before taking that plunge. I am not that keen on running Windows 8.1 drivers in compatibility made.


BIOS
Acer
Support Windows 10 BIOS capsule update.
1.18
3.9 MB
2015/10/23
BIOS
Acer
Update SMBIOS.
1.16
3.9 MB
2015/09/30
BIOS
Acer
Improved system performance
1.14
3.9 MB
2015/04/24
BIOS
Acer
Improve system performance
1.13
3.9 MB
2015/01/30
BIOS
Acer
BIOS
1.10
3.9 MB
2014/11/18
BIOS
Acer
Upgrade Intel MicroCode
1.06
3.9 MB
2014/10/15

Procedure:

Download the update file and run it from within the Windows environment. The patch will reboot the system, apply the update and reboot again.

Windows Update

Enable automatic Windows Update. Go and watch your favourite TV programme. My system showed 111 updates that needed to be applied.

TODO

  • Try recovery - Created a recovery USB drive (with a copy of the recovery partition) on an 8GB memory stick. Need to understand how to boot off it to restore the system to its original state.
  • Remove bloatware

Thursday, 22 January 2015

HP Photosmart All-in-One (2710) installation on Fedora 21

Background

This is what I had to do to set up HP Photosmart All-in-One 2710 device on my laptop running Fedora 21

The 2710 device is already configured to be a wireless network printer on the network.

Procedure

Ensure the device is connected to the network and can be pinged.

Commands entered
[mochapenguin@dv6tqe ~]$ ping 192.168.0.200
PING 192.168.0.200 (192.168.0.200) 56(84) bytes of data.
64 bytes from 192.168.0.200: icmp_seq=1 ttl=255 time=130 ms
64 bytes from 192.168.0.200: icmp_seq=2 ttl=255 time=14.8 ms

Ensure hplip is installed:


Commands entered
[mochapenguin@dv6tqe ~]$ sudo yum install hplip
[sudo] password for mochapenguin:
Loaded plugins: langpacks
adobe-linux-x86_64 | 951 B 00:00
google-chrome | 951 B 00:00
rpmfusion-free-updates | 2.7 kB 00:00
rpmfusion-nonfree-updates | 2.7 kB 00:00
updates/21/x86_64/metalink | 26 kB 00:00
(1/4): google-chrome/primary | 1.9 kB 00:00
(2/4): adobe-linux-x86_64/primary | 1.2 kB 00:00
(3/4): rpmfusion-nonfree-updates/21/x86_64/primary_db | 48 kB 00:00
(4/4): rpmfusion-free-updates/21/x86_64/primary_db | 104 kB 00:00
adobe-linux-x86_64 2/2
google-chrome 3/3
Package hplip-3.14.10-5.fc21.x86_64 already installed and latest version
Nothing to do

Install hplip-gui


Commands entered
[mochapenguin@dv6tqe ~]$ sudo yum install hplip-gui
Loaded plugins: langpacks
Resolving Dependencies
--> Running transaction check
---> Package hplip-gui.x86_64 0:3.14.10-5.fc21 will be installed
--> Processing Dependency: python-reportlab for package: hplip-gui-3.14.10-5.fc21.x86_64
--> Processing Dependency: PyQt4 for package: hplip-gui-3.14.10-5.fc21.x86_64
--> Running transaction check
---> Package PyQt4.x86_64 0:4.11.3-1.fc21 will be installed
--> Processing Dependency: sip-api(11) >= 11.1 for package: PyQt4-4.11.3-1.fc21.x86_64
---> Package python-reportlab.x86_64 0:3.1.8-4.fc21 will be installed
--> Running transaction check
---> Package sip.x86_64 0:4.16.5-1.fc21 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
hplip-gui x86_64 3.14.10-5.fc21 updates 1.5 M
Installing for dependencies:
PyQt4 x86_64 4.11.3-1.fc21 fedora 3.1 M
python-reportlab x86_64 3.1.8-4.fc21 fedora 1.2 M
sip x86_64 4.16.5-1.fc21 updates 125 k

Transaction Summary
================================================================================
Install 1 Package (+3 Dependent packages)

Total download size: 5.9 M
Installed size: 25 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): PyQt4-4.11.3-1.fc21.x86_64.rpm | 3.1 MB 00:01
(2/4): python-reportlab-3.1.8-4.fc21.x86_64.rpm | 1.2 MB 00:00
(3/4): hplip-gui-3.14.10-5.fc21.x86_64.rpm | 1.5 MB 00:06
(4/4): sip-4.16.5-1.fc21.x86_64.rpm | 125 kB 00:00
--------------------------------------------------------------------------------
Total 974 kB/s | 5.9 MB 00:06
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction (shutdown inhibited)
Warning: RPMDB altered outside of yum.
Installing : python-reportlab-3.1.8-4.fc21.x86_64 1/4
Installing : sip-4.16.5-1.fc21.x86_64 2/4
Installing : PyQt4-4.11.3-1.fc21.x86_64 3/4
Installing : hplip-gui-3.14.10-5.fc21.x86_64 4/4
Verifying : sip-4.16.5-1.fc21.x86_64 1/4
Verifying : hplip-gui-3.14.10-5.fc21.x86_64 2/4
Verifying : PyQt4-4.11.3-1.fc21.x86_64 3/4
Verifying : python-reportlab-3.1.8-4.fc21.x86_64 4/4

Installed:
hplip-gui.x86_64 0:3.14.10-5.fc21

Dependency Installed:
PyQt4.x86_64 0:4.11.3-1.fc21 python-reportlab.x86_64 0:3.1.8-4.fc21
sip.x86_64 0:4.16.5-1.fc21

Complete!

Now it's time to run the main setup program hp-setup

Commands entered

[mochapenguin@dv6tqe ~]$ sudo hp-setup

HP Linux Imaging and Printing System (ver. 3.14.10)
Printer/Fax Setup Utility ver. 9.0

Copyright (c) 2001-13 Hewlett-Packard Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.


This launches the following window:
 

Selected - Network/Ethernet/Wireless network (direct connection or JetDirect).








Used Manual Discovery option with IP address





All-in-One 2710 successfully recognised



Enter printer details and click on [Add Printer]



























Happy printing and scanning

Friday, 29 November 2013

India - Internet Speed map

India - Internet Speed Map

As a little experiment, I created an Internet Speed Map for India. Click on any marker on the map to view the details of the internet speed test.

Last map update at 19-Jun-2015 22:00 IST. If you spot an error, please take a moment to let me know (in the comments below).



Add your internet speed to the map!

Want to see your own internet speed details on this map. Please add it here. Your report will show up after the next map update (in a few days).

How does it help?

It has the following uses:
  • Compare your internet speed with others in your area / city
  • Verify if people are really getting speeds anywhere near what the ISP is promising you would get when you join
  • If those in your neighbourhood are getting much better speeds by the same ISP, you may have a faulty line
Obviously the accuracy of this analysis would depend on the number of speed test result submissions there are. Please come back to this page later and also encourage your friends to post their speed test results here.

Stats

Winners
Attribute ISP value
Best Ping Atria Convergence Technologies - Chennai 3 ms
Fastest Download Atria Convergence Technologies - Chennai 26.31 Mbps

Losers
Attribute ISP value
Worst Ping BSNL - Lucknow 184 ms
Slowest Download BSNL - Chandigarh 0.43 Mbps (Not confirmed if due to FUP)


Improvements ahead

  • Real time addition of data to the map -
I am doing this in my spare time, so I cannot promise a timeline to these changes.

Friday, 13 September 2013

Install fun_plug (0.7) on D-Link DNS-315 (NAS)

Introduction

These are my notes on installing and configuring fun_plug (0.7) on D-Link DNS-315 (NAS). If you come across anything that doesn't come across clear please leave a comment and I shall attempt to add more explanation.
For me the primary motive for installing fun_plug was to enable SSH. This allows me to mount directories on my NAS onto my laptop / desktop

Resources

Pre-requisites

Remote Backup

Please ensure that the internal “Remote Backup” Services is deactivated. This server is shipped with newer NAS like the DNS-320/DNS-320L/DNS-325/DNS-345 and conflicts with the SSH-Server of the fun_plug.

Installation and configuration

Overview of Installation steps

  • Follow the steps here. Download ARM version of fun_plug.tgz and copy the 2 files to root of drive
  • Fix script issues
    • change permissions of script - executable (on Linux)
    • the HDD mount point is /mnt/HD/HD_a2
  • Reboot 
  • fun_plug script should run and install fun_plug
  • change root password - described here
  • Apply the steps described in the post-install fixes section
  • activate services by chmod a+x the respective scripts
    • For instance, to enable ssh daemon, type chmod a+x /ffp/startup/sshd.sh
  • [if you wish to use SSH] See the section on SSH Configuration for additional configuration

Post install fixes

permission issues

There appears to be a problem with file permissions – after reboot most of them are reset to 777 and that upsets sshd and also prevents choosing the startup scripts.

To address this, modify  /ffp/etc/fun_plug.init

I added to /ffp/etc/fun_plug.init the following line, just before the section dedicated to enable/disable services:

/ffp/etc/fun_plug.init
chmod 600 /ffp/etc/ssh/ssh_host_*
chmod 755 /ffp/var/lib/sshd

fixes for sshd.sh

* I also changed a line in /ffp/start/sshd.sh to correctly check for the /ffp/etc/ssh/ssh_host_ecdsa_key file.


It appears this error may be to a invalid reference to the ssh file in /ffp/start/sshd.sh script.

/ffp/start/sshd.sh
The original script reads:

if [ ! -f /etc/ssh/ssh_host_ecdsa_key ]; then
/ffp/bin/ssh-keygen -t ecdsa -f /ffp/etc/ssh/ssh_host_ecdsa_key -N ''
fi

I believe it should read:

if [ ! -f /ffp/etc/ssh/ssh_host_ecdsa_key ]; then
/ffp/bin/ssh-keygen -t ecdsa -f /ffp/etc/ssh/ssh_host_ecdsa_key -N ''
fi
#!/ffp/bin/sh

Set up rsync option.

@see troubleshooting section
Adding users

added user using the web interface

Configuring User Home directories

usermod -s /ffp/bin/sh mochapenguin

mkdir -p /ffp/home/mochapenguin/
sed -ie 's#:/usr/share/ftp/mochapenguin:#:/ffp/home/mochapenguin:#g' /etc/passwd
pwconv

usermod -d /ffp/home/mochapenguin/ mochapenguin
store-passwd.sh [saves changes to disk]
<<worked>>

permissions of the user and user .ssh folder at boot

[after users have been created]

Create a script to put back the permissions of the user and user .ssh folder at boot


log in as root (did it using a telnet session)
touch /ffp/etc/fun_plug.local

/ffp/etc/fun_plug.local
#!/ffp/bin/sh
chmod 700 /ffp/home/mochapenguin
chmod 600 /ffp/home/mochapenguin/.ssh/*
chmod 700 /ffp/home/mochapenguin/.ssh

SSH Configuration

Using certificates

Concept - http://nas-tweaks.net/53/private-public-key-authentication-with-openssh-in-ffp/

Changing the home of the user

By default, the home directory of the user ”root” is set to /home, which is located in the internal flash-memory. This memory is deleted every time the device is rebooted. Thus the home-directory of the each user should be moved to be a sub-directory of ffp.

mkdir -p /ffp/home/root/
usermod -d /ffp/home/root/ root
store-passwd.sh

You need to repeat the last two steps every time your firmware gets upgraded.

Generating the keypair

mkdir /ffp/home/root/.ssh
cd /ffp/home/root/.ssh

There are now two choices for the key. You can either have a password (which can automatically be entered by ssh-agent or PuttY Pageant) or no password. Both ways are described below and will generate two files named keypair and keypair.pub which contain the private and public key needed for the authentication:
  • Without Password
  • ssh-keygen -f keypair -C 'Generated by nas-tweaks.net' -t rsa -q
  • With Password
  • ssh-keygen -f keypair -C 'Generated by nas-tweaks.net' -N '' -t rsa -q



Adding public key

create .ssh folder in /ffp/home/mochapenguin as user mochapenguin

change permission of directory to 700
copy pub file to .ssh folder
set chmod to 600

Activating authorized_keys in SSH
Open /ffp/etc/ssh/sshd_config and search for the following line:
#PubkeyAuthentication yes
And remove the comment:
PubkeyAuthentication yes

Moving the generated keys to authorized_keys

touch authorized_keys
chmod 600 authorized_keys
cat keypair.pub >> authorized_keys

restart SSH

root@DNS-315:~# sh /mnt/HD/HD_a2/ffp/start/sshd.sh restart

Log output

Here is the fun_plug startup log from DNS-315. There are a couple of things I am not happy about. But they are not show stoppers anyway. I shall be looking into them as soon as I get time. Any suggestions in the meantime are welcome.

ffp.log
**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****
**** fun_plug script modded by Uli (2012-02-21 ffp@wolf-u.li) ****
Sat Sep 14 01:35:28 BST 2013
ln -snf /mnt/HD/HD_a2/ffp /ffp
* Running /ffp/etc/fun_plug.init ...
* Running /ffp/etc/fun_plug.local ...
* Running /ffp/etc/rc ...
* /ffp/start/SERVERS.sh ...
* /ffp/start/portmap.sh ...
Starting /ffp/sbin/rpc.portmap
* /ffp/start/nfsd.sh ...
Mounting /proc/fs/nfsd ...
WARNING: rpc.portmap: Already running <== How do I turn off rpc portmap?
Starting /ffp/sbin/rpc.statd
Starting /ffp/sbin/rpc.nfsd 8
rpc.nfsd: unable to resolve ANYADDR:nfs to inet address: Servname not supported for ai_socktype <= WTF?
rpc.nfsd: unable to set any sockets for nfsd
Starting /ffp/sbin/rpc.mountd
* /ffp/start/LOGIN.sh ...
* /ffp/start/telnetd.sh ...
Starting /ffp/sbin/telnetd -l /ffp/bin/sh
* /ffp/start/sshd.sh ...
Starting /ffp/sbin/sshd
* /ffp/start/rsyncd.sh ...
Error: Missing config file /ffp/etc/rsyncd.conf
* /ffp/start/kickwebs.sh ...
Kicking webs ...
webs: no process found
* /ffp/start/lighttpd.sh ... <= Should I turn this off for now? How?
/ffp/etc/lighttpd.conf: Required file not found or not readable
* /ffp/start/inetd.sh ...
/ffp/etc/inetd.conf: Required file not found or not readable
* /ffp/start/fp_master.sh ...
Starting /ffp/sbin/fp.master
Ready.

Troubleshooting