If you do not have network it stands to reason that your packages are broken and it is not able to install – Apt can't retrieve packages.
Manually download
As you are posting here you obviously have another unit with network access. If this one can be used to download packages you could do it manually.
- At Ubuntu Packages Search you can specify distribution and package; search; select hit-link; go to bottom of page; select package; select Architecture; copy mirror link / or direct link;
Download (this is for i386, precise):
wget http://archive.ubuntu.com/ubuntu//pool/main/n/network-manager/network-manager_0.9.4.0-0ubuntu3_i386.deb
You'll also be served dependencies on that page.
- Or - in terminal if other machine is same version and architecture:
uri=$(apt-cache show network-manager | grep "^Filename: " | cut -d' ' -f2) && wget "http://archive.ubuntu.com/ubuntu/$uri"
To list dependencies and state do:
apt-rdepends network-manager --follow=DEPENDS --print-state
If apt-rdepends isn't installed it's dependencies should be installed
Post some more information
Now. An easier way would perhaps be to try to fix the network using other tools.
A
Open terminal Ctrl+Alt+T and issue the following commands:
lshw -C network
ifconfig -a
ip addr list
route -n
And post the output in your Question.
B
Or, - more complete - run a script. See code at bottom.
- Save code to a file and copy it to machine without network.
- Open terminal and make it executable:
chmod 700 name_of_file
- Run it and save output to file:
./name_of_file > result
# or
./name_of_file | tee result
Sanitize it if you want and add it to your Question.
Code:
#!/bin/bash
No warranties, guaranties etc.
version=0.0.1
sep="=============================================================="
has_tool "<tool>"
has_tool()
{
command -v "$1" >/dev/null 2>&1
}
prnt_header "<tool>" "<arg-execute>"
prnt_header()
{
printf ";; %s\n" "$sep"
printf ";; = tool: %-52s =\n" "$1"
[[ "$2" != "" ]] && printf ";; = arg : %-52s =\n" "$2"
if ! has_tool "$1"; then
e=";; = ERR: `$1' not present."
printf "%-63s =\n" "$e"
printf ";; %s\n" "$sep"
return 1
fi
if [[ "$1" =~ cat|more|less ]]; then
if ! [[ -e "$2" ]]; then
e=";; = ERR: File; `$2' not present."
printf "%-63s =\n" "$e"
printf ";; %s\n" "$sep"
return 1
fi
fi
printf ";; %s\n" "$sep"
return 0
}
tool_info "<tool>" "<arg-version>" "<arg-execute>"
tool_info()
{
local v=
(($#!=3)) && {
printf >&2 "* $0 ERR: Bad call to cmd_present. Missing arguments.\n"
printf >&2 ";; '%s'\n" "$@"
return 1
}
if ! prnt_header "$1" "$3"; then
return 1
fi
if [[ $2 ]]; then
printf ";; Version \$ %s %s\n" "$1" "$2"
v=( $($1 $2 2>&1) )
printf ";; %s\n" "${v[*]}"
fi
printf ";;\n"
}
tool_do "<tool>" "<arg-version>" "<arg-execute>" "<sudo>"
tool_do()
{
(($#!=4)) && {
printf >&2 "* $0 ERR: Bad call to cmd_do. Missing arguments.\n"
printf >&2 ";; '%s'\n" "$@"
return 1
}
if ! tool_info "$1" "$2" "$3"; then
return 1
fi
printf ";; Output:\n"
(($4==1)) && sudo $1 $3 || $1 $3
printf "\n;;\n"
return 0
}
ping_gateways()
{
if has_tool route; then
# TODO: Check for UG flag
gw=$(route -n | awk '{print $2}' | grep -o '^[0-9.]')
for g in ${gw[]}; do
if ! [[ "$g" == "0.0.0.0" ]]; then
tool_do "ping" "-V" "-c 3 $g" 0
fi
done
fi
}
printf ";; _______________________ NET TEST _____________________________\n" | tee /dev/stderr
printf ";; v. %s\n\n" "$version" | tee /dev/stderr
printf >&2 ";; Working ...\n"
tool_info "NetworkManager" "--version" ""
printf >&2 ";; Hardware ...\n"
tool_do "lshw" "-version" "-C network" 1
#printf >&2 "\r\033[KVarious information ..."
printf >&2 ";; Various information ...\n"
tool_do "ifconfig" "-V" "-a" 0
tool_do "ip" "-V" "addr list" 0
tool_do "route" "-V" "-n" 0
tool_do "netstat" "-V" "-rn" 0
tool_do "iptables" "--version" "-n -L" 1
printf >&2 ";; Some cat'ing ...\n"
tool_do "cat" "" "/etc/network/interfaces" 0
tool_do "cat" "" "/etc/hosts" 0
tool_do "cat" "" "/etc/hosts.allow" 0
tool_do "cat" "" "/etc/hosts.deny" 0
tool_do "cat" "" "/etc/modules" 0
tool_do "cat" "" "/etc/modules.conf" 0
tool_do "cat" "" "/etc/resolv.conf" 0
printf >&2 ";; Some dig'ing ...\n"
tool_do "host" "" "localhost" 0
tool_do "nslookup" "" "localhost" 0
tool_do "nslookup" "" "askubuntu.com" 0
tool_do "dig" "" "." 0
tool_do "dig" "" "localhost" 0
tool_do "dig" "" "askubuntu.com" 0
printf >&2 ";; Ping gateways ...\n"
ping_gateways
printf >&2 ";; Ping various ...\n"
tool_do "ping" "" "-c 3 216.239.32.10" 0
printf >&2 ";; Ping google DNS ...\n"
https://developers.google.com/speed/public-dns/docs/using
tool_do "ping" "" "-c 3 8.8.8.8" 0
tool_do "ping" "" "-c 3 8.8.4.4" 0
printf "\n;; Fine.\n" | tee /dev/stderr