You are not logged in.
I have a "headless" (no monitor or input peripherals) Arch Linux computer that is connected to a local network via a wireless adapter, and accessed from other computers via SSH.
Earlier today I accidentally broke its kernel so it did not boot anymore.
Idea: Temporarily connect a monitor to the computer, boot from a live CD (like the Arch Linux install CD), then chroot into the system and fix it.
Problem: I didn't have a compatible monitor at hand.
Idea: Log in to the live CD session from another computer via SSH.
Problem: The live CD can't auto-configure the headless computer's wireless connection, and setting it up manually while working "blind" would be a major hassle. A direct LAN connection to the router wasn't available either.
Idea: Connect directly with a laptop via an Ethernet cable, and then use SSH from the laptop => This solution worked for me!
If you find yourself in a similar situation, you can follow this tutorial which describes the solution that worked for me in detail...
a copy of the Arch Linux install CD (I used the 2013-05-01 version)
a keyboard (might be dispensable, with additional preparation)
a functional Arch Linux laptop (or other computer within physical range)
I used the plain Arch Linux install iso, burnt to CD.
By creating a carefully customized version of the live CD using Archiso, you might be able to eliminate the need for steps 2 and 4 - however that's not covered in this tutorial.
The laptop needs to be configured in such a way, that the live CD's attempt to automatically establish an Ethernet connection with it will succeed:
a) IP address
In my case, the Laptop's wireless adapter had an IP address in the range 192.168.1.*, connecting it to the local network and Internet via the central router 192.168.1.1.
The Ethernet connection between the laptop and the headless computer becomes a separate mini-network, for which I decided to use IP addresses in the range 192.168.0.* (note the different third number). Specifically, I set the IP address of my laptop's Ethernet card to 192.168.0.1. You can do this by running the following as root (replace "eth0" with the name of your Ethernet interface):
ip link set eth0 up
ip addr add 192.168.0.1/24 dev eth0
b) IP forwarding (optional)
While we're at it, we might as well enable IP forwarding, so that the live CD session on the headless computer will be able to directly use the laptop's outgoing Internet connection (which will make it much more convenient to install/upgrade packages during the repair session). To enable this, run the following as root (replace "eth0" and "wlan0" with the names of your laptop's Ethernet and wireless interfaces, respectively):
iptables --table nat --append POSTROUTING --out-interface wlan0 -j MASQUERADE
iptables --append FORWARD --in-interface eth0 -j ACCEPT
sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
c) DHCP
The live CD will assume there's a router on the other side of the Ethernet link, and ask for an IP address via DHCP. So all we need to do, is run a dhcp server on the Laptop that will answer this request. It's surprisingly easy: Just install the package dnsmasq, and put the following in the file /etc/dnsmasq.conf (again replacing "eth0" as appropriate):
interface=eth0
dhcp-range=192.168.0.2,192.168.0.2
By setting the start & end values of dhcp-range to the same IP address, we enforce that this specific IP address will be used by the live CD on the headless computer.
Then start the daemon by running the following as root:
systemctl start dnsmasq.service
Connect the laptop and the headless computer via the Ethernet cable.
Connect the external keyboard to the headless computer.
Then put the Arch Linux install CD into the headless computer's drive, and boot. Wait a minute or so to give the CD time to load its boot menu (you should hear the CD drive spin up and settle down again). Then hit ENTER on the connected keyboard, to activate the default menu choice (which will boot straight to a live Arch Linux session with root privileges).
You can check whether it booted up and successfully initialized the Ethernet connection, by ping'ing the IP address that was specified in step 2c) from the laptop:
ping -c3 192.168.0.2
Unfortunately, the Arch Linux install CD doesn't automatically start its SSH server, and also it uses a randomized root password. To make SSH connections possible, you will have to use the connected keyboard to type in some stuff "blindly" (but it's simple enough):
type "passwd" (without the quotes)
type in a new password of your choice
press ENTER
type in the same password again
press ENTER
type "systemctl start sshd" (without the quotes)
press ENTER
Now you can open an SSH connection, by executing the following on the laptop (when it asks for the password, enter the one you chose in step 4):
ssh root@192.168.0.2
Within this SSH shell on the laptop, you can now do whatever you would usually do to fix an Arch Linux system from a live CD.
You'll probably want to chroot into your Arch root partition, which is very easy thanks to the arch-chroot tool that is included on the live CD (replace "/dev/sda3" with the name of the headless computer's root partition):
mount /dev/sda3 /mnt
arch-chroot /mnt
If you set up IP forwarding as described in step 2b), then Internet access should magically work in this shell without any further configuration, so you can freely use pacman etc. inside the chroot.
Enjoy!
Last edited by sas (2013-07-26 22:17:03)
my AUR packages ~~ my community contributions
Offline