Archive for the ‘How-To’ Category

How-To Fix: “regenerate_ssh_host_keys …failed” on Raspbian for RaspberryPi

Tuesday, September 11th, 2012
Listen to me!
Audio MP3

download mp3
During your RPi boot it may happen that you get an error message like, “regenerate_ssh_host_keys …failed”, such error is generally sign that you SSH service won’t start.

That issue showed to me during the second boot of Raspbian on my new RsberryPi Revision B, due to the fact that during the previous session I did forcibly quit the raspi-config configuration tool exactly after issuing the command to enable the SSH server.

That caused the configuration process not to run the one-time operation of generating the ssh host keys necessary to run the sshd daemon. If fact, at the second reboot of Raspbian the script /etc/init.d/regenerate_ssh_host_keys (sim-linked by /etc/rc2.d/S01regenerate_ssh+host_keys), was  deleted as scheduled, but failed to start the SSH server because there were not the ssh keys supposed to be generated at the previous session.

The solution to the problem consists in manually generate the SSH keys and start the SSH server, executing the following commands:

~$ sudo ssh-keygen -t 'rsa' -f /etc/ssh/ssh_host_rsa_key
~$ sudo ssh-keygen -t 'dsa' -f /etc/ssh/ssh_host_dsa_key
~$ sudo ssh-keygen -t 'ecdsa' -f /etc/ssh/ssh_host_ecdsa_key

If requested for a password during the generation of these keys it’s advisable to leave it blank (empty) as they are ‘host’ keys and not personal keys.
Also confirm that you want to overwrite possible pre-existing keys that could be a partial leftover of the previously aborted generation process.

Please feel free to leave any comment and amend.

How-To Fix a Bricked OS X Lion System After Thunderbolt Software Update Causes Boot Failure?

Thursday, June 14th, 2012
Listen to me!
Audio MP3

download mp3
Following the WWDC 2012 Apple has released some new system and applications updates for OS X Lion 10.7; one of them is an update for the Thunderbolt port, and unfortunately brings with it a serious bug that may badly corrupt your system generating a Kernel Panic as soon as it start loading the system.

