How to install Debian 9 on Macbook 13″ (end 2009)

Here how i installed Debian 9 stretch on my old macbook 6,1 (mid 2009)
NB: where you’ll see a # before command, means you should be root or need to use sudo.

Hardware:
Video card NVIDIA  GeForce 9400M with 256 MB of SDRAM shared with main memory
Screen size 13″
Wireless card Broadcom BCM4360
Disk 256 Gb Serial ATA (5400 RPM) hard drive
Ram 8 gb SODIMM 1600MHz
Wi-fi controller Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)
Ethernet controller NVIDIA Corporation MCP79 Ethernet (rev b1)
USB 2.0 ports (2x)
Audio in/out port NVIDIA Corporation MCP79 High Definition Audio (rev b1)
Mini DisplayPort that supports an external display at 2560×1600

Procedure :
1)From mac OS , using utility disk, i resized Osx partition freeing up space for Linux ( i did not format this empty space)
2) i ‘ve downloaded a debian image (i used netinst ) and put in a usb pen (i used unetbootin)
3) i have connected wired cable (wi-fi will not work at first time)
4) inserted usb pen, turned on mac holding down the Option key while booting
5) I have installed Debian – i formatted free space as ext4,  i choose Mate as display manager, because is light (Kde would have been unfeasible)- LightDM was selected automatically as login manager.
After reboot, MBR will be overwritten by Grub, so only Debian will start (for now)

Fix Reboot
Shutdown, suspend and hibernate all work out of the box. For reboots, a modification should be made.
# /nano/etc/default/grub
adding  “reboot=pci” in GRUB_CMDLINE_LINUX DEFAULT row
if e.g. you have
GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”
will become GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash reboot=pci
Now, on the terminal run sudo update-grub, shutdown macbook and power it on again.
Reboot should works at the end.

Refind Bootloader installation
Since i have Mac Osx in the other partition, i need to install Refind boot manager, that will allow to choose between Debian/Mac during system startup, therefore :
# apt-get install refind
After installation, at startup time you will have in addition to Mac, 2 (?) Debian icons, each of which respectivaly run initrd (initial ramdisk) and vmlinuz (kernel).
Leaving aside initrd/vmlinuz explanation, (is not the scope of this post) , important thing to know is that if we will boot using initrd we’ll use Grub, while if we will boot choosing kernel we’ll not use Grub
/boot/initrd.img-4.9.0.3-amd64 –> start with grub
/boot/vmlinuz-4.9.03-amd64 –> start without grub
Since as i described in Grub section, reboot works thanks to grub modification (reboot=pci); therefore clearly we need to start image that uses grub (unless you want to reboot the macbook by turning it off and then turning it back on with the button 🙂
Only option is to use initrd.img, so we have to modify refind configuration in order to hide vmlinux image in refind startup menu:
# nano /boot/efi/EFI/refind/refind.conf
and we add:
dont_scan_files vmlinuz-4.9.0-3-amd64
scan_all_linux_kernels false
Save and Exit.

Video drivers
I don’t like nouveau driver:basically, in my opinion Nvidia drivers working better, so i don’t see any reason to not use them; furthermore, i needed to have possibility to work also with an external monitor and this is perfectly working using nvidia drivers
Therefore i installed nvidia-drivers (340) and  nvidia-settings (optional but strongly suggested)
# apt-get install nvidia-legacy-340xx-driver nvidia-settings-legacy-340xx
Nvidia-settings-legacy is a GUI with all settings, useful especially if you need to use an external monitor (but not only, as you can see later).
After reboot you will see nvidia logo before login-manager (obviously you can remove it).
NB i tried to install drivers with version > 340 but did’nt work out , so don’t waste your time:-)

Wi-fi
At first boot,Wi-fi will be not recognized
we have to install broadcom drivers
# apt-get install linux-image-$(uname -r|sed ‘s,[^-]*-[^-]*-,,’) linux-headers-$(uname -r|sed ‘s,[^-]*-[^-]*-,,’) broadcom-sta-dkms
let’s avoid that other wifi modules would be in conflict with my broadcoam
# modprobe -r b44 b43 b43legacy ssb brcmsmac bcma
now  we add our wl module
# modprobe wl
at reboot you should have your working Wi-fi.

Audio
Work out of the box, Nvidia audio card was recognizes, however checking alsamixer*configurations i noticed that pulseaudio was present as additional sound card, so i decided to remove it
# apt-get remove pulseaudio
After reboot , default card will be HDA Nvidia

Headphone as default are set to zero volume; with alsamixer you can active them (headphone section)
*i strongly suggest to install alsamixer and alsamixer-gui

Isight (webcam)
Work out of the box     make a first check doing (being root) dmesg | grep iSight 

to see cam in action you can also install cheese, and guvcview to change settings.
# apt-get install cheese guvcview

Optional ( isight-firmware-tools)
this part is optional (if cam works, skip this part)
i installed isight-firmware-tool
I wanted to try isight-firmware tool extracting original firmware directly from Mac Osx partition : In order to avoid boring useless permission problems, instead to specify Mac Osx path in tool i prefered to copy in advance the file AppleUSBVideoSupport from Mac Osx partition to my Desktop , so path was /home/fafa/Scrivania/AppleUSBVideoSupport
Then i have execute command:
root@MacDebian:/home/fafa/Scrivania#
ift-extract -a /home/fafa/Scrivania/AppleUSBVideoSupport
As result:
** Message: Found firmware signature at offset 0x1998.
** Message: Firmware extracted successfully in /lib/firmware/isight.fw
………………………………………….
** Message: Firmware patched successfully
Now, looking in /lib/firmware you can see isight.fw
I must say i did’nt notice any difference after installation of this firmware, so if your webcam will immediatly works , you can avoid to install isight-firmware-tools

