Install Linux on a Fresh Machine using LVM!

Okay, I know, the title says it all right? And there are hundreds and thousands of tutorials out there that allows you to do this right? Show me one tutorial which tells you what different partitions are needed when you are doing fresh install of Linux especially whose installers do not support LVM/LVM2 installations. Lets take an example of Manjaro, the latest talk of the town. The graphical installers do not have an option to support LVM. Even if you do manual partitioning, it does want to install anything over LVM and it wants the root and swap partitions. Besides, it will forget that we also need a smaller boot partition to install GRUB/SYSLINUX right? Well, atleast it did that to me and either I am too stupid to understand it or I didn’t read the instructions properly. In any case, I headed over to the CLI installer which thankfully had an option to use LVM (which was misguiding) since it wanted to do partitions manually and did not provide any guidance as to what partitions should be created. Instead it more felt like an GUI menu for creating reminding the steps namely partitioning, creating physical volumes (PVs) and creating volume groups (VGs).

So without much ado, below are the things that you really need to do to use LVM properly and then use it without the installers supporting/not supporting it. My assumption is that you want to use all the disks in your computer inside the VG for LVM. Assuming 2 disks, below is the schema.

/dev/sda should have the following partitions.

1. A boot partition of around 256MB (create lesser if you want, will only be used to install GRUB/SYSLINUX/any other boot loader).  /dev/sda1
2. A swap partition double the amount of RAM that you have. /dev/sda2
3. A LVM partition covering the whole disk. /dev/sda3

/dev/sdb should have:

1. A swap partition double the amount of RAM that you have /dev/sdb1
2. A LVM partition covering the whole disk. /dev/sdb2

Add whatever number of disks that you need to add but be sure to create the 2 varieties. Use any of fdisk, gdisk, parition managers, etc. to create the needed partitions. Now create the (PVs) and (VGs) that you want. For this the following commands will help.

lvmdiskscan –> shows the partitions available to create volumes

pvcreate <all LVM partitions here> eg: pvcreate /dev/sda3 /dev/sdb2 (for the above example) –> create a physical volume group with the needed partitions

pvdisplay –> list the partitions added to the physical volume(s)

vgcreate <vgname> <partitions to include in this vg> eg: vgcreate vgpool /dev/sda3 /dev/sdb2 –> create a volume group with the name vgpool including the listed partitions

vgdisplay –> Display your volume group and included partitions

lvcreate –l 100%FREE <vgname> –n <logical_volume_name> eg: lvcreate –l 100%FREE vgpool –n lvhome –> creates a logical volume lvhome on the vgpool consuming 100% of the free space on the vg

vgscan and vgchange –ay –> scan and activate the lvms.

 

At this point in time you should be able to use your LVM for installing. In the installer, go to manual partitioning and select /dev/sda1 as the boot partition and /dev/sda2 as the swap with mount point of /dev/lvhome as root. Hopefully this will avoid the number of formats and partition restructuring that I had to do. Énjoy your new Linux using LVM on this machine. PS: The latest kernel support LVM but if not, do a modprobe on dm-mod install lvm2 before doing all the above.

Metrics & task boards in Scrum/Agile!

My thoughts on why and how metrics/measurements of ongoing tasks should be done.

I will start with the practice. The problems we are trying to tackle is:

1. How to make our team believe in their own estimations?
2. What is our cycle time?
3. How do we project the probability of fulfilling the sprint goals?
4. How do we track the state of the task?
5. How do we ensure continuous development of processes?