As reported on many tech blogs (like iClarified http://www.iclarified.com/entry/index.php?enid=22556) many users after the update have not been able to re-boot their systems properly reporting Kernel panics, or simply unable to go further the boot menu. Basically the system got stuck, or more precisely BRICKED!

If you possess a MacBook Pro or MacBook Air purchased during the year 2011 or later or in any case if your Mac has a Thunderbolt port, it is advisable not to install the Thunderbolt Software Update for now, hopefully Apple will release a newer and safer update.

In case you have installed the update and your system is bricked reinstalling the whole system is NOT the only solution to fix the problem.

If you have the luck to have a second Mac computer with a firewire port, you can follow the following steps to ripristine your system with a minimal effort:

  1. Start the bricked Mac into TARGET MODE (pressing ‘T’ before the start-up chime).
  2. On a spare Mac, download from Apple website the latest Combo System Update for Lion 10.7.4.
  3. Run the Combo System Update installation and specifying as target the mounted volume of the bricked Mac. <== VERY IMPORTANT

That will fix the installation of unfortunate Mac

Side Effects: Reinstalling the Combo System Update for Lion 10.7.4. will over-write all the Apple updates released after the 9th of May 2012 and you will have to re-run the Software Update application to reinstall them (don’t forget to skip the Thunderbolt Software Update)

I hope this has been helpful for many of you as much as it has been for me.

How-To Redirect PATHINFO (Almost Pretty) Permalinks To Pretty Permalinks

Wednesday, March 21st, 2012

This post is about supporting your former PATHINFO Permalinks structure (a.k.a. Almost-Pretty-Permalinks), on your new web-site using Pretty-Permalinks.

 Redirect 301 /index.php/ http://www.yoursite.com/
 RewriteRule . /index.php [L]

These are the lines of Apache’s configuration that must be present in the website’s main .htaccess file:

 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 Redirect 301 /index.php/ http://www.yoursite.com/
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>

This case applies to those websites formerly configured to use PATHINFO Permalinks and for which all the old posts and pages have been indexed by the Web Search Engines (Google, Yahoo, Bing, etc) using the former structure that included the HORRIBLE! “/index.php” string in their URIs, i.e.:

https://www.marcomc.com/index.php/tech/

When these sites finally migrate to the Pretty-Permaling structure, the one that does NOT include the  horrifying “/index.php” piece, i.e.:

https://www.marcomc.com/tech/

it happens that all the search engines’ indexes will result suddently outdated, and that will penalise the sites at least in two ways:

  1. It will cause a loss of accesses because the back-links to the sites that are present on other blogs or in people’s favourites and bookmarks, or in the search engines’ indexes will be ‘broken’ (old) and the people will be unable to access the pages or posts unless browsing from the homepage.
  2. It will cause a loss of ranking in the search engines’ databases (S.E.O. perspective) because the sites will result ‘broken (unaccessible) and in some cases may even result like sites with duplicated content because the search engines’ spiders will index the pages as NEW pages (due to their new URIs) and the content will match the caches indexed with the old URIs (at least until the caches expire).

To prevent such mayhem you need to put in place a 301 (permanent) redirection that will tell the search engines that all the requests to URIs containing the ‘/index.php’ bit have to redirected to similar URIs not containing it, i.e.:

Redirect 301 /index.php/ https://www.marcomc.com/

This string gives instructions to the web server about what to communicate to the Search Engines when a PATHINFO request is received.

Most importantly the 301 redirection will instruct the search engines that the URIs containing “/index.php” have to be considered deprecated and that from now on, the site will not use it anymore. This is fundamental to avoid the search engines to consider the content of the site as a duplicated content.

Secondly you will need to put in place also a generic rewrite instruction that will tell the local web server (Apache) to accept all the incoming requests to URIs with a PATHINFO format and return the content of the new and purged URIs:

RewriteRule . /index.php [L]

This string gives instructions to the web server on what it must to do when a PATHINFO request is received.

I did use these redirection settings for my WordPress blog when I did migrate to a full L.A.M.P. server (GNU/Linux, Apache, MySQL, PHP) from the former Windows Server hosting service running Microsoft IIS and that did not support ‘.htaccess’ files but exclusively PATHINFO directives and for which I did not have access to the server’s core configurations, therefore I was forced to use “/index.php” in my permalinks.

If you did like this post leave a comment in sign of appreciation, ad if you are Facebook please consider to ‘Like’ MarcoMC.com page. Check the FB banner on the right widgets column of this page …     ========================================>>

I did take inspiration for this post at following this thread:

http://www.wptavern.com/forum/troubleshooting/489-mod_rewrite-make-pretty-permalinks-prettier.html

How-To Send A Command In Background And Keep It Running using ‘nohup’

Tuesday, March 20th, 2012

The shell command ‘nohup‘ in combination with ‘&‘ will allow to send the a command-line instruction in background enabling the process to keep running after the user who issues the command has logged out.

A common use of ‘nohup’ is when you need to issue a remote command via ssh connection and then you need to close the connection but be sure that the issued command will keep running in background, i.e.:

~$ sudo nohup shutdown -r -h 1203192100

I use this ‘trick’ when I want to restart my Mac and GNU/Linux Servers during evening/night hours but I want to submit the command during my office time.
In such way I save myself the time to remotely connect from home.

The ‘nohup’ command is even used to run processes in background as daemons.

nohup is a POSIX command to ignore the HUP (hangup) signal
(cit. from Wikipedia)


HOW-TO Disable the Character Accent Menu and Enable Key Repeat in Mac OS X Lion

Friday, March 2nd, 2012

Disable Character Accent Menu
To disable the press and hold accented character picker you need to digit the following commad in a Terminal window:

$ defaults write -g ApplePressAndHoldEnabled -bool false

After that you will have to Log Out and then Log In again. Or just restart the Mac.

If you want to re-enable the functionality, you need to digit

$ defaults write -g ApplePressAndHoldEnabled -bool true

the Log Out and Log In again.

How-To Fix “Some of your photos were not copied to the iPad, iPhone, iPod because they cannot be displayed on your iPad, iPhone, iPod”

Thursday, November 24th, 2011

It happens, fortunately not so frequently, that during the Photo synchronisation of my iDevices via iTunes I get an error about the copy of my pictures to my iPad or iPhone:

"Some of your photos, including the photo "IMX_xxxx",
were not copied to the ixxx because they cannot be displayed on your ixxx."

I notice that this problem comes out usually after an update or upgrade of Aperture, and having a look around the web it is not a problem isolated to Aperture but it also shows up when you use iPhoto and in rare cases also when you sync your pictures directly from the Pictures folder of your account.

The only solution that worked for me in the time and in different Macs has been to force a complete regeneration of the iPod Photo Cache (se References at the bottom).
According to what software, if any, you use to manage your pictures, you will need to remove the following folders:

  • If you synchronise from the Pictures folder:
    /Users/<username>/Pictures/iPod Photo Cache
  • If you synchronise from the Aperture Library:
    • From the Finder navigate to the Picture folder.
    • Select the Aperture Library archive.
    • Right Click on it and choose Show Package Contents.
    • delete the iPod Photo Cache folder
  • If you synchronise from the iPhoto Library:
    • From the Finder navigate to the Picture folder.
    • Select the iPhoto Library archive.
    • Right Click on it and choose Show Package Contents.
    • delete the iPod Photo Cache folder

This operation will force iTunes to analyse the entire pictures archive and to generate all new copies of the pictures suitable for your iDevice.

In a few occasions I also found useful to proceed the  Rebuild Aperture Database procedure that will force Aperture to reanalyse all the masters of you photo library and regenerate all the preview and thumbnails.

To rebuild the aperture database you need to start Aperture holding the key combination of “Alt+Command” and then confirm the operation, that could take a very long time depending on the dimension of your pictures library.

Hope that this will help you.

 

References:

iTunes: Understanding the iPod Photo Cache folder

MacRumors 

 

 

How-To Set Up a Continuos Synchronization on The Background With Windows 7 and The Group Policy Editor

Saturday, September 3rd, 2011

Using the Offline Files in Windows Vista or Windows 7 is not always a smooth process and can cause a lot of Offline Folders And Files Synchronization Errors.

Offline Files synchronization errors

Offline Files synchronization errors

I found the latest generation of Windows to be very sensitive in the process to keep synchronized the Offline Files and folders copy with the  remote share.

Depending on the quality of the network you rely or the quality of the link to the share the Windows 7 (or VISTA) clients may think that the share is temporarily unavailable and stop synchronizing the Offline Folder while leaving temporary files on the server.
That may confuse some applications, especially Microsoft Office making them believing that a file you just edited and closed is still opened by another application and will refuse to open such file again.

I.E.. I have a very unadvisable configuration where a Linux server is providing an NFS share to a Mac OS X Snow Leopard server, and that server is then re-sharing via SMB and AFP that share to Windows and Mac OS X clients. I have experienced problem with Windows Clients stopping to synchronize files without any reasonable motivation.

I understood that because of an obvious delay on the communication from the Windows client through the Mac OS X server (via SMB)  to the Linux server (via NFS) would make the Windows client believe that the share was offline with many unconfortable conseguences.

I have found a workaround to this problem playing a little with the Windows’s Group Policy Editor.

As I don’t have a Windows Domain in place I couldn’t generate a policy file to be pushed once for all to all the clients so I had to manually start and configure the Group Policy Editor on each single Window VISTA and Windows 7 machine.

This is how to set up a continuos synchronization on the background with the Local Group Policy Editor:

  1. Start the Local Group Policy Editor

    Launch The Local Group Policy Editor

    Launch The Local Group Policy Editor

  2. Expand the Computer Configuration policies to ‘Network -> Offline Files’
    Group Policy Editor

    Group Policy Editor

    Slow Link Speed

    Slow Link Speed

  3. Access the ‘Configure Backgraund Sync’ option to enable the background sync

    Configure Background Sync

    Configure Background Sync

  4. Activate the ‘Enable Transparent Caching’ option

    Enable Transparent Caching

    Enable Transparent Caching

  5. Access the ‘Configure slow-link mode’ option to enable the support for slow-link networks

    Slow Link Mode

    Slow Link Mode

  6. Access the ‘Configure slow-link speed’ to configure the latency level to detect weather the connection get slow.
    Follow the suggestions shown in the LGPE to calculate the appropriate value.

    Configure Slow Link Speed

    Configure Slow Link Speed

These settings should avoid many of your problems and so far they did not create any additional issue.

Please comment and post your experience about any problems with the use of Offline Files and Folders.

How-To fix pGina: “Warning: Current plugin selected could not be loaded!”

Thursday, September 1st, 2011

After installing pGina and the chosen plugins (i.e. LDAP Auth, LDAP Group, RADIUS) on Windows Vista or Windows 7, it may happen that trying to access the plugin configuration it results in an error loading the plugin with the following error message being returned:

"Warning: Current plugin selected could nor be loaded!
You may not be able to login using pGina!"
Warning: current plugin selected could not be loaded

Warning: current plugin selected could not be loaded

The most common reasons for such error are:

 

  1. The installed plugin is for a different architecture:According to your system you must choose to install the x86 (32 bits) or
    x64 (64 bits) version of the plugin.
    Some plugin may be released on a single version but this doesn’t imply that it will work for both the architectures.
  2. Otherwise it most probably happens the you are missing the installation of the Visual C++ 9.0 (2008) runtime libraries (VC90.CRT 2008):In this case you need simply to download the Microsoft Installer package from Microsoft’s site at

    x86: http://www.microsoft.com/download/en/details.aspx?id=5582
    x64: http://www.microsoft.com/download/en/details.aspx?id=2092

Applying one of these two fixes you should have resolved your problems otherwise you may consider to check the file permissions on the plugin files.

 

How-To legally unlock the iPhone 4 permanently

Wednesday, July 20th, 2011
Listen to me!
Audio MP3

download mp3
I recently found a company called FoneFunShop that unlock many models of mobile phones and 3G dongles. Among these it also unlocks iPhone 4 from all the countries for £50.00 and iPhone4S for £130.00.

This is the link to their unlock page: www.fonefunshop.co.uk/unlock/

My iPhone 4 was operator locked with Vodafone UK, and that was representing a problem as I am planning to go for a month travel to Australia this coming winter and I want to travel minimal without taking with me many stuff and I want to enjoy the use of a smartphone during the travel without the need to buy a new one or without having to pay Vodafone’s  excessive roaming costs.

I started looking for a way to unlock my iPhone 4 that would not be software related because the modem baseband of my iPhone 4 is 02.10.04 and the iPhone Dev-Team (or any other iPhone hacker) has not yet released an unlock for such version.

I searched for chips to pose behind the SIM card to trick the phone’s firmware but I already had experience with some of them and they are not very reliable.

I had a look at a couple of websites claiming to be able to permanently unlock any iPhone including the iPhone 4 (for a quite high amount of money).
I was  worried about those sites being scam or not.
At the end I took my chances with FoneFunShop.com and I paid £50.00.

For 7 days I’ve been worrying that money were gone ‘trash’; finally today I received the notification of the successful unlock: I can confirm that the instruction they give for the unlock are simple and accurate and that in exactly 7 days they are able to add the IMEI of your phone and the ‘white list’ of unlocked phones so that Apple will recognize it via iTunes.

They actually talk about an unlock code, but for the iPhone there will not be a code, it simply will be recognized by iTunes as unlocked just after you receive the unlock confirmation message from the sales department of FonFunShop.

Here is the message that I received, I followed the few instruction and the trick was done. I’ve been immediately able use my O2 micro-Sim  on my Vodafone’s iPhone 4.

Hi Marco ,

Your unlocking request has now been completed and the unlocking code(s) can be found below:
Make:
Apple
Model:
IPhone 4 16gb
Country:
United Kingdom
Network:
Vodafone
IMEI:
012419*********
Code(s):
Unlocked
IMPORTANT:
Please read ALL of the instructions below as there maybe some important information relating to your phone or scenario. 

PLEASE NOTE:
When entering a code, please take your time.
If you enter a code and you receive an error message, DO NOT try again, please contact us via the links below?
But please check first to make sure the phone isn't actually unlocked.
Some models of phone will have a limit on the number of times you can enter a code. After this we may not be able to help you.

Instructions:

How to Complete the unlocking process for Apple iPhone Models
Generic Apple iPhone Method
When ready, you will be notified by email that the process has completed. When you receive this email, to complete the unlock please do the following: 

1. Install the latest version of iTunes
2. Make sure iPhone is using the latest version, updated by the official itunes software
3. Insert a non accepted SIM card and Connect the iPhone to iTunes (IE not from the original network provider)
4. Wait until itunes detects the phone
5. After about 10-20 seconds, disconnect phone and reconnect.
6. Finally itunes will show the message 'Congratulations Your iPhone is Unlocked'

PLEASE NOTE: This is the only permanent unlocking solution for Apple iPhone. Your iPhone will always be unlocked even after updating your iPhone firmware.

This doesn’t want to be an advertisement but a sincere advice to everybody that is desperate to have an iPhone 4 unlocked and cannot obtain it from their operator because the terms of their contract are not yet expired.

If I had found this information months ago I would have saved same money with a cheaper operator than Vodafone (but this is another story…).

By The Way, please mind that I will not be responsible of any incident that those guy may cause to your phone or to your money if you try to unlock your phone with them.

I can just say that for me it worked like a charm, exactly as described on the their website.

Any feedback will be appreciated! Happy Unlock!

 

 

 

 

How-To Install or Update Mac OS X Snow Leopard 10.6.7 on the Asus Eee PC 1005HA Netbook

Wednesday, March 23rd, 2011

Few days ago Apple released the latest update for Mac OS X Snow Leopard 10.6.7 .
Here is the tutorial on how to install or update Mac OS X Snow Leopard 10.6.7 on the Asus Eee PC 1005HA Netbook.

Prerequisites

Yes, you have no alluciantions: the legacy kernel we gonna use is the same prepared for Mac OS X 10.6.6, I tried and it works fine with 10.6.7 on the Asus EeePC 1005HA. I don’t know if it works on other hackintosh systems and netbooks. Please comment about your experience.

Step 1

Follow the instruction of my previous post:

How-To install Mac OS X Snow Leopard 10.6.6 on the Asus Eee PC 1005HA Netbook

following that how-to you can skip the part that let you update from Mac OS X 10.6.0 to Mac OS X 10.6.6 an substituite it with the following content of Step 2.

Step 2 (Upgrade to Mac OS X Snow Leopard 10.6.7)

  1. Copy MacOSXUpdCombo10.6.7.dmg in the USB stick.
  2. Uncompress legacy_kernel-Mac_OS_X_10.6.6.tgz and to legacy_kernel-Mac_OS_X_10.6.6.pkg and copy it on the USB stick.
  3. Insert the USB Stick on the Netbook then mount and run the MacOSXUpdCombo10.6.6.dmg.
  4. When the installation is finished it will ask to restart:
    DO NOT RESTART THE SYSTEM YET!!
  5. Install ‘legacy_kernel-Mac_OS_X_10.6.6.pkg’.
    This install an older version of the kernel that is still compatible with the unficcial extensions we previously installed before the upgrade.
  6. Again, substitute the Extensions for the misbehaving devices:
    1. Copy ‘SleepEnabler.kext’ to ‘/Extra/Extensions/’.
      This fix the hibernation/sleep feature.
    2. Copy again ‘~/Desktop/SnowLeopardAsus/Extra/IO80211Family.kext’ to ‘/Extra/Extensions/’ folder.
      This makes the system to recognize and install the Wi-Fi card.
    3. Copy again ‘~/Desktop/SnowLeopardAsus/Kext/AppleIntelGMA950.kext’ to ‘/System/Library/Extensions/’.
    1. Copy again ‘~/Desktop/SnowLeopardAsus/Kext/AppleIntelIntegratedFramebuffer.kext’ to ‘/System/Library/Extensions/’.
      This fixes the video card and add the option to choose 1024×600 resolution.
  7. Now, most important, fire the command ‘fixkext’ with root privileges or using sudo:
    $ sudo fixkext
  8. VERY IMPORTANT: Run Disk Utility and Repair Disk Permisions
    Without this operation your system will reveal really unstable!!!
  9. Now you can reboot the system

Now go back to:

How-To install Mac OS X Snow Leopard 10.6.6 on the Asus Eee PC 1005HA Netbook

and read the last two sections: What still doesn’t work and Last Adjustments