Author Topic: Ubuntu 10.04 trouble  (Read 1735 times)

0 Members and 1 Guest are viewing this topic.

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Ubuntu 10.04 trouble
« on: October 05, 2012, 08:14:21 pm »
After an update earlier today something went wrong with the Python installation. I saw that in the update manager window there was some python 2.6 updates. This hasn't happened before.
My main issue is that WICD network manager is not working, because Python cannot import urandom.
Code: [Select]
kulverstukas@kulvertop:~$ wicd
Traceback (most recent call last):
  File "/usr/share/wicd/daemon/wicd-daemon.py", line 57, in <module>
    from wicd import networking
  File "/usr/lib/pymodules/python2.6/wicd/networking.py", line 53, in <module>
    import misc
  File "/usr/lib/pymodules/python2.6/wicd/misc.py", line 35, in <module>
    from pipes import quote
  File "/usr/lib/python2.6/pipes.py", line 64, in <module>
    import tempfile
  File "/usr/lib/python2.6/tempfile.py", line 34, in <module>
    from random import Random as _Random
  File "/usr/lib/python2.6/random.py", line 47, in <module>
ImportError: cannot import name urandom

This is easily solvable as I saw many times on google with a tool called virtualenv by creating a new virtual environment (whatever that is...), but I don't seem to have that tool installed for some reason, and I cannot install it because my network manager does not start (no wireless or wired connection).

So question: how do I fix this issue with or without virtualenv...?

Offline s3my0n

  • Knight
  • **
  • Posts: 276
  • Cookies: 58
    • View Profile
    • ::1
Re: Ubuntu 10.04 trouble
« Reply #1 on: October 05, 2012, 10:03:37 pm »
Either fix your network manager or download virtualenv from the computer you are currently posting this post from and copy it over to the 'buntu machine :)
Easter egg in all *nix systems: E(){ E|E& };E

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Ubuntu 10.04 trouble
« Reply #2 on: October 06, 2012, 01:24:05 pm »
To fix WICD I need to fix python itself. I tried running virtualenv, and it's a god damn python script itself, and guess what:
Code: [Select]
kulverstukas@kulvertop:~/Desktop$ python virtualenv.py
Traceback (most recent call last):
  File "virtualenv.py", line 18, in <module>
    import tempfile
  File "/usr/lib/python2.6/tempfile.py", line 34, in <module>
    from random import Random as _Random
  File "/usr/lib/python2.6/random.py", line 47, in <module>
ImportError: cannot import name urandom
am I fucked at this point? :P

Offline s3my0n

  • Knight
  • **
  • Posts: 276
  • Cookies: 58
    • View Profile
    • ::1
Re: Ubuntu 10.04 trouble
« Reply #3 on: October 06, 2012, 01:36:17 pm »
Why do you have to use WICD to connect to wireless? You can do it with iwconfig.
Code: [Select]
http://blog.tplus1.com/index.php/2008/06/13/how-to-connect-to-a-wireless-network-from-the-ubuntu-command-line/
Easter egg in all *nix systems: E(){ E|E& };E

Offline RedBullAddicted

  • VIP
  • Sir
  • *
  • Posts: 519
  • Cookies: 189
    • View Profile
Re: Ubuntu 10.04 trouble
« Reply #4 on: October 06, 2012, 03:11:32 pm »
Or you connect to your router with a network cable. If you don't use dhcp you can run the following commands:

Code: [Select]
ifconfig <your network interface (eth0)> <ip you want to use (192.168.1.10)> netmask <your subnet mask (255.255.255.0)>
route add default gw <your router ip (192.168.1.1)>
echo nameserver <your router ip (192.168.1.1)> > /etc/resolv.conf

if you use dhcp you should get your settings automatically. to force it you can run
Code: [Select]
dhclient -r
dhclient

to verify if everything works as expected try ping www.google.com

if your connection is working you can try to reinstall python with aptitude install python

Maybe this helps... not sure but it is worth a try.

Btw. as you are on ubuntu you will need sudo in front of all commands.
« Last Edit: October 07, 2012, 09:55:17 am by RedBullAddicted »
Deep into that darkness peering, long I stood there, wondering, fearing, doubting, dreaming dreams no mortal ever dared to dream before. - Edgar Allan Poe

Offline Kulverstukas

  • Administrator
  • Zeus
  • *
  • Posts: 6627
  • Cookies: 542
  • Fascist dictator
    • View Profile
    • My blog
Re: Ubuntu 10.04 trouble
« Reply #5 on: October 06, 2012, 04:38:16 pm »
Thanks for the help guys, but I managed to solve it quite easily today. It wasn't related to virtualenv at all.
I noticed that everything is ran with the command "python", which doesn't work, but when I run a python script with a command "python2.6" which is the same python executable but with different name, it works. So I did "sudo cp /usr/bin/python2.6 /usr/bin/python" and it started to work again.

Weird issue, my guess is that after an update the main executable (./python) got corrupt somehow maybe... well, it seems to work now :P
« Last Edit: October 06, 2012, 04:39:51 pm by Kulverstukas »

Offline s3my0n

  • Knight
  • **
  • Posts: 276
  • Cookies: 58
    • View Profile
    • ::1
Re: Ubuntu 10.04 trouble
« Reply #6 on: October 06, 2012, 10:19:08 pm »
I think python was updated to some new version, so you've just overwritten it :P
But usually /us/bin/python is a symlink, so the original version is still intact. Have a look at 'ls -la /usr/bin | grep python'
Easter egg in all *nix systems: E(){ E|E& };E