For the last 3 questions, I suggest referring to the self-explaining Cumulative Flow Diagrams (http://www.slideshare.net/yyeret/explaining-cumulative-flow-diagrams-cfd). Martin Alaimo writes on measuring sprint progress in the Scrumalliance community blogs (https://www.scrumalliance.org/community/articles/2011/may/measuring-sprint-progress). Essential Scrum: A practical guide to the Most Popular Agile Process by Kenneth S. Rubin (p.357-359) defines how task metrics can be visualized (though in a table formation) (https://books.google.se/books?id=3vGEcOfCkdwC&pg=PA357&lpg=PA357&dq=visualize+tasks+in+scrum+boards&source=bl&ots=-BBbkkfr_l&sig=KqO_9xWDIEM3hVqe-9QSi0IQKQQ&hl=en&sa=X&ved=0ahUKEwjZk9ztxurKAhWFs3IKHYioBLE4FBDoAQg9MAU#v=onepage&q=visualize%20tasks%20in%20scrum%20boards&f=false). An electronic task board showing the progress (https://www.targetprocess.com/content/uploads/2013/11/lists-sketch-for-Targetprocess-3.png). A detailed article by MSFT on Task board (of course tailored towards VS Team edition usage but has lots of details) (https://msdn.microsoft.com/en-us/library/vs/alm/work/scrum/task-board). Another article (https://blog.taiga.io/q-id-like-to-measure-the-sprint-progress-through-closed-tasks.html) very good on why sprint progress should be monitored regularly and not at the end of the sprint.

I know we all hate RallyDev but still a nice article (https://help.rallydev.com/task-board). And again an MSDN article on srcum process workflow (https://msdn.microsoft.com/en-us/library/vs/alm/work/guidance/scrum-process-workflow). And a good read on Effective Visual Management of Scrum/Task boards with Information Radiators (https://agilepearls.wordpress.com/tag/scrum-boards/).

For this sprint, I will put information on my tasks which will help visualize the progress as well as track the state of the task and project if we can meet the sprint goals. And it will also help in the retrospective and next sprint planning with estimation.

Retrospective 2015 – Good, bad and ugly!

My last blog entry was on 1st July 2015. It has almost been 6 months and I am not that proud of the lapse in time without writing down my thoughts. It is as I see not only bad for my readers but also for my mental health ;). In any case, one of my new year resolutions is to jot down atleast some of my thoughts every fortnight, if not every week. Hopefully, this new year resolution does not go down the drain as every other till date. My detailed retrospective for 2015 is below. But the key takeaways were that 2015 was an average year. A lot of things happened, some good, some bad, but they haven’t been able to satisfy me and I feel that the time spent could have been done in a better manner furthering towards my goals, both material and spiritual.

2015 started with a bang. January was the 3rd month of pregnancy for my wife with the due dates in July being fixed. In February, I got the bad news that the envelope containing my certificates that I had sent for my MBA course was returned back to me saying “Invalid Address”. I got in touch with the relevant authorities and they accepted my late submissions. In March, I finally got admitted to MBA which was to start in August. In the meantime, the office work was boiling down to boring chores and I had the experience of working in a very bad team from every perspective, be it work, relationships, etc. The first half of the year in the office was dreadful. The team I was put in was very immature and had some elements which didn’t care about team performance and delivery but instead cared about their personal ego satisfaction at the cost of redoing work and wasting company resources! This led to a lot of friction between various members with the final culmination point on me since I was quite vocal about those aspects. In any case, I then moved on to a much better team which had the delivery mentality and was mature enough to engage in various aspects. And this happened in the second half which helped take a lot of stress out of my life which was accumulated during the first half.

Since July was decided to be the due date for my 2nd child, my parents came in June and this time were planned to stay with us for 8 months. But then the bad news started rolling in. My paternal aunt passed away (@75 years) in end of June merely 20 days after my parents arrival. My parents especially my dad had a very hard time coping up with the loss. My 2nd child was born on 16th July with normal delivery procedures. Though my wife had to be rushed into the ambulance as she was bleeding from the afternoon. The baby came at 1.40am the next day who was supposed to change the next 6 months for all of us. She is a bundle of both joy but with gastric troubles. Her sleeping patterns are very unusual so we rarely got any sleep. In the meantime, my father started having low blood pressure and after a lot of deliberation, we finally had to pre-pone our parents departure tickets to leave in end of September. My MBA had started and I have to spend almost 10 hours a week to keep pace with submission of assignments and papers as demanded by the course.

After my parents went back to India, we received another bad news. This time my maternal grandfather  (90 years) expired after a prolonged illness. As if that was not enough, my cousin sister’s mother-in-law also expired in December. Incidentally, both my paternal aunt and cousin’s mother-in-law were best friends who had spent almost half of their lifetime together. Again in December, my uncle on father’s side expired (~80 years) after an illness as well. This is the only year that I know of when I have seen so many deaths in our family. Death is the final reality of life which we do not think about except when we see someone die. It is sometimes a point of spiritual thought as to how we can make the most out of our life instead of doing normal chores and passing away.

On the good side, my father’s health is back to normal, we have got a little bit of life back since our 2nd one is growing up and is almost 6 months now. My eldest is going to a Swedish school so hopefully has her future secured. We have invested in a house coming up in 3 years time from now. MBA in BTH is going along at full speed and we are almost at the end of semester learning a lot of things and fundamentals which are far more valuable to know in theory, even though have applied practically. Work is good and am enjoying with my new team. I released a CM12.1 ROM for Oppo Find5 on XDA and am now working for CM13.0 plus some other exquisite ROMs for Find5. A lot of new projects were started both on github and bitbucket. Gitlab has some interesting projects ongoing which I will open source once I reach a certain useable point. Plus I revived my interest in cricket and played quite a few games in summer with Danish Cricket League (though our team didn’t win any but hey!). Also I am playing badminton regularly which has a very positive effect on my mental and physical health. The bad part being at after my 2nd kid was born and my MBA started, I am not able to devote time to Cardio which I intend to start again this year. My Swedish is still worst than a “nollan”.

As for the new years resolutions, they are very simple.
1. Learn Swedish (carry forward from last year)
2. Finish all the different projects started in 2015
3. Keep up with the MBA, work and personal life starting with my exercises again

Hopefully, 2016 is much better than 2015. I do hope that I can contribute to the society which satisfies my soul and I am able to make my family and world at large a happier place. HAPPY NEW YEAR Everybody!

OrmLite – Lightweight ORM Package + Android + *<—>* relationship?

My most recent adventure in Android/Multi-platform applications is CrickBoard! It is hosted on github.com and is licensed under GPLv3. The application is still under construction and there will be some time before it becomes fully operational. Most of the work is remaining in the UI and further utility functions related to UI data handling. This also is my first application following Google’s Material Design guidelines. I initially had planned to use a multi-platform SDK so that it can run seamlessly on at least Android, iOS and WP. But that would branch out later I guess as my first target is Android with the material design. I am using some design libraries that I got from Android-Arsenal.com. Most of these libraries are open source licensed under very constructive opensource licenses. So for the record, as of now, CrickBoard is using MikePenz’s MaterialDrawer and Dexafree’s MaterialList. Both are great components providing ready to use material design libraries implemented and updated according to Google’s guidelines.

For the database part of it, I wanted to do it using SQLite directly. It turned out to be quite cumbersome especially when the encapsulation/serialization of data was not being handled in a single class. Of course making the data classes more complicated would have worked, but I generally follow the KISS principles. I was searching for a lightweight ORM/DBMS library that can work on Android (and possibly other platforms) and provides me with the needed encapsulation and serialization possibilities. I stumbled upon OrmLite, a very light weight Object Relational Mapping java package and believe me, it is amazing. It has power Database Access Objects (DAOs), supports multiple DBs, native calls to Android DB APIs, and a whole lot more. The best part is that one simply needs to configure general classes as needed and with very little DB specific coding. Creation of DBs, relationships between various tables and elements, etc. can all be done in a more descriptive language. Also it can be easily learned. The only thing which is a bit weird and took some time for me to understand is the 1—>* (1 to many or has-a relationship) and how it is implemented in OrmLite.

There are some examples given for account and orders with one account holding multiple orders. If one does not use OrmLite, the orders per account needs to be filled up manually or using simple queries. Also the encapsulation of the retrieved data would have to be handled in a separate manner with either utility/helper functions/classes which would implement the code to connect the orders per account alternation. But using OrmLite, one can use the ForeignCollection<> in account. The peculiarity is that the order now has to have a ForeignField account. This is not quite visible at first until you run into weird errors. Also one of the things that you cannot do is populate the ForeignCollection<> field in the account table yourself. This will be filled up automagically by OrmLite. Looking into more details, it seems entirely logical to avoid the complexity of raw SQLs and data filling yourself. But sometimes, it still feels as if much information will be duplicated because of this strategy.

For example, in CrickBoard, a player can be a part of multiple teams. i.e. a 1—>* relationship between player and teams. Also, each team can have multiple players i.e. 1—>* relationship between team and player. The latter is an easy solution where the team has a ForeignCollection<> of players and each player has a ForeignField of player. BUT there is no such easy solution for the former part. Since each player can only have 1 ForeignField of team, the player is restricted to only 1 team. The problem is I can’t have a ForeignCollection<> of teams in the players (indicating that the same player can be part of multiple teams). Hence, the way forward for me is to create the tables in the following manner. Of course, these scheme will make things complicated in terms of queries and DB updates.

 

Player (1) –> Intermediary1 (*) <—> Intermediary2(*) –> Team(1)

 

If I follow the above schema, it will give me the possibility to have a many to many relationship to have the same player in multiple teams and a team having multiple players. Of course there will be code duplication as well as some complex SQL queries generated because of the above. I know it gives away the KISS principles but for the time being, I see this as the only way forward. Duplicating Players is not an option for me. Any other suggestions are most welcome. I will try to implement them in CrickBoard and see if it does not complicate much. Maybe I can reduce one of the intermediary tables and have only 1 in the middle (MatchPlayers?). More updates will come as and when I progress. In the meantime, do checkout the project and feel free to contribute to it.

Cheers, Naresh

Garmin Nuvi 2545LMT – My advnetures!

As usual, I prefer writing down what I did to solve a particular problem or set of problems so that I can myself refer back to it for solutions in future and someone having similar/any troubles can use this as a starting point to try and fix the problems faced. For me, the problems started when my wife started complaining about my Garmin Nuvi 2545LMT not working properly.

There were basically 2 problems with it. It needs the full address to really search for the location and the maps were old (2013.10). So basically I fired up the webupdate in a Win7 machine and started with the updates. It took a whole lot of time (almost 8 hours) before I knew the outcome of the update. The update brought its own problems.

The 2545 firmware was updated to version 8.20 BUT, it removed my supplementary gmapsupp.img file from the device as it needed more space for the new 2015.40 maps. And somehow, it was not able to recognize my separate Nordic maps collection later on. Now I was stuck with an updated map for CN with no usability of Nordic maps. Also the device stopped recognizing maps loaded on SDCards after the update. After much frustration and searching on the net, I figured out the following.

1. I had to go back to the previous version of the firmware which was working fine (7.90).
2. Put the Nordic maps on the internal memory as gmapsrom.img
3. Load the CN maps on external memory as a gmapsupp.img

Reason for doing the switch was that most of my travelling is in Nordic regions and I can safely remove the external SDCard when roaming in Nordic regions. That helps me with faster bootups, faster GPS fixes and responsive device. So below are the steps that needs to be done.

Plugin the unit on a Linux machine (as my windows always loaded as an emulated drive even if mass storage was enabled. Hence I was not able to access the hidden .System folder). Make sure you do a backup of the .System folder before starting the below mentioned procedures. Once the backup is done, head over to http://gawisp.com/perry/nuvi/ and download the firmware for your device. A word of caution, flashing wrong firmware on wrong device will make your device unusable. Of course there are ways to recover (one can search google for that). Take the proper GCD file and put it as GCDUPDATE.GCD file in the hidden .System folder. You can overwrite the old file if any exists.

Now reboot the unit, you should get a warning about installing an older version of the Software and loosing data. Say yes and proceed. Once done, browse through the filesystem and remove unnecessary files to free up the much needed space. Candidates for removals are EULA (other than you language of choice) and help files. Now I put my nordic maps as gmapsrom.img in the .System folder. Formatted my SDCard to FAT32 (mkfs.vfat /dev/mmcblk0), created a Map folder (check your GarminDevice.xml for the right path) and put the gmapsupp.img (CN maps on that one). Of course my maps were unlocked. Locked maps will not work. Unlocking of Garmin maps is a topic discussed a lot in gpspassion so head over there and learn (google is your best friend).

So, after all these juggling, my GPS is finally working. I don’t see any major updates in 8.20 that warrants me to use that version. 7.90 is good enough for me and will stay on my unit.

Cheers and Happy GPS (hacking!) 😉