DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 1st February 2021
niks007 niks007 is offline
Port Guard
 
Join Date: Oct 2020
Location: Germany and India
Posts: 24
Default OpenBSD raw image and package installation

Hi,


In continues effort to create image for openstack environment (qcow2/raw)

so far I am done with following steps but now I want to chroot image and install few packages like cloud-init and other packages in the image how can I do it?

1) #dd if=/dev/null of=/tmp/img.raw bs=1M seek=6*1024
2) # vnconfig vnd0 /tmp/img.raw
3) #fdisk -iy /dev/rvnd0c
Writing MBR at offset 0.
4) # disklabel -A vnd0c
disklabel -Aw vnd0d
disklabel -Aw vnd0e
5) mounted it in following manner
/dev/vnd0a on /home/openbsd/a type ffs (asynchronous, local, noatime)
/dev/vnd0d on /home/openbsd/b type ffs (asynchronous, local, noatime, wxallowed)
/dev/vnd0e on /home/openbsd/c type ffs (asynchronous, local, noatime)

I want to install cloud init , java (java should be installed on /usr (/home/openbsd/b ) and configure my image with some other parameters.


PS : My previous post http://daemonforums.org/showthread.php?t=11619 is some what similar but It was related to create partition for image..
Reply With Quote
  #2   (View Single Post)  
Old 1st February 2021
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 461
Default

Can you not just use vmctl(8) to create a raw disk image and then run it under vmd(8) to install the system?

Reference: https://www.openbsd.org/faq/faq16.html
__________________
Are you infected with Wetiko?
Reply With Quote
  #3   (View Single Post)  
Old 1st February 2021
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

  • If I understand what you've done, you have three empty filesystems. If that's true, you'll need to install the OS on them there before you can install any packages. A chroot(2) is not necessarily the best or easiest way to do this -- a virtual machine is likely to be easier. Yes, one can dump(8)/restore(8) and installboot(8) from your existing OS, but installing the OS in a guest is much, much easier. Depending on your hardware, you can use the built-in hypervisor, or you can do this using Qemu emulation if you need to.
  • A chroot(2) is a new root filesystem location. As currently mounted, /home/openbsd/a does not have access to any other filesystem, so you will not be able to chroot(8) it and then reach the contents of its intended /usr or /home. Instead of having the other filesystems mounted to /home/openbsd/{b,c}, they would need to be mounted as /home/openbsd/a/usr and /home/openbsd/a/home, respectively.
  • Your chroot will have access to your network stack, but it will need valid domain resolution via resolv.conf(5). You will need to copy your existing /etc/resolv.conf into /home/openbsd/a/etc to obtain correct domain resolution from a chroot(2).
  • You may get interference between shared libraries on your base system and inside your chroot(). If they have differences in their ABIs, you may not be able to run affected programs from the new root filesystem successfully.
Reply With Quote
  #4   (View Single Post)  
Old 1st February 2021
niks007 niks007 is offline
Port Guard
 
Join Date: Oct 2020
Location: Germany and India
Posts: 24
Default

I cannot use built in hypervisor method (Vmm) as my build host is a vm which does not support nested virtulization. I think there is some method where I need to copy bsd.rd and other files (chroot I believe) .. in that phase I miss some part.
Reply With Quote
  #5   (View Single Post)  
Old 1st February 2021
niks007 niks007 is offline
Port Guard
 
Join Date: Oct 2020
Location: Germany and India
Posts: 24
Default

Quote:
Originally Posted by Head_on_a_Stick View Post
Can you not just use vmctl(8) to create a raw disk image and then run it under vmd(8) to install the system?

Reference: https://www.openbsd.org/faq/faq16.html
VMM daemon always failed to start seems my hardware does not support nested virtualization..
Reply With Quote
  #6   (View Single Post)  
Old 1st February 2021
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

You have an apparent requirement to create virtual machine images from within a running virtual machine.
I am reminded of the old joke about a lost person driving a car along coastal Maine who stops to ask for directions -- and who is told, in a thick downeast accent, "If you wantna' get to there ... you shouldna' start from here."
I perceive 4 possible solutions to your use-case:
  1. Build your OS image on another platform rather than from your virtual machine "host" environment, such as using a local workstation, then transfer the built image to where it needs to go.
  2. Use dump(8) and restore(8) to replicate filesystems and installboot(8) to install boot blocks to create a bootable image
  3. Just install the OS in your destination virtual machine and provision it accordingly.
  4. Use Qemu to create an emulated virtual machine. I expect this will not be a usable solution -- performance will be extremely poor.
Reply With Quote
  #7   (View Single Post)  
Old 1st February 2021
niks007 niks007 is offline
Port Guard
 
Join Date: Oct 2020
Location: Germany and India
Posts: 24
Default

Quote:
Originally Posted by jggimi View Post
You have an apparent requirement to create virtual machine images from within a running virtual machine.
I am reminded of the old joke about a lost person driving a car along coastal Maine who stops to ask for directions -- and who is told, in a thick downeast accent, "If you wantna' get to there ... you shouldna' start from here."
I perceive 4 possible solutions to your use-case:
  1. Build your OS image on another platform rather than from your virtual machine "host" environment, such as using a local workstation, then transfer the built image to where it needs to go.
  2. Use dump(8) and restore(8) to replicate filesystems and installboot(8) to install boot blocks to create a bootable image
  3. Just install the OS in your destination virtual machine and provision it accordingly.
  4. Use Qemu to create an emulated virtual machine. I expect this will not be a usable solution -- performance will be extremely poor.
Thanks for information and joke
I would again like to ask a question (may be dumb question) related to /usr partition and image.

Ideally, I am able to create single partition image with all packages and cloud init but when I tried to install java it failed because some pkgs require wxallowed flag on /usr in order to installed the pkgs- so If some how I manage to make /usr (may be other partition separate ) from single partition disk then my problem would solve
I practically it would not possible but if you have any idea or suggestion then would be great..
Reply With Quote
  #8   (View Single Post)  
Old 2nd February 2021
jggimi's Avatar
jggimi jggimi is online now
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,977
Default

The mount(8) program can mount any FFS (version 1 or 2) filesystem with any of the options the that are discussed under the -o options flag in the mount(8) man page. These options can be used in the fourth field of an fstab(5) entry as described in the fstab(5) man page. As an example of the latter, here is one entry from my laptop's /etc/fstab file, with a string containing 6 different comma-separated options, including wxallowed:
Code:
84cf7725b144158a.j /usr/ports ffs rw,softdep,noatime,nodev,nosuid,wxallowed 1 2
Reply With Quote
Reply

Tags
cloud, install, openstack

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenBSD raw image creation with partitions niks007 OpenBSD General 2 2nd December 2020 01:57 AM
[OpenBSD] Customize Xenodm (background image , change keyboard , change xterm) jonsec OpenBSD General 23 26th June 2020 12:19 AM
Bootable OpenBSD system image tetra_user OpenBSD Installation and Upgrading 3 23rd June 2014 07:08 AM
PHP package stability in OpenBSD ershiba OpenBSD Packages and Ports 1 4th January 2013 11:08 PM
Error mounting installation image!!! flameelement FreeBSD Installation and Upgrading 0 14th February 2009 10:24 PM


All times are GMT. The time now is 08:47 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick