Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
4
votes
1
answers
2938
views
Setting multiple IP addresses on private network interface using Vagrant
I am trying to configure IPv4 and IPv6 address on Internal network Vagrant interface but I am unable to do so. Here is the configuration: config.vm.network "private_network", ip: "192.168.30.10", ip: "fd::10", virtualbox__intnet: true, bridge: "eth1" config.vm.network "private_network", ip: "192.168...
I am trying to configure IPv4 and IPv6 address on Internal network Vagrant interface but I am unable to do so.
Here is the configuration:
config.vm.network "private_network",
ip: "192.168.30.10",
ip: "fd::10",
virtualbox__intnet: true,
bridge: "eth1"
config.vm.network "private_network",
ip: "192.168.40.10",
virtualbox__intnet: true,
bridge: "eth2"
Ideally I would love to setup link-local address manually but I got error when booting up VM. For now I can work with private IPv6 addresses. Is the only way to turn off auto-config and set it up inside VM?
phandox
(141 rep)
Apr 10, 2016, 08:46 PM
• Last activity: Jun 13, 2025, 06:06 AM
-1
votes
1
answers
51
views
Is a multi-machine Vagrant a good choice to simulate a Kubernetes cluster?
I am in front of a book to teaching myself Kubernetes. It has many chapters about handling a Kubernetes cluster, and it urges the reader to create an account on a cloud server, if he can. Else to attempt creating a cluster of few Raspberry Pi. But I don't want or cannot afford these choices. I have...
I am in front of a book to teaching myself Kubernetes.
It has many chapters about handling a Kubernetes cluster, and it urges the reader to create an account on a cloud server, if he can. Else to attempt creating a cluster of few Raspberry Pi. But I don't want or cannot afford these choices. I have my own home computer, that's all.
Is it something that prevents me from creating a multi-machine Vagrant to create all computers my book could talk about?
I believe this could work...
My question is simple and naive. But if there's an obstacle or a big difficulty that I will surely face, I'd like to know it immediately before choosing this wrong way. Thanks!
Marc Le Bihan
(2353 rep)
Apr 17, 2025, 04:16 PM
• Last activity: Apr 17, 2025, 04:48 PM
0
votes
1
answers
8611
views
Public static IP only for a Vagrantfile
I modified the [Vagrantfile for taiga-vagrant][1] based on [VAGRANT DOCS/Public Networks][2] as follows: # -*- mode: ruby -*- # vi: set ft=ruby : require "./source.rb" ROOT_PATH = File.dirname(__FILE__) VAGRANTFILE_API_VERSION = "2" def configure_extra(config) end def configure(config) config.vm.box...
I modified the Vagrantfile for taiga-vagrant based on VAGRANT DOCS/Public Networks as follows:
# -*- mode: ruby -*-
# vi: set ft=ruby :
require "./source.rb"
ROOT_PATH = File.dirname(__FILE__)
VAGRANTFILE_API_VERSION = "2"
def configure_extra(config)
end
def configure(config)
config.vm.box = "trusty64"
config.vm.box_url = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box "
# Disable automatic box update checking. If you disable this, then
# boxes will only be checked for updates when the user runs
#
vagrant box outdated
. This is not recommended.
# config.vm.box_check_update = false
# Host name
config.vm.hostname = "taiga"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine.
config.vm.network :forwarded_port, host: 8000, guest: 8000
config.vm.network :forwarded_port, host: 9001, guest: 9001
# Create a public network, which generally matched to bridged network.
# Bridged networks make the machine appear as another physical device on
# your network.
config.vm.network "public_network", autoconfig: false
config.vm.provision "fix-no-tty", type: "shell" do |s|
s.privileged = false
s.inline = "sudo sed -i '/tty/!s/mesg n/tty -s \\&\\& mesg n/' /root/.profile"
end
# manual ip
config.vm.provision "shell",
run: "always",
inline: "ifconfig eth1 xxx.yyy.zzz.153 netmask 255.255.255.0 up"
# manual ipv6
config.vm.provision "shell",
run: "always",
inline: "ifconfig eth1 inet6 add fc00::17/7"
# default router
config.vm.provision "shell",
run: "always",
inline: "route add default gw xxx.yyy.zzz.132"
# default router ipv6
config.vm.provision "shell",
run: "always",
inline: "route -A inet6 add default gw fc00::1 eth1"
# delete default gw on eth0
config.vm.provision "shell",
run: "always",
inline: "eval route -n | awk '{ if ($8 ==\"eth0\" && $2 != \"0.0.0.0\") print \"route del default gw \" $2; }'
"
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "./data", "/home/vagrant/data"
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
config.vm.provider "virtualbox" do |vb|
# Boot with headless mode
vb.gui = false
host = RbConfig::CONFIG['host_os']
# Giving a quarter of system memory to VM and access to all available cpu cores
if host =~ /darwin/
cpus = sysctl -n hw.ncpu
.to_i
# sysctl returns Bytes, converting to MB...
mem = sysctl -n hw.memsize
.to_i / 1024 / 1024 / 4
elsif host =~ /linux/
cpus = nproc
.to_i
# meminfo returns KB, converting to MB...
mem = grep 'MemTotal' /proc/meminfo | sed -e 's/MemTotal://' -e 's/ kB//'
.to_i / 1024 / 4
else
# hardcoding values for windows...
cpus = 2
mem = 2048
end
vb.customize ["modifyvm", :id, "--memory", mem]
vb.customize ["modifyvm", :id, "--cpus", cpus]
end
# Provisioning
config.vm.provision "shell" do |shell|
vagrant_shell_scripts_configure(
shell,
File.join(ROOT_PATH, "scripts"),
"provision.sh",
{}
)
end
end
# Look for a Vagrantfile.local to load
local_vagrantfile = "#{__FILE__}.local"
if File.exists?(local_vagrantfile)
eval File.read(local_vagrantfile)
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
configure config
configure_extra config
end
After vagrant up
, I am asked for *"Which interface should the network bridge to?"*. After selecting *1 (for eth0)*, the VirtualBox virtual machine launches just fine and I can connect via ssh. The networking interface(s) settings of this VM are:
eth0 Link encap:Ethernet HWaddr 08:00:27:70:2a:9d
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe70:2a9d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1462 errors:0 dropped:0 overruns:0 frame:0
TX packets:968 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:151879 (151.8 KB) TX bytes:122611 (122.6 KB)
eth1 Link encap:Ethernet HWaddr 08:00:27:2e:e8:7f
inet addr:xxx.yyy.zzz.153 Bcast:xxx.yyy.zzz.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe2e:e87f/64 Scope:Link
inet6 addr: fc00::17/7 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1335 errors:0 dropped:0 overruns:0 frame:0
TX packets:683 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1078620 (1.0 MB) TX bytes:85690 (85.6 KB)
*Small Update*
While launching, there are several messages of
default: Warning: Connection timeout. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Remote connection disconnect. Retrying...
...
Finally, though, the machine starts. I can access taiga just fine from the outer internet. But, **is it necessary to have both of these interfaces?** **Can I not have the static public IP for eth0 only?**
Nikos Alexandris
(1470 rep)
Dec 9, 2015, 06:16 PM
• Last activity: Apr 9, 2025, 07:03 PM
6
votes
2
answers
17771
views
dpkg: warning: 'ldconfig' not found in PATH or not executable - Ubuntu 12 - Vagrant
I am working on setting up a Vagrant / Puppet install so that new developers can have a clean development environment for our Rails project. The basic Vagrant configure commands are: config.vm.box = 'precise32' config.vm.box_url = 'http://files.vagrantup.com/precise32.box' Overall, the install seems...
I am working on setting up a Vagrant / Puppet install so that new developers can have a clean development environment for our Rails project.
The basic Vagrant configure commands are:
config.vm.box = 'precise32'
config.vm.box_url = 'http://files.vagrantup.com/precise32.box '
Overall, the install seems to be going well. I've got RVM, Postgres, and Ruby installed and running.
However, whenever I try to install the "Heroku Toolbelt" using this command:
su -l vagrant -c 'wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh'
I run into this problem:
... Lots of Hits and downloads...
The following extra packages will be installed:
foreman heroku libruby1.9.1 ruby1.9.1
Suggested packages:
ruby1.9.1-examples ri1.9.1 graphviz ruby1.9.1-dev
The following NEW packages will be installed:
foreman heroku heroku-toolbelt libruby1.9.1 ruby1.9.1
0 upgraded, 5 newly installed, 0 to remove and 132 not upgraded.
Need to get 0 B/4,997 kB of archives.
After this operation, 13.1 MB of additional disk space will be used.
dpkg: warning: 'ldconfig' not found in PATH or not executable.
dpkg: warning: 'start-stop-daemon' not found in PATH or not executable.
dpkg: error: 2 expected programs not found in PATH or not executable.
Note: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
E: Sub-process /usr/bin/dpkg returned an error code (2)
(*Note*) This happens if I run the command manually after vagrant ssh. Also, the actual shell configuration gets the error when it initially runs.
Since this is a vagrant box, it is easy to 'vagrant destroy' and then try again but I get the same issue consistently.
The strange thing is, my PATH does definitely include those folders:
echo $PATH
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/bin:/home/vagrant/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/vagrant/.rvm/rubies/ruby-1.9.3-p194/bin:/home/vagrant/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/vagrant_ruby/bin
the file 'ldconfig' is in /sbin and is an executable:
cd /sbin
ls -l l*
-rwxr-xr-x 1 root root 465 Apr 20 2012 ldconfig
Same with start-stop-daemon:
-rwxr-xr-x 1 root root 26752 Apr 12 2012 start-stop-daemon
So, not sure what it is really complaining about... Any suggestions? Some permissions issue with Vagrant?
Dave Collins
(163 rep)
Aug 19, 2013, 08:25 PM
• Last activity: Mar 23, 2025, 07:46 PM
0
votes
1
answers
35
views
Vagrant 2.3.7 no longer supported by https://vagrantcloud.com
It seems https://vagrantcloud.com no longer supports Vagrant v2.3.7: ~~~ $ vagrant --version Vagrant 2.3.7 $ vagrant init ubuntu/focal64 --box-version 20240821.0.1 $ vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'ubuntu/focal64' could not be found. Attemptin...
It seems https://vagrantcloud.com no longer supports Vagrant v2.3.7:
~~~
$ vagrant --version
Vagrant 2.3.7
$ vagrant init ubuntu/focal64 --box-version 20240821.0.1
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/focal64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: 20240821.0.1
==> default: Box file was not detected as metadata. Adding it directly...
You specified a box version constraint with a direct box file
path. Box version constraints only work with boxes from Vagrant
Cloud or a custom box host. Please remove the version constraint
and try again.
~~~
~~~
$ vagrant --version
Vagrant 2.4.3
$ vagrant init ubuntu/focal64 --box-version 20240821.0.1
A
Vagrantfile
has been placed in this directory. You are now
ready to vagrant up
your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
vagrantup.com
for more information on using Vagrant.
tange@64g:~/privat/parallel/testsuite/vagrant/ubuntu/focal64$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'ubuntu/focal64' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: 20240821.0.1
==> default: Loading metadata for box 'ubuntu/focal64'
default: URL: https://vagrantcloud.com/api/v2/vagrant/ubuntu/focal64
==> default: Adding box 'ubuntu/focal64' (v20240821.0.1) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/ubuntu/boxes/focal64/versions/20240821.0.1/providers/virtualbox/unknown/vagrant.box
==> default: Successfully added box 'ubuntu/focal64' (v20240821.0.1) for 'virtualbox'!
==> default: Importing base box 'ubuntu/focal64'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/focal64' version '20240821.0.1' is up to date...
==> default: Setting the name of the VM: focal64_default_1739915511851_19903
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2200
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Connection reset. Retrying...
default: Warning: Remote connection disconnect. Retrying...
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
default: The guest additions on this VM do not match the installed version of
default: VirtualBox! In most cases this is fine, but in rare cases it can
default: prevent things such as shared folders from working properly. If you see
default: shared folder errors, please make sure the guest additions within the
default: virtual machine match the version of VirtualBox you have installed on
default: your host and reload your VM.
default:
default: Guest Additions Version: 6.1.50
default: VirtualBox Version: 7.0
==> default: Mounting shared folders...
default: /home/tange/privat/parallel/testsuite/vagrant/ubuntu/focal64 => /vagrant
~~~
Version 2.4.3 is not under a free license, which limits who can use it. (https://en.wikipedia.org/wiki/Vagrant_%28software%29#License_change)
I would like to avoid forcing others to run non-free software, so I would like to stay at version 2.3.7.
After creating the box with 2.4.3 (above) it seems I can do:
~~~
$ sudo dpkg -i releases.hashicorp.com/vagrant/2.3.7/vagrant_2.3.7-1_amd64.deb
~~~
So version 2.4.3 downloads something (probably https://vagrantcloud.com/ubuntu/boxes/focal64/versions/20240821.0.1/providers/virtualbox/unknown/vagrant.box) and make it available in a way that 2.3.7 then can use.
Can I download the box with wget
and pass it to 2.3.7?
Ole Tange
(37348 rep)
Feb 19, 2025, 04:52 PM
2
votes
1
answers
112
views
BASH script doesn't mount my device when invoked by UDEV
Im trying to create a udev rule that mounts my device by his uuid, so i can after read into its contents. My udev file is localized in the `/etc/udev/rules.d/99-local.rules`, and this are it's contents : ``` ACTION=="add", ENV{ID_FS_UUID}=="12CB-F616", SYMLINK+="masterkey", RUN+="/usr/bin/mountkey.s...
Im trying to create a udev rule that mounts my device by his uuid, so i can after read into its contents.
My udev file is localized in the
/etc/udev/rules.d/99-local.rules
, and this are it's contents :
ACTION=="add", ENV{ID_FS_UUID}=="12CB-F616", SYMLINK+="masterkey", RUN+="/usr/bin/mountkey.sh"
The script ran by the udev rule consists of this :
LOG_FILE="/tmp/mount-key.log"
mount /dev/masterkey /mnt/masterkey > "$LOG_FILE"
MOUNT_POINT="$(findmnt -n -o TARGET --source '/dev/masterkey')"
echo "Device mounted at $MOUNT_POINT" >> "$LOG_FILE"
----------
The problem is that when udev invokes the command **mount** apparently it doesn't work and nor the command produces any output as well as the **MOUNT_POINT** env variable in the log file. even though **udev** actually creates the **masterkey** symlink.
The log file looks like this :
Device mounted at
I comprobed that it did not indeed mount the partition after running lsblk
:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 1 3.8G 0 disk
└─sda1 8:1 1 3.8G 0 part
...
I edited the script and instead, i ran it with **sudo**, but got the same output of above.
So i decided to run the **mount** command as a root without waiting for a password (thinking it was the problem), i edited the /etc/sudoers
file with **visudo** and added the line with the **NOPASSWD** field for **mount** for **root** user, like this :
root ALL=(ALL:ALL) ALL
root ALL=NOPASSWD:/usr/bin/mount
As well i tried to write to run it in this different ways :
ACTION=="add", ENV{ID_FS_UUID}=="12CB-F616", SYMLINK+="masterkey", RUN+="/bin/bash -c '/usr/bin/mountkey.sh'"
ACTION=="add", ENV{ID_FS_UUID}=="12CB-F616", SYMLINK+="masterkey", RUN+="/bin/bash -c 'sudo /usr/bin/mount /dev/masterkey /mnt/masterkey'"
ACTION=="add", ENV{ID_FS_UUID}=="12CB-F616", SYMLINK+="masterkey", RUN+="/bin/bash -c '/usr/bin/mount /dev/masterkey /mnt/masterkey'"
Too i did all of this with sh (with #!/bin/sh) and in none of that ways it worked.
So it seems it doesn't have any problem invoking the script, and creating the symlink, but running the mount binary in whatever way it is presented.
And nor its my **mount** binary , because when i run :
sudo mount /dev/sdnx /mnt/masterkey
it does work propperly.
After this many tries without seeing a hint of which could be the problem i changed the udev rule to this :
ACTION=="add", ENV{ID_FS_UUID}=="12CB-F616", RUN+="/bin/bash -c '/usr/local/bin/mountkey.sh $ID_FS_UUID'"
And my bash script :
#!/bin/bash
UUID="$1"
DEVICE=$(blkid -o device -t UUID="$UUID")
echo "$UUID\n$DEVICE" > "/tmp/mountkey.log"
mount $DEVICE /media/masterkey
But ohh! surprise, nothing did change.
----------
## VM SYSTEM ##
Vagrant **(archlinux/archlinux)**
Kernel **6.10.10-arch1-1**
## REAL SYSTEM ##
I tried to run the udev rule inside my real machine, which is :
Arch linux / 6.13.2-arch1-1
But i still got the same result (No partition mounted in the system).
So by doing this i pruebed the problem is within one of the files (the udev rule or the bash script).
rustymanito
(35 rep)
Feb 14, 2025, 12:58 AM
• Last activity: Feb 14, 2025, 09:36 PM
0
votes
2
answers
992
views
Vagrant password in Debian 11/12
I am using Vagrant to create VMs, but I cannot find the default password for the user **vagrant**. If there is no password, how can I set it up during provisioning from the Vagrantfile?
I am using Vagrant to create VMs, but I cannot find the default password for the user **vagrant**.
If there is no password, how can I set it up during provisioning from the Vagrantfile?
john
(411 rep)
Jun 27, 2023, 05:05 AM
• Last activity: Nov 6, 2024, 04:43 PM
0
votes
0
answers
51
views
Set up Ubuntu server on VirtualBox with Vagrant & Ansible via another Ubuntu existing server
Might sound stupid, but anyway.. Got this idea to try and raise another Ubuntu server into VirtualBox and learn some automation with Vagrant and Ansible instead of installing each and every tool I would possibly need manually. But the thing is I run VirtualBox on a Windows host and already have anot...
Might sound stupid, but anyway..
Got this idea to try and raise another Ubuntu server into VirtualBox and learn some automation with Vagrant and Ansible instead of installing each and every tool I would possibly need manually. But the thing is I run VirtualBox on a Windows host and already have another Ubuntu server as my playground.
Would it be somehow possible to use the existing Ubuntu server from inside the VB to create another one on it? Don't want to bother with WSL or Windows to do these things.
Avocado
(11 rep)
Oct 10, 2024, 06:16 AM
4
votes
3
answers
4443
views
Install Pi-Hole without user interaction?
I would like to install Pi-Hole automatically inside Vagrant (VirtualBox).  Therefore, in an automated script, it has to run to box start.  Unfortunately, normally, you have to answer multiple installation questions to install Pi-Hole, e.g., IPv4 or 6, ..., and you need keyboard...
I would like to install Pi-Hole automatically inside Vagrant (VirtualBox).
Therefore, in an automated script, it has to run to box start.
Unfortunately, normally,
you have to answer multiple installation questions to install Pi-Hole,
e.g., IPv4 or 6, ...,
and you need keyboard interaction with the setup (by the user).
Is there any way or solution to install it without any interaction?
How can I write it in a Bash script or Vagrantfile?
Kutsubato
(95 rep)
Feb 12, 2018, 10:43 PM
• Last activity: Sep 6, 2024, 01:59 AM
0
votes
0
answers
42
views
Not able to login to a user through another user in Vagrant
I have a main user scriptbox where all three other web01, web02, web03 are connected. Web03 is an ubuntu based VM and other two are centos. They are running fine but web03 is not doing, it keep showing the same error. ``` ssh vagrant@web03 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@...
I have a main user scriptbox where all three other web01, web02, web03 are connected.
Web03 is an ubuntu based VM and other two are centos. They are running fine but web03 is not doing, it keep showing the same error.
ssh vagrant@web03
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the ECDSA key sent by the remote host is
SHA256:bDhBR1PkTV5ul8t9aW/g7VrUfFs9Tps9XrzdchbLMto.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending ECDSA key in /root/.ssh/known_hosts:3
ECDSA host key for web03 has changed and you have requested strict checking.
Host key verification failed.
Indra Sekar
(1 rep)
Aug 25, 2024, 02:37 AM
• Last activity: Aug 27, 2024, 02:30 AM
0
votes
1
answers
280
views
Unable to start the VM with centos and not able to figure out the error
I am trying to vagrant up my two VMs: one is Ubuntu and the other is CentOS. One is working fine and the other gives this error: ``` Loading mirror speeds from cached hostfile Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was 14: curl#6 - "...
I am trying to vagrant up my two VMs: one is Ubuntu and the other is CentOS. One is working fine and the other gives this error:
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=vag error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=vag error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
I have tried the ping thing. Internet is coming through but I am not sure why it is happening. I am sharing my vagrantfile too for reference. I tried other solutions on StackOverflow and couldn't find a solution that worked.
Vagrant.configure("2") do |config|
# Configuration for web01 VM
config.vm.define "web01" do |web01|
web01.vm.box = "ubuntu/bionic64"
web01.vm.hostname = "web01"
web01.vm.network "private_network", ip: "192.168.40.11"
web01.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
vb.cpus = 2
end
web01.vm.provision "shell", inline: <<-SHELL
apt update
apt install apache2 wget unzip -y
systemctl start apache2
systemctl enable apache2
cd /tmp/
wget https://www.tooplate.com/zip-templates/2119_gymso_fitness.zip
unzip -o 2119_gymso_fitness.zip
cp -r 2119_gymso_fitness/* /var/www/html/
systemctl restart apache2
SHELL
end
# Configuration for db01 VM
config.vm.define "db01" do |db01|
db01.vm.box = "centos/7"
db01.vm.hostname = "db01"
db01.vm.network "private_network", ip: "192.168.40.12"
db01.vm.provider "virtualbox" do |vb|
vb.memory = "1024"
vb.cpus = 2
end
# Provisioning with a shell script
db01.vm.provision "shell", inline: <<-SHELL
# Update package list and install necessary software
yum install -y mariadb-server -y
systemctl start mariadb
systemctl start mariadb
systemctl enable mariadb
mysql -u root -e 'CREATE DATABASE wordpress;'
mysql -u root -e 'GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON wordpress.* TO wordpress@localhost IDENTIFIED BY "admin123";'
mysql -u root -e 'FLUSH PRIVILEGES;'
SHELL
end
end
Indra Sekar
(1 rep)
Jul 27, 2024, 02:49 AM
• Last activity: Jul 28, 2024, 01:45 PM
0
votes
1
answers
221
views
An ALTER USER postgres PASSWORD 'postgres' fails when provisioning vagrant with Postgresql
I'm provisioning a vagrant box with Postgresql. It looks going well, but at the end, it cannot run an `ALTER USER postgres PASSWORD 'postgres';` for a `Permission denied`. Here's what I'm doing, and what I notice. ```ruby config.vm.provision "shell", privileged: true, path: "../common/150_Postgresql...
I'm provisioning a vagrant box with Postgresql.
It looks going well, but at the end, it cannot run an
ALTER USER postgres PASSWORD 'postgres';
for a Permission denied
.
Here's what I'm doing, and what I notice.
config.vm.provision "shell", privileged: true,
path: "../common/150_Postgresql-Postgis.sh", args: ["15", "3", "postgres"]
150_Postgresql-Postgis.sh
:
sudo apt-get -y -qq install "postgresql-$1" "postgresql-client-$1" -o Dpkg::Progress-Fancy="0"
sudo apt-get -y -qq install "postgis" "postgresql-$1-postgis-$2" "postgresql-$1-postgis-$2-scripts" -o Dpkg::Progress-Fancy="0" -o Dpkg::Use-Pty="0"
POSTGRES_PORT="5432"
POSTGRES_PASSWORD=$3
sudo -u postgres psql -f common/155_CreatePassword.sql -v password="'$POSTGRES_PASSWORD'"
During it's installation, I see the following logs when the two apt-get
are executed. It starts installing Postgresql 15
and its related Postgis,
default: Running provisioner: shell...
default: Running: /tmp/vagrant-shell20240716-1139149-5w52kg.sh
default: /tmp/vagrant-shell: line 1: w#!/bin/bash: No such file or directory
default: 150 : Installation de Postgresql 15 et Postgis 3
[...]
default: Preparing to unpack .../01-postgresql-client-common_261.pgdg120+1_all.deb ...
default: Unpacking postgresql-client-common (261.pgdg120+1) ...
[...]
default: Selecting previously unselected package postgresql-client-15.
default: Preparing to unpack .../09-postgresql-client-15_15.7-1.pgdg120+1_amd64.deb ...
default: Unpacking postgresql-client-15 (15.7-1.pgdg120+1) ...
default: Selecting previously unselected package postgresql-15.
default: Preparing to unpack .../10-postgresql-15_15.7-1.pgdg120+1_amd64.deb ...
[...]
default: Setting up postgresql-15 (15.7-1.pgdg120+1) ...
default: Creating new PostgreSQL cluster 15/main ...
default: /usr/lib/postgresql/15/bin/initdb -D /var/lib/postgresql/15/main --auth-local peer --auth-host scram-sha-256 --no-instructions
default: The files belonging to this database system will be owned by user "postgres".
default: This user must also own the server process.
[...]
default: fixing permissions on existing directory /var/lib/postgresql/15/main ... ok
default: creating subdirectories ... ok
[...]
default: Selecting previously unselected package postgis.
default: Preparing to unpack .../48-postgis_3.4.2+dfsg-1.pgdg120+1_amd64.deb ...
default: Unpacking postgis (3.4.2+dfsg-1.pgdg120+1) ...
default: Selecting previously unselected package postgis-doc.
default: Preparing to unpack .../49-postgis-doc_3.4.2+dfsg-1.pgdg120+1_all.deb ...
default: Unpacking postgis-doc (3.4.2+dfsg-1.pgdg120+1) ...
default: Selecting previously unselected package postgresql-15-postgis-3-scripts.
default: Preparing to unpack .../50-postgresql-15-postgis-3-scripts_3.4.2+dfsg-1.pgdg120+1_all.deb ...
default: Unpacking postgresql-15-postgis-3-scripts (3.4.2+dfsg-1.pgdg120+1) ...
default: Selecting previously unselected package postgresql-15-postgis-3.
default: Preparing to unpack .../51-postgresql-15-postgis-3_3.4.2+dfsg-1.pgdg120+1_amd64.deb ...
default: Unpacking postgresql-15-postgis-3 (3.4.2+dfsg-1.pgdg120+1)
[...]
Then it immediately adds an installation of Postgresql 16
.
default: Selecting previously unselected package postgresql-client-16.
default: Preparing to unpack .../52-postgresql-client-16_16.3-1.pgdg120+1_amd64.deb ...
default: Unpacking postgresql-client-16 (16.3-1.pgdg120+1) ...
default: Selecting previously unselected package postgresql-16.
default: Preparing to unpack .../53-postgresql-16_16.3-1.pgdg120+1_amd64.deb ...
default: Unpacking postgresql-16 (16.3-1.pgdg120+1) ...
default: Selecting previously unselected package postgresql-16-postgis-3-scripts.
default: Preparing to unpack .../54-postgresql-16-postgis-3-scripts_3.4.2+dfsg-
[...]
155_CreatePassword.sql
:
sql
ALTER USER postgres PASSWORD :password;
The vagrant box creation fails with:
log
default: Building PostgreSQL dictionaries from installed myspell/hunspell packages...
default: Removing obsolete dictionary files:
default: Processing triggers for fontconfig (2.14.1-4) ...
default: psql: error: common/155_CreatePassword.sql: Permission denied
default: psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "postgres"
default: connection to server at "localhost" (127.0.0.1), port 5432 failed: FATAL: password authentication failed for user "postgres"
The SSH command responded with a non-zero exit status. Vagrant
```
Is the sudo -u
causing a problem, preventing the ALTER USER postgres PASSWORD :password;
from being executed?
Or is it its attempt to install two different versions of Postgresql at the same time?
Marc Le Bihan
(2353 rep)
Jul 16, 2024, 03:51 AM
• Last activity: Jul 16, 2024, 07:46 AM
5
votes
1
answers
2086
views
Changing file permissions from 777 to 755 or changing the owner doesn't do anything
[![chmod not working][1]][1] ``` [vagrant@localhost vagrant]$ sudo chmod 755 luser-demo01.sh [vagrant@localhost vagrant]$ ls -l total 5 -rwxrwxrwx 1 vagrant vagrant 101 May 30 19:44 luser-demo01.sh -rwxrwxrwx 1 vagrant vagrant 3464 May 30 19:16 Vagrantfile [vagrant@localhost vagrant]$ chmod 755 luse...

[vagrant@localhost vagrant]$ sudo chmod 755 luser-demo01.sh
[vagrant@localhost vagrant]$ ls -l
total 5
-rwxrwxrwx 1 vagrant vagrant 101 May 30 19:44 luser-demo01.sh
-rwxrwxrwx 1 vagrant vagrant 3464 May 30 19:16 Vagrantfile
[vagrant@localhost vagrant]$ chmod 755 luser-demo01.sh
[vagrant@localhost vagrant]$ ls -l
total 5
-rwxrwxrwx 1 vagrant vagrant 101 May 30 19:44 luser-demo01.sh
-rwxrwxrwx 1 vagrant vagrant 3464 May 30 19:16 Vagrantfile
[vagrant@localhost vagrant]$
I am trying to change file permissions for the above .sh file from 777 to 755 using chmod
, but it's not working. I have tried using other permissions like 600 and 666 with chmod
but the file permissions never change. I'm using CentOS 7.
My commands are the following: sudo chmod 755
or chmod 755
.
I was recommended to use chown
to gain ownership of the file. However, after trying that, I see that even that is not working as expected. I am attaching an image below for reference. I am probably using the commands wrong.

[vagrant@localhost vagrant]$ chown -c root luser-demo01.sh
changed ownership of 'luser-demo01.sh' from vagrant to root
[vagrant@localhost vagrant]$ ls -l
total 5
-rwxrwxrwx 1 vagrant vagrant 101 May 30 19:44 luser-demo01.sh
-rwxrwxrwx 1 vagrant vagrant 3464 May 30 19:16 Vagrantfile
[vagrant@localhost vagrant]$
The output of the findmnt
command is as follows:
[vagrant@localhost vagrant]$ findmnt -T /vagrant
TARGET SOURCE FSTYPE OPTIONS
/vagrant /vagrant vboxsf rw,nodev,relatime
/vagrant vagrant vboxsf rw,nodev,relatime
TechieMon
(61 rep)
May 30, 2024, 09:18 PM
• Last activity: Jun 2, 2024, 12:56 AM
1
votes
0
answers
32
views
Vagrant: Force provisioning ssh to be external ssh (not Ruby's Net::SSH)
https://developer.hashicorp.com/vagrant/docs/v2.4.0/vagrantfile/ssh_settings says: > config.ssh.extra_args (array of strings) - This settings value is > passed directly into the ssh executable. This allows you to pass any > arbitrary commands to do things such as reverse tunneling down into > the SS...
https://developer.hashicorp.com/vagrant/docs/v2.4.0/vagrantfile/ssh_settings says:
> config.ssh.extra_args (array of strings) - This settings value is
> passed directly into the ssh executable. This allows you to pass any
> arbitrary commands to do things such as reverse tunneling down into
> the SSH program. These options can either be single flags set as
> strings such as "-6" for IPV6 or an array of arguments such as ["-L",
> "8008:localhost:80"] for enabling a tunnel from host port 8008 to port
> 80 on guest. Note: This option only affects the ssh command or
> instances where the SSH executable is invoked **(non-interactive SSH
> connections use the internal SSH communicator which is unaffected by
> this setting).**
For my vagrant box I cannot use Ruby's SSH client.
Can I force Vagrant to use the SSH executable with the config.ssh.extra_args?
https://developer.hashicorp.com/vagrant/docs/v2.2.19/other/environmental-variables suggests setting VAGRANT_PREFER_SYSTEM_BIN - but it is unclear to what (I tried true and 1 and exporting the variable - Vagrant 2.2.19 still used Net::SSH).
Ole Tange
(37348 rep)
Jan 21, 2024, 06:02 AM
• Last activity: Jan 21, 2024, 06:26 AM
1
votes
1
answers
422
views
I need help with packer (vagrant box) build(er) config/scripts so UEFI boot order is properly configured
**Setup** *Host* ``` OS: Manjaro XFCE x86_64 Apps: packer (plugins: virtualbox-iso), ``` *Guest* ``` OS: Arch Linux Hypervisor: Virtualbox Architecture: x64 ``` I have built a Vagrant box using Packer. My goal is to have the VMbox run one application like a docker container app, but since the applic...
**Setup**
*Host*
I've noticed that checking the boot order given for my box does not correspond what virtualbox can find, so I'm wondering why this is.
I have only two options in the Virtualbox of which the former is the harddisk boot, which it can't find and the second is starting some kind of network boot?
I just want to get into GRUB.
During the building of the vagrant box, I call
And I can add the boot option so that it will work, but I want box to work.. well.. out of the box!
My packer build file
https://raw.githubusercontent.com/safenetwork-community/SE_bastille-installer-box/arch/bib-base/SE_bastille-installer-box.pkr.hcl
What am I doing wrong?
OS: Manjaro XFCE x86_64
Apps: packer (plugins: virtualbox-iso),
*Guest*
OS: Arch Linux
Hypervisor: Virtualbox
Architecture: x64
I have built a Vagrant box using Packer.
My goal is to have the VMbox run one application like a docker container app, but since the application needs to use partitioning, I can't use docker for it without some risk that I'm trying to avoid.
A vagrant box is a self-customized virtual machine.
This way other people can have the same OS setup as you do yourself.
I've built one for Virtualbox, but I'm not completely there yet.
One of the things that I want in my VM is for it to be modern,
so I want to use of UEFI, but I haven't been able to fully figure out,
how to construct it for VMs.
Which is why I'm confronted with this issue:
UEFI fails to load properly. BdsDxe: failed to load Boot0001 "UEFI VBOX Harddisk"
See below in image:


efibootmgr
to see what my Disk should be giving as it's boot order.
*output of efibootmgr*
SE_bastille-installer-box.virtualbox-iso.archlinux: ==> bootloader.sh: Check boots..
SE_bastille-installer-box.virtualbox-iso.archlinux: BootCurrent: 0001
SE_bastille-installer-box.virtualbox-iso.archlinux: Timeout: 0 seconds
SE_bastille-installer-box.virtualbox-iso.archlinux: BootOrder: 0005,0000,0002,0003,0004
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0000* UiApp FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(462caa21-7614-4503-836e-8ab6f4662331)
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0002* UEFI VBOX HARDDISK PciRoot(0x0)/Pci(0xf,0x0)/SCSI(0,0){auto_created_boot_option}
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0003* UEFI PXEv4 (MAC:0800277E9510) PciRoot(0x0)/Pci(0x3,0x0)/MAC(0800277e9510,1)/IPv4(0.0.0.00.0.0.0,0,0){auto_created_boot_option}
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0004 EFI Internal Shell FvVol(7cb8bdc9-f8eb-4f34-aaea-3ee4af6516a1)/FvFile(7c04a583-9e3e-4f1c-ad65-e05268d0b4d1)
SE_bastille-installer-box.virtualbox-iso.archlinux: Boot0005* GRUB HD(1,GPT,1e8f8680-99c0-4c28-b83a-eb601805d4c4,0x800,0x96000)/File(\EFI\GRUB\grubx64.efi)
Below is the script that builds the boot loader.
*scripts/bootloader.sh*
#!/usr/bin/env bash
. /root/vars.sh
NAME_SH=bootloader.sh
# stop on errors
set -eu
echo "==> ${NAME_SH}: Installing grub packages.."
/usr/bin/arch-chroot ${ROOT_DIR} /usr/bin/pacman --noconfirm -S edk2-ovmf efibootmgr grub os-prober >/dev/null
echo "==> ${NAME_SH}: Pre-configure grub.."
/usr/bin/arch-chroot ${ROOT_DIR} sed -i 's/#GRUB_DISABLE_OS_PROBER/GRUB_DISABLE_OS_PROBER/' /etc/default/grub
echo "==> ${NAME_SH}: Installing grub.."
/usr/bin/arch-chroot ${ROOT_DIR} grub-install --target=x86_64-efi --efi-directory=${ESP_DIR} --bootloader-id=GRUB &>/dev/null
/usr/bin/arch-chroot ${ROOT_DIR} grub-mkconfig -o /boot/grub/grub.cfg &>/dev/null
echo "==> ${NAME_SH}: Check boots.."
if [[ $PACKER_BUILDER_TYPE == "virtualbox-iso" ]]; then
/usr/bin/arch-chroot ${ROOT_DIR} efibootmgr --delete-bootnum --bootnum 1
fi
/usr/bin/arch-chroot ${ROOT_DIR} efibootmgr
The EFI file can be found in shell, so I'm doing at least something correctly.

Folaht
(1156 rep)
Jun 19, 2023, 05:38 AM
• Last activity: Aug 1, 2023, 12:44 AM
1
votes
0
answers
69
views
Adding -o KexAlgorithms to vagrant up's ssh
I want to use: https://app.vagrantup.com/FritsHoogland/boxes/centos39-oracle817 The basic `vagrant up` command fails: ~~~ $ vagrant init FritsHoogland/centos39-oracle817 $ vagrant up There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and st...
I want to use: https://app.vagrantup.com/FritsHoogland/boxes/centos39-oracle817
The basic
vagrant up
command fails:
~~~
$ vagrant init FritsHoogland/centos39-oracle817
$ vagrant up
There was an error while executing VBoxManage
, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "0e84ac28-6e1d-432a-b417-cc99c71562b7", "--type", "headless"]
Stderr: VBoxManage: error: Implementation of the USB 2.0 controller not found!
VBoxManage: error: Because the USB 2.0 controller state is part of the saved VM state, the VM cannot be started. To fix this problem, either install the 'Oracle VM VirtualBox Extension Pack' or disable USB 2.0 support in the VM settings.
VBoxManage: error: Note! This error could also mean that an incompatible version of the 'Oracle VM VirtualBox Extension Pack' is installed (VERR_NOT_FOUND)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole
~~~
I edited Vagrantfile to ignore the USB error:
~~~
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--usb", "on"]
vb.customize ["modifyvm", :id, "--usbehci", "off"]
end
~~~
This starts the VM, but the initial ssh to the VM fails:
~~~
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'FritsHoogland/centos39-oracle817'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'FritsHoogland/centos39-oracle817' version '0.0.2' is up to date...
==> default: Setting the name of the VM: c_default_1689909952468_41
==> default: Fixed port collision for 22 => 2222. Now on port 2206.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
default: Adapter 1: nat
==> default: Forwarding ports...
default: 22 (guest) => 2206 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 127.0.0.1:2206
default: SSH username: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
~~~
It seems Vagrant is running:
/usr/bin/ssh -vv -p 2206 -o LogLevel=FATAL -o Compression=yes -o DSAAuthentication=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o KexAlgorithms=+diffie-hellman-group1-sha1 -o UserKnownHostsFile=/dev/null -i /home/tange/.vagrant.d/insecure_private_key vagrant@127.0.0.1
which fails.
How can I make it add -o KexAlgorithms=+diffie-hellman-group1-sha1
which seems to work:
/usr/bin/ssh -vv -p 2206 -o LogLevel=FATAL -o Compression=yes -o DSAAuthentication=yes -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o KexAlgorithms=+diffie-hellman-group1-sha1 -o UserKnownHostsFile=/dev/null -i /home/tange/.vagrant.d/insecure_private_key vagrant@127.0.0.1
This logs into the VM.
I tried adding this to ~/.ssh/config:
~~~
Host *
KexAlgorithms +diffie-hellman-group1-sha1
~~~
But the initial vagrant up
seems to ignore this.
I added to Vagrantfile:
config.ssh.extra_args = ["-o" "KexAlgorithms=+diffie-hellman-group1-sha1"]
This seems to be used by vagrant ssh
but not by vagrant up
. In other words: vagrant up
hangs, but vagrant ssh
works after the system is booted.
Is there a section of Vagrantfile where I can set -o KexAlgorithms +diffie-hellman-group1-sha1
or some other way to make vagrant up
use that?
Ole Tange
(37348 rep)
Jul 21, 2023, 03:48 AM
• Last activity: Jul 21, 2023, 07:14 AM
1
votes
0
answers
159
views
Vagrant OpenBSD Box not starting up through Libvirt Provider
So I have created a OpenBSD 7.3 VM in libvirt with the following shell command. virt-install --name openbsd7.3 --os-variant openbsd7.0 \ --virt-type kvm --vcpus 1,maxvcpus=2 --memory 256,maxmemory=512 \ --disk /home/dev/Downloads/ISOs/install73.img,boot.order=1,format=raw \ --disk /home/dev/Dev/VMs/...
So I have created a OpenBSD 7.3 VM in libvirt with the following shell command.
virt-install --name openbsd7.3 --os-variant openbsd7.0 \
--virt-type kvm --vcpus 1,maxvcpus=2 --memory 256,maxmemory=512 \
--disk /home/dev/Downloads/ISOs/install73.img,boot.order=1,format=raw \
--disk /home/dev/Dev/VMs/openbsd7.3/openbsd73.img,boot.order=2,size=10 \
--cpu host-passthrough --boot uefi --import;
Then I completed the installation, removed the installer disk while VM was up.
virsh detach-disk --domain openbsd7.3 ~/Downloads/ISOs/install73.img \
--persistent --config --live
Then I setup sudo and vagrant user, insecure public key on the VM.
After completing the steps, I generated a
openbsd73.box
file from openbsd73.img
with the [create_box.sh](https://github.com/vagrant-libvirt/vagrant-libvirt/blob/main/tools/create_box.sh) script from vagrant-libvirt github repo.
And then I added the .box to vagrant with
vagrant box add openbsd73.box --name openbsd73
After it was successfully added to Vagrant, I created a Vagrantfile to test it with
vagrant init openbsd73 && vagrant up --provider=libvirt
Although I get the following Error and the vagrant box doesn't start up
==> default: Starting domain.
==> default: Domain launching with graphics connection settings...
==> default: -- Graphics Port: 5900
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Graphics Websocket: 5700
==> default: Waiting for domain to get an IP address...
When I manually run sudo virt-viewer
I get
Booting from hard Disk...
No active partition
**NOTE:** The box is available when I run sudo virsh list --all
and the vagrant-libvirt virtual network is also active when I run sudo virsh net-list --all
and it worked when I tried setting up a Alpine Linux box with Vagrant.
prmethus
(21 rep)
Jun 27, 2023, 05:57 PM
• Last activity: Jun 27, 2023, 05:59 PM
0
votes
1
answers
216
views
I build a vagrant VM (Arch Linux + EFI) using Hashicorp packer, but the screen flickers
**Setup** *Host* ``` OS: Manjaro XFCE x86_64 Apps: packer (plugins: virtualbox-iso), ``` *Guest* ``` OS: Arch Linux Hypervisor: Virtualbox Architecture: x64 ``` This is my issue: [![enter image description here][1]][1] *My packer build file (qemu build removed for simplicity sake)* ``` packer { requ...
**Setup**
*Host*
*My packer build file (qemu build removed for simplicity sake)*
OS: Manjaro XFCE x86_64
Apps: packer (plugins: virtualbox-iso),
*Guest*
OS: Arch Linux
Hypervisor: Virtualbox
Architecture: x64
This is my issue:

packer {
required_plugins {
virtualbox = {
version = ">=1.0.4"
source = "github.com/hashicorp/virtualbox"
}
}
}
variable "ssh_private_key_file" {
type = string
default = "~/.ssh/id_bas"
}
variable "ssh_timeout" {
type = string
default = "20m"
validation {
condition = can(regex("[0-9]+[smh]", var.ssh_timeout))
error_message = "The ssh_timeout value must be a number followed by the letter s(econds), m(inutes), or h(ours)."
}
}
variable "ssh_username" {
description = "Unpriviledged user to create."
type = string
default = "bas"
}
locals {
boot_command_virtualbox = [
"",
"curl -O http://10.0.2.3:{{ .HTTPPort }}/${local.kickstart_script} && ",
"chmod +x ${local.kickstart_script} && ",
"LOCAL_IP=10.0.2.3 ",
"LOCAL_PORT={{ .HTTPPort }} ",
"PACKER_BUILDER_TYPE=iso-virtualbox ",
"./${local.kickstart_script}",
]
cpus = 1
disk_size = "4G"
disk_size_vb = "4000"
efi_firmware_code = "/usr/share/edk2/x64/OVMF_CODE.fd"
efi_firmware_vars = "/usr/share/edk2/x64/OVMF_VARS.fd"
headless = "false"
iso_checksum = "sha256:329b00c3e8cf094a28688c50a066b5ac6352731ccdff467f9fd7155e52d36cec"
iso_url = "https://mirror.cj2.nl/archlinux/iso/2023.06.03/archlinux-x86_64.iso "
kickstart_script = "initLiveVM.sh"
machine_type = "q35"
memory = 4096
http_directory = "srv"
vm_name = "SE_bastille-installer-box"
write_zeros = "true"
}
source "virtualbox-iso" "archlinux" {
boot_command = local.boot_command_virtualbox
boot_wait = "2s"
communicator = "ssh"
cpus = 1
disk_size = local.disk_size_vb
firmware = "efi"
format = "ovf"
guest_additions_mode = "disable"
guest_os_type = "Arch"
hard_drive_interface = "virtio"
headless = local.headless
http_directory = local.http_directory
iso_checksum = local.iso_checksum
iso_interface = "virtio"
iso_url = local.iso_url
memory = local.memory
nic_type = "virtio"
shutdown_command = "sudo systemctl start poweroff.timer"
ssh_port = 22
ssh_private_key_file = var.ssh_private_key_file
ssh_timeout = var.ssh_timeout
ssh_username = var.ssh_username
vm_name = "${local.vm_name}.ovf"
}
build {
name = "SE_bastille-installer-box"
sources = ["source.virtualbox-iso.archlinux"]
provisioner "file" {
destination = "/tmp/"
source = "./files"
}
provisioner "shell" {
only = ["virtualbox-iso.archlinux"]
execute_command = "{{ .Vars }} sudo -E -S bash '{{ .Path }}'"
expect_disconnect = true
scripts = [
"scripts/liveVM.sh",
"scripts/virtualbox.sh",
"scripts/tables.sh",
"scripts/partitions.sh",
"scripts/base.sh",
"scripts/bootloader.sh",
"scripts/pacman.sh",
"scripts/setup.sh"
]
}
provisioner "shell" {
execute_command = "{{ .Vars }} WRITE_ZEROS=${local.write_zeros} sudo -E -S bash '{{ .Path }}'"
script = "scripts/cleanup.sh"
}
post-processor "vagrant" {
output = "output/${local.vm_name}_${source.type}_${source.name}-${formatdate("YYYY-MM", timestamp())}.box"
vagrantfile_template = "templates/vagrantfile.tpl"
}
}
What am I doing wrong?
Folaht
(1156 rep)
Jun 18, 2023, 03:01 PM
• Last activity: Jun 19, 2023, 05:28 AM
0
votes
1
answers
788
views
Nested Libvirt (KVM) fails to create network with vagrant
I want to create a nested virtual machine with network access. I use vagrant on the Host (Layer 0) to create the Layer 1 guest, and then would want to use vagrant to create a Layer 2 guest (inside the Layer 1). However, when I try to create the Layer 2 machine, vagrant up fails with: ``` Error while...
I want to create a nested virtual machine with network access.
I use vagrant on the Host (Layer 0) to create the Layer 1 guest, and then would want to use vagrant to create a Layer 2 guest (inside the Layer 1).
However, when I try to create the Layer 2 machine, vagrant up fails with:
Error while activating network: Call to virNetworkCreate failed: internal error: Network is already in use by interface eth0.
I think I added a second NIC to the Layer 1 so that it can use it for the Layer 2 but I am unsure.
I am a little new to VM nesting, so am not sure how to resolve this. Here is my config:
##### Host Vagrantfile
ENV["VAGRANT_DEFAULT_PROVIDER"] = "libvirt"
Vagrant.configure("2") do |config|
config.vm.define "u22" do |ubuntu|
ubuntu.vm.box = "generic/ubuntu2204"
# Tests:
# ubuntu.vm.network "public_network", :dev => "wlp3s0"
# ubuntu.vm.network "private_network", dhcp: true
ubuntu.vm.network "private_network", ip: "10.10.10.30"
end
end
##### Guest Vagrantfile
ENV["VAGRANT_DEFAULT_PROVIDER"] = "libvirt"
Vagrant.configure("2") do |config|
config.vm.box = "centos/stream8"
end
The host is an Ubuntu 20.04
.
Not sure if this is enough info (please ask away, I'm a noobie).
MrMeszaros
(105 rep)
Nov 15, 2022, 04:48 PM
• Last activity: Jun 14, 2023, 08:39 PM
0
votes
1
answers
99
views
Automated Ubuntu Desktop Build - DNS Failure on boot
I am trying to create an automated build of an Ubuntu Desktop 22.04.2 using the official guide (https://github.com/canonical/autoinstall-desktop) and then use ansible to configure it. The automated build works as expected, but the ansible configuration fails. After looking at the desktop, it has no...
I am trying to create an automated build of an Ubuntu Desktop 22.04.2 using the official guide (https://github.com/canonical/autoinstall-desktop) and then use ansible to configure it. The automated build works as expected, but the ansible configuration fails. After looking at the desktop, it has no DNS servers listed in etc/resolv.conf. Enabling and disabling/enabling the NIC from the cli or the GUI fixes the issue (router is now listed), but after a reboot the same issue is present again.
Disabling and reenabling the NIC, doing a apt update and apt upgrade, and then rebooting solves it across reboots. I am doing an apt update and apt upgrade in the automated build process as well as apt-get dist-upgrade, but there is a Software Update called "Ubuntu Base" that seems to only show up as a needed update after a user logs into the GUI for the first time. Once that update is applied and the desktop rebooted, the issue is resolved. I can then run the ansible playbook.
I have tried several methods to do an ipconfig eth0 down/up as the first step in the ansible playbook, but none of the methods seems to successfully work. Guessing the down works, but the desktop never receives the up when the network goes down. Not quite sure what else to try at this point. Hoping someone else has come across this.
Samcro1967
(1 rep)
May 9, 2023, 01:26 PM
• Last activity: May 11, 2023, 11:30 AM
Showing page 1 of 20 total questions