The officially official Devuan Forum!

You are not logged in.

#1 Yesterday 06:08:36

zapper
Member
Registered: 2017-05-29
Posts: 1,289  

Problem with qemu

I have a guest that cannot access the internet I have, because I forgot to install dhcpcd.

But... I cannot get inside of the qcow2 with an installation nor can I install anything remotely needed to get it working.

So I wish to ask,

Is there a way to forcibly give internet to a vm? In either virt-manager, qemu, or virtualbox.

???


Freedom is never more than one generation away from extinction. Feelings are not facts
If you wish to be humbled, try to exalt yourself long term  If you wish to be exalted, try to humble yourself long term
Favourite operating systems: Hyperbola Devuan OpenBSD Gnuinos
Peace Be With us All!

Offline

#2 Yesterday 16:35:27

aitor
Member
From: basque country
Registered: 2016-12-03
Posts: 325  
Website

Re: Problem with qemu

Install libguestfs-tools and mount the qcow2 image as root:

# guestmount -a devuan.qcow2 -i /mnt

Now you can copy dhcpcd_*.deb and its dependencies to /mnt/root or wherever you want within /mnt, and safely remove the disk afterwards:

# guestunmount /mnt

Boot the image and install the packages via:

# dpkg -i /root/*.deb

You can also configure /etc/network/interfaces if you wish:

auto eth0
allow-hotplug eth0
iface eth0 inet dhcp

https://dev1galaxy.org/viewtopic.php?id=6283

Last edited by aitor (Yesterday 17:02:52)


If you work systematically, things will come by itself (Lev D. Landau)

Offline

#3 Yesterday 17:13:24

rbit
Administrator
Registered: 2018-06-12
Posts: 142  

Re: Problem with qemu

Another option...

With qemu, use -nic user option, and set up networking as follows

ip address add 10.0.2.15/24 dev eth0
ip link set dev eth0 up
ip route add 10.0.2.0/24 dev eth0
ip route add default via 10.0.2.2 dev eth0

Also, your /etc/resolv.conf should contain

nameserver 10.0.2.3

From there, you should be able to apt install dhcpcd-base or whatever package(s) you want.

With virtualbox, you could change the network to bridged, and set up static networking as though it were a physical device on your LAN.  For example, if your LAN uses 192.168.1.0/24 with a gateway of 192.168.1.1 (I think this is a common default setup), you could do something like this

ip address add 192.168.1.20/24 dev eth0
ip link set dev eth0 up
ip route add 192.168.1.0/24 dev eth0
ip route add default via 192.168.1.1 dev eth0

Obviously, you'd want to use an address not in use by another device.  That was just an example.

Offline

Board footer