Hearing about Kids on Computers (KOC), at SCALE - the Southern California Linux Expo, I was moved and excited to assist. This group installs classrooms using free and open source software.
I was moved by the work they were doing and reached out immediately to find out more about contributing to this effort.
KOC were going to Mexico in a month and I was too late to prepare for this trip but the wheels were in motion for the next round.
The first round did not go well. They were short staffed with technical experts. They didn't know how to truncate an image and were searching for larger SD cards because of it. They spent money where they did not need to due to lack of information, knowledge and skills.
I had no idea this happened. When I heard about this, I realized: They needed technical assistance.
The Project - December 2018 TasksThe main project for setting up a classroom included content curation and image customization. While I wanted to be on the content curation team, I knew the pi image work was more along the lines of my skills.
Start with Raspbian on the Pi and Desktop - December 2018Inital idea - Raspbian
The idea here was to create images that were consistent (as consistent as possible), thereby offering a similar product for desktop as for the Pi. After some diving into the project, I realized Raspbian for Desktop was not a suitable product for our needs. Therefore, a custom image based on Mint was produced.
Mint for the Desktop=PintOS
The main focus was the pi image. For this iteration, Raspbian was the base. Past labs were equipped with desktops, laptops using Ubermix or Ubuntu. So, in order to keep consistency, I examined Ubermix packages and attempted to customize the Raspbian image to include the software, tools and utilities included in Ubermix.
Package Analysis and SelectionMost packages were explicitly available by getting the list of installed packages. However, there were these ubuntu-edu packages for pre-school, primary, secondary and tertiary. Upon examination of these packages, we discovered the Ubuntu-edu packages included packages mostly from KDE Education.
Ubuntu-edu Packages are actually externally contributed projectsonly.
For many years, Edubuntu, Ubermix, and other Education editions included these packages. Not one single package was an Ubuntu contribution - unless you count the package with all the other packages within. I do think some thought and time was taken into selection of externally contributed packages into something called ubuntu-edu.
Image Customization
Adding ARM packages to Raspbian, changing basic settings, changing locale and language were all part of the customization. hwinfo was set to manual. Using Raspbkids as a base and adding a panel, shortcuts, tux typing, and a background image were also part of the customization by KOC. Using the no longer maintained Qemo image (free - and thanks for that... <3)
Tux Typing did not seem to be doing very well on the Pi as certain combinations of game options would crash the game while playing. I also taught them to kill a process using top.
Oh.... did I teach them killall -9... oops no. However, I did show the students how to kill a process. "it's just three letters, " I said. "Three! TOP."
So, all things considered, the preparation before the trip was completed in my opinion. I saw no reason to actually go to Mexico and implement the image. However, I received an amazing deal on the flight and return flight. After much reassurance that I would be safe, I agreed to venture to Mexico and help with the Pi lab.
January 2018Day 1 - Saturday, January 20
We met as a group in Oaxaca City, Mexico. We stayed collectively at Hotel Aurora. This was a great day as we were invited for Frijoles and Pata at Hermes' family's home.
Day 2 - Sunday, January 21
We had breakfast at a very nice place.
We took the equipment to Huajuapan (sounds like wawapan) by bus. One group left ahead of us. The trip was along a winding road. I didn't think I would get ill, but regretted not taking a Dramamine.
We arrived in Huajuapan, Mexico and stayed at Hotel Garcia Peral.
This was a very nice hotel. The first night, we discussed the image and using Raspbian as a base, the "guys" tried to run the script with the repo one person brought. The problem with the repo was this was untested in this offline environment and the person preparing the repo did not include dependencies. One thing you learn early on in Linux is always consider dependencies and permissions.
So, since they could not install most any package on the base with the repo and script, we used my image. I had removed Tux Typing due to crashing errors on the pi3. However, we decided to include Tux Typing regardless as this was one software the schools wanted.
In the case of this image, nothing was tested, no list was create. I just added and removed software based on functionality.
I was not informed which shortcuts we wanted on the desktop, so this needed to be done on site.
Day 3 - Monday, January 22
I was working remotely and waiting for Hermes to arrive as he took the bus on Monday. However, I did not realize Hermes would not arrive until 4pm. I took "shelter" at the local Burger King (BK) for most of the time as the wifi there was superior to any other internet access.
The hotel internet access was down. I did have phone access with data. However, this access was not as stable as BK!
In the late afternoon, I saw our group What'sApp messages - "Divine Intervention" was needed at the local school - 18 de Marzo. So, I finished up my work and jumped into a cab. As I arrived, others were leaving.
We still needed to acquire the velcro. A handful of us remained at 18 de Marzo. There were a couple of clients - Raspberry Pi B2s - at the location. The image was placed on the units with the customizations done on site:
- Add shortcuts for 6 applications
- Add Tux Typing (tuxtype) using a phone as a hotspot.
- Change the background
- Change the browser default to the Offline Content Server (pi) Internet in a Box.
This evening, three of us prepared, burned and tested 22 microSD cards for the Acatlima lab. I taught the others to truncate the image. I call this night - the ddfest!
Understanding how to truncate an image is a fairly straightforward process. However, some may not want to truncate the image.
When you dd an image to a raspberry pi, if you set that image to expand and then make edits directly to the image on the pi, the image will expand to the size of the pi.
If you do not set raspi-config to expand, the image will not expand.
If your image is expanded, you can reduce the size of the image. In this case, the image was expanded across a 16 gb microSD card. The image was only 8.3 gb. While this was not sizable, in sharing with others, it seemed more courteous to offer an image that was around 8 gb instead of 16 gb.
Type df -h to determine the correct drive. Take precautions with your local machine by paying attention to which drive. Do NOT dd an image either during or after happy hour, as my friend discovered when he hosed his system!
df -h
There are other commands you can use:
fdisk -l
lsblk
Copy the SD to your local machine. Using dd and the status=progress flag, you can view the copying status while copying.
Use sudo su or switch to superuser to run these commands.
As root:
dd if=/dev/sdX of=imagename.img status=progress
After the image is copied locally, force a sync of any I/O.
As a precaution, use sync.
sync
- Remove the SD card.
- Change ownership of the image.
- The image is owned by root since we copied this as root.
- Change the ownership to your user account.
- Change the group. My username is aicra.
chown aicra.aicra imagename.img
Resize the imageThere are a few reasons to truncate the size. In my case, the image is about 16gb but the actual image is only 8.3gb.
Gparted. If you do not have gparted:
apt-get update && sudo apt-get install gparted
The legacy technique to resize an image is as follows:
Play the image as a device
The image (since this was based on Rasbian) has 2 partitions:
- boot
- root
Partition 2 is where everything else is stored, and typically has lots of free space. Let's have a look at these partitions:
sudo fdisk -l imagename.img
This should show something like:
Device Boot Start End Sectors Size Id Type
raspkids-1.0.img1 8192 93236 85045 41.5M c W95 FAT32 (LBA)
raspkids-1.0.img2 94208 30425087 30330880 14.5G 83 Linux
Note the START sector for the second partition.
In the example, this is 94208.
Keep this number available. We will be using this number. For the loop, I use 7 because I used loop0-loop5 already.
losetup /dev/loop7 imagename.img -o $((START*512))
Replace START with the start sector number of your second partition. In the example: 94208
If the message "device is busy" displays, you may have a previous instance. Try with another loop device number.
Gparted will not read loopback devices. Start gparted with the loopback parameter:
gparted
gparted displays.
+ images gparted
Click loop7 /dev/loop7 and select Partition from the menu.
+partition image
Select Resize/Move.
+ resize/move image
Change the value of "New Size" so that it is slightly above "Minimum Size". I suggest allowing 20MB extra space. Click the Resize/Move button when done.
Now click Edit menu, Apply All Operations. The data will be moved to fit into the new size.
When complete, it will display the new size. Make sure you note down the new size before you exit.
If the size is not displayed, click the triangle icon next to Details, and the triangle icons that appear nested below them, until you can see the new size. Eventually you'll see a line like "resize2fs -p /dev/loop0 1410048K" where the number in K is the new size in kilobytes.
No, really, note down the new size before you exit.
Now remove the loopback device for the second partition, create a new loopback device for the whole image and edit the partition table to reflect the new smaller size:
sudo losetup -d /dev/loop0
sudo losetup /dev/loop0
sudo fdisk /dev/loop0
fdisk is rather basic to use.
- Enter d 2 to delete the table entry for the second partition
- Enter n p 2 to create a new second partition entry
- Enter the START sector number that you used earlier, as the start sector. In my example it was 122880.
- Enter +NEWSIZE as the new size. Don't forget the plus at the start. This is the new size that you noted down before exiting gparted. If your number was in K (kilobytes) or M (megabytes) then type that letter in too (for example +1410048K ).
- Enter w to write the new partition table and exit
You may see a message telling you that the new partition table can't be used until the next reboot - don't worry about this message; it doesn't really apply to the loopback devices which we're creating and destroying.
That's the partition resized, and the partition table updated. Now we can remove the loopback device, then we just need to trim the empty space from the end of the image file. Let's look at the new partition table and then destroy the loopback device:
sudo fdisk -l /dev/loop0
sudo losetup -d /dev/loop0
Note down the END sector of the second partition. In my case this is 8615936. Now let's trim down the file to this length, replacing END with your end sector number:
truncate -s $(((END+1)*512)) imagename.img
And you're done.
Also, you can use dd rather than dcfldd and see progress using the dd flag:
status = progress
This way, you have some idea whether you can trek out to 7/11 or start binge watching some Netflix... or whatever.
For extra marks, you can fill any empty space with zeroes to make it slightly better to compress and a teeny, tiny bit faster to write to in use:
sudo losetup /dev/loop0 imagename.img -o $((START*512))
sudo mkdir -p /mnt/imageroot
sudo mount /dev/loop0 /mnt/imageroot
sudo dcfldd if=/dev/zero of=/mnt/imageroot/zero.txt
sudo rm /mnt/imageroot/zero.txt
sudo umount /mnt/imageroot
sudo rmdir /mnt/imageroot
sudo losetup -d /dev/loop0
If you're keeping the image for backup or archival purposes, you can now compress the file with:
zip imagename.zip imagename.img
...or use tar cvzf or whatever your favourite file compression tool is. Don't forget to uncompress it (for example, unzip or tar xvzf ) before trying to write it to an SD card.
Copying the image to a fresh SD cardOnce you've got your shrunk.img file, you can copy it to another SD card. Insert your blank card, close any popup file manager windows, unmount it and write the image:
sudo umount /dev/sdX1 /dev/sdX2
sudo dcfldd if=imagename.img of=/dev/sdX
sudo sync
Remember to change /dev/sdX, /dev/sX1 and /dev/sdX2 depending where your system mounts your cards. (see df -h or fdisk -l)
When you use the new card for the first time, remember to expand the filesystem to fill the space on the new card. This then requires a reboot. From the Raspberry Pi's terminal, do sudo raspi-config, then select Expand Filesystem. Alternatively you can do this directly from the command line with:
sudo raspi-config --expand-rootfs
sudo shutdown -r now
The kids had a great time!
NextCloud increased efficiency and made meeting the deadline with the best possible product possible! What would we do without you!!!!!! I <3 Nextcloud! https://nextcloud.com/
A
... and so did I!
Live...Love... Linux!
Note:
Now, I am attempting to bring the size down to under 8 gb to offer an out of the box experience that will fit on an 8 gb. However, this may be a moot effort as many stores are moving to selling 16 gb MicroSD cards. 8 gb are available online but not necessarily in brick and mortar stores.
Other schools - if you are interested...
Day 4 - Tuesday, January 23
On this day, we spent a few hours scouting locations. We had a slow start because our main scoutOwho knew the locations and had built relationships needed to get some work done for her job at Amazon. This was not a problem as I understood. Additionally, this allowed me to get my work done! We left at 11:45am with our Taxi Driver - Mr. Breezy. He had called his friend and told his friend it was going to be a Breezy day because we hired him for several hours.
School 1: This school suffered Earthquake damage. Avni, Addi and Camilla spoke with the staff as I took advantage of the snack bar! I really just wanted gum. The girls wanted to speak English with me and I made a few new friends this day!
The computer in this location were boxed up with some old typewriters.
HP provided tablets are used in this school... which could use an Engilsh teacher - if anyone is interested.
18 de Marzo
Comments