NB: Scrivania is Desktop in italian language :-).

f1-f2  buttons( backlights)
At beginning will not work, i fixed problem adding in /etc/X11/xorg.conf following row, under Device section
Option “RegistryDwords” “EnableBrightnessControl=1”

if xorg.conf is not present, you can easily edit/save it trough nvidia-settings tool:
Go to Server Display Configuration , then on the bottom right corner clickbutton “save toX configuration file” , before save, click “show preview” and addOption “RegistryDwords” “EnableBrightnessControl=1” under Device section
After reboot , f1-f2 should work – in order to preserve backlight level after reboot, i strongly suggest to add string in grub
# /nano/etc/default/grub
then in GRUB_CMDLINE_LINUX_DEFAULT section i added
acpi_backlight=vendor
so (if you followed my previous suggestion ) will have situation below

NB: i have also removed from grub “quiet-splash ” cause i like to see loading services (of course you can leave it.

f10-f12 buttons (sound level regulation )
Work out of the box.

Bluetooth
It seems working; i wrote “seems” because i did not tested it with other bluetooth devices.
as default is enabled, to disable it:
nano /etc/bluetooth/main.conf
Then look for a row named Initially powered =true and replace “true” with “false”
Save, exit and reboot: Afterthat Bt should be off.

Final result 
(click image below for enlarge)
Debian 9 stretch + Mate+Docky on macbook 6.1

Posted in Gnu-Linux, Mac Os | Leave a comment

Linux boot speed-up removing slow/useless services

Today, after upgrade to Debian Stretch i was looking startup loaded services and system boot-up performances through systemd-analyze* command.

Looking results , excluding kernel time(4,5 sec), system took 1 minute and 42 seconds for start; OK , i don’t have an SSD, there are a lot of services like tor, virtualbox , Plasma,etc but boot time seems really too long.
This situation deserves a more detailed check, so i executed systemd-analyze blame* for understand if there is a particular slow service or if there are just so many

As you can see , outcome show that racoon.service takes 1minute and 32 secs to start.. this service (ipsec) for my needs it is useless. Therefore i typed (with sudo, or being root) Systemctl disable racoon.service

Afterthat, i restarted system and i typed again command System-analyze to see results:

Nice, we cut 1 minute and 17 seconds ; from 1 minute and 47 sec to .. 30 seconds 🙂
Probably this is a not-standard case, but with this example you can easily understand how even a single service can affect startup time.
In general,  making a check  to verify and identify which services taking time (and especially if are necessary for our needs)  it is something that ,as in this case, is really useful

*Despite my screenshots, you can execute systemd-analyze and systemd-analyze blame whitout root privileges.

Posted in Gnu-Linux | Leave a comment

Mamp: a local web server (and not only) with few clicks

I needed a local web server for make some .php experiments whitout transfer data to my website and make them in remote.

I did not have time for install and configure Apache and Php so i was looking for something already configured ready to go application working with few clicks: MAMP
where:
Mac OS X :operating syste, Apache as web server , MySQL – database management system; while P is for  PHP, Python or Perl, (applications web developement languages)

MAMP is basically the equivalent of LAMP platform on Linux servers
Installation is very trivial, at the end will have:
, choose MAMP and click mamp
Once opened, it is enough to click on start icon  startmamp and everything will start.
mampconsole_mini

From here prefmamps  it is possible to change Mamp settings :

Start/stop section:
You can choose if automatically start  server when you’ll start Mamp, if open web start page, if stop service when you’ll quit Mamp
startstopmamp

Sezione Ports:

You can modify port number: default port are:Apache : 8888 – Nginx : 7888- MySQL : 8889, but nothing prevents for example to use classic port 80 for Apache (unless it is already used from other service in your machine.
portsettingsmamp
Therefore your website will have this address: http://localhost:8888, clearly if you want use port 80, address will be http://localhost

Php Section
You can choose which Php version to be used
phpmamp
Urls
phpInfo
: http://localhost:8888/MAMP/index.php?language=English&page=phpinfo
phpMyAdmin : http://localhost:8888/phpMyAdmin/?lang=en

Web Server section:
You can choose between Apace and Nginx and you can modify root folder (where you have to put your website)
webservermamp

Sezione MySql:
Show Mysql current version
mysqlmamps

Posted in Tech news - tutorials | Leave a comment

FM16 coaching star calculator

Game time 🙂

I often play  at FM16 and i lost so much time looking for the best technical staff (4/5 stars)
Recently I found somewhere nice formulas to calculate, using the parameters, the number of “stars” and therefore, quality of coaching.
Since I did not want to calculate by hand and even with the calculator i created an excel file to calculate all conveniently.
Then, in the game you can choose coach to check, and insert its parameters in the file; in this way you will know the number of stars for each category of training, of course you can enter all the parameters or only those that interest you.
fm16eng
You can download it – there are 2 version, italian and english
FM16 Coach calculator

 

Posted in Games | Leave a comment