There are a couple of things you can do that help when connecting to unresponsive networks.
First, increase your retry from a conservative 7 up to somewhere between 10 or 14. Run the following command in a terminal. Assuming your wireless device is wlan0:
sudo iwconfig wlan0 retry 12
or for wlan1:
sudo iwconfig wlan1 retry 12
Then refresh network-manager:
sudo service network-manager restart
Next, make sure you have ports 67 and 68 open for DHCP traffic and ports 52 and 53 for DNS. There are many ways to accomplish this. For testing purposes, you can disable the firewall using the following command:
sudo ufw disable
You can use ufw to open these ports. See:
man ufw
Another option is to use the user friendly gui version of ufw, gufw.
To install:
sudo apt-get update
sudo apt-get install gufw
gufw
is pretty straightforward.
EDIT:
Finally, you may be experiencing some restrictions set by the most restrictive world regulatory domain default Ubuntu has set by default. Please be aware that using the wrong regulatory code may result in fines or punishment so only use the proper code that corresponds to the country or nation the computer is currently bieng used in and if you leave the country, you MUST change the code accordingly or use the default world regulatory domain instead which is legal and valid in all nations and countries.
For use inside Brazil ONLY!! execute the following command to apply local wireless restrictions:
sudo iw reg set BR
To make this setting permanent, you can set the regulatory domain in your /etc/default/crda file by running the following command. Again, this is for Brazil ONLY:
sudo sed -i 's/REGDOMAIN=/REGDOMAIN=BR/g' /etc/default/crda
Finally, if you ever leave the country and need to change this back to the default world regulatory domain, run the following command and then reboot:
sudo sed -i 's/REGDOMAIN=BR/REGDOMAIN=/g' /etc/default/crda
Click here for a list of codes used for other countries (US, for example, is used for United States).