OpenCPN-low-energy/Building a distribution
Our SUSE Studio personal page where you can find all our public appliances.
The login manager epic
For this distribution we needed a very lightweight base, in order to do that we choose the openbox desktop environment. Currently, we have two branches for the login manager, we firstly used XDM, but we had many configuration problems. Then, we try out SLIM and we faced other problems. Finally, Thibaud used lightDM and Thibault used XDM, both versions are working. We also add some programs that allows a user without much IT knowledge to use this distribution right away. To enhance the user experience, we have set up a wallpaper and a basic theme for windows and icons.
After we fixed many nasty bugs with logins managers, we receive a slightly different guideline for the distribution : it must be easy to use for anyone. So, we decided to use a LXDE desktop environment, it's complete, easy to use and light. After customization of wallpapers and themes by default we reached a perfectly stable version. Everything work as we intent to but no energy saving enhancements are implemented yet.
Leads to save energy
- Profiles for energy (with pm-profiler and xfce power management)
- Reduce CPU frequency(with cpupower)
- Stop several CPUs
- Stop the hard disk drive when it can be
- Reduce the screen brightness
The installer issues
Like our distribution need to consume as few power as possible, we needed to take advantage of all the computer's capabilities. And the only way to do that is to install the distribution on the hard drive.
To install your distribution on your hard drive you need the yast2-live-installer package. You can also add the yast2_install_wf pattern.
The on boot script way
SUSE Studio allows us to run a script each time the distribution starts, in this script there is the possibility to run your own code at the first boot. So we tried out to execute /sbin/yast2 live-installer in here, like it doesn't shows us the installer, we dig around and we found that the condition :
if [ -f /etc/init.d/suse_studio_firstboot ]
was always false because the suse_studio_firstboot script delete itself before our custom boot script run.
The on first boot script way
Like we can't execute our own commands in the previous script, we thought that a good idea will be to insert our commands in the suse_studio_firstboot script. So we managed to insert our own lines of code the first boot script. This is the code we inserted in the /etc/init.d/suse_studio_firstboot file :
yast2 live-installer echo "Press a key to reboot the system, don't forget to remove your installation media." read reboot
We faced another problem, the distribution rebooted in a loop, which isn't expected with the code below because the read instruction waits for an input before reboot.
The solutions above takes advantages of automatic executions. Like our experiments weren't conclusive, we tried a different approach.
The shortcut way
This solutions isn't executed by the system itself but need user's interaction, this way we have a live CD iso file that acts like a real live CD with the advantage to be installed. So we created a file install.desktop :
[Desktop Entry] X-SuSE-translate=true GenericName=Install the system on hard drive Type=Application Categories=Settings;System;X-SuSE-Core-System;X-SuSE-ControlCenter-System; Name=Install on hard drive Icon=yast GenericName=Install Exec=/usr/bin/xdg-su -c '/sbin/yast2 live-installer' Encoding=UTF-8 Comment=Install the system on hard drive
This create an icon on the desktop :
At this point the live installer launched correctly but crashes after a while with the following output :
terminate called after throwing an instance of 'std::runtime_error' what(): locale::facet::_S_create_c_locale name not valid YaST got signal 6 at YCP file String.ycp:191 /sbin/yast2: line 431: 6415 Aborted $ybindir/y2base $module "$@" "$SELECTED_GUI" $Y2_GEOMETRY $Y2UI_ARGS
We get over this problem by changing the default language from POSIX to English (US) in the configuration tab of SUSE Studio. This triggers an alert window at the time you select your language (first boot) saying the system can't read preferences.
End of the installer story
At this point we have a perfectly working live installer (with the shortcut trick). This concerns version 0.1.2 and latests of our distribution. Sadly, yast doesn't delete the "tux" user. After some searches we found a way to execute a script of ours right after the installation, yast will execute the script file /usr/bin/correct_live_install at the end of the installation. You can fin the script here. It took care to remove the tux live user if another user have been created during the installation process. If the user choose to create a tux user, we upgrade his home folder and delete the install icon.
Measures
We took some measurements to see if our distribution is going "the right way" for power consumption.
You can see that our distribution consume a little bit less than Thibault's laptop. The compared measures are run for 2 minutes straight with only the system working (and Virtualhub needed to measure) in a graphic session. No modifications of the OS have been done. You can find the raw results here.
We have also run powertop in order to determine what process consumed what. You can find the whole powertop report here.
Files
You can find the file we used for the distribution here.
Change of measure method
When the influence of VirtualHub starts to have an impact on our results we choose to change the measure method.