{"id":16767432,"url":"https://github.com/kdecherf/birsh","last_synced_at":"2025-04-10T19:13:21.841Z","repository":{"id":139656033,"uuid":"9320171","full_name":"Kdecherf/birsh","owner":"Kdecherf","description":"virsh replacement in bash","archived":false,"fork":false,"pushed_at":"2013-07-28T16:40:12.000Z","size":132,"stargazers_count":14,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T16:56:15.432Z","etag":null,"topics":["kvm","shell","systemd-nspawn","virtual-machine"],"latest_commit_sha":null,"homepage":"http://blog.kdecherf.com/2013/04/11/my-virtualization-workflow-for-testing-slash-dev/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Kdecherf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-04-09T12:00:44.000Z","updated_at":"2019-10-06T13:48:21.000Z","dependencies_parsed_at":"2023-03-13T10:46:12.864Z","dependency_job_id":null,"html_url":"https://github.com/Kdecherf/birsh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdecherf%2Fbirsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdecherf%2Fbirsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdecherf%2Fbirsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kdecherf%2Fbirsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kdecherf","download_url":"https://codeload.github.com/Kdecherf/birsh/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248280190,"owners_count":21077412,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["kvm","shell","systemd-nspawn","virtual-machine"],"created_at":"2024-10-13T06:09:08.547Z","updated_at":"2025-04-10T19:13:21.818Z","avatar_url":"https://github.com/Kdecherf.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"birsh\n=====\n\n**birsh** is a replacement to **libvirt** but in bash and without XML files (and with many less features, I admit) :)\n\nI created this bash script to be able to quickly start virtual machines with **KVM** or **systemd-nspawn** (more or less container mode) on my laptop without playing with ton of XML files or an awful GUI tool.\n\nThe second mode is useful if you want to boot only one virtual machine without network needs (here the network is shared with the host) like quick test of a patch, build or software. The first mode can be used as many times as you want.\n\nThis tool lacks features at this time like graphical screen, removable media boot, disk management and the code is not necessarily beautiful but it works for me :) (and you can contribute)\n\n\nInstallation\n------------\n\nJust `make install`\n\n\nConfiguration\n-------------\n\nThe main configuration file is `/etc/birsh/settings` and let you set the following items:\n\n* `IMAGESFOLDER`: folder containing all disks\n* `MOUNTFOLDER`: folder where to mount disks (for `nspawn`)\n* `TMPFOLDER`: folder to put monitor sockets and temporary files (for `start`)\n* `BRIDGE`: network device name for the bridge (for `start`)\n* `BRIDGEUP`: optional setting to specify commands to execute after the bridge is up (eg. DHCP server)\n* `GATEWAY`: network address of the host\n* `NETWORK`: network to use for virtual machines (used for NAT)\n\nThe tool will automatically set NAT using `iptables` and create a /24 private network.\n\n\nRequirements\n------------\n\nYou must have these tools installed on your host: `brctl`, `ip`, `iptables`, `qemu-nbd`, `kpartx`, `socat`, `screen`, `systemd-nspawn` (optional).\n\n`screen` is used to give you an access to the serial console of a KVM virtual machine. You should set `console=ttyS0` on the virtual machine's kernel boot argument to be able to use this feature.\n\n`qemu-nbd` and `kpartx` are used for the `nspawn` mode.\n\n\nUsage\n-----\n\n**birsh** _command_ _[options]_\n\n### Commands\n\n**birsh start** _name_ _-m size_ _[-g]_ _[-s num]_ _[-cdrom filename]_  \nStart a new virtual machine using _qemu-kvm_. Return the QEMU monitor socket.\n\n* _name_ (mandatory): name of the disk to boot on\n* **-m** _size_ (mandatory): set _size_ MB of memory to the virtual machine\n* **-g**: enable graphical output\n* **-s** _num_: set _num_ CPUs to the virtual machine\n* **-cdrom** _filename_: add _filename_ (must be in `IMAGESFOLDER`/media) as a media and boot on it\n\n\n**birsh nspawn** _name_  \nStart a new container using _systemd-nspawn_. Return a chrooted shell.\n\n* _name_ (mandatory): name of the disk to boot on\n\n**birsh serial** _name_  \nAttach a screen to the serial console of a virtual machine (only for _qemu-kvm_)\n\n* _name_ (mandatory): name of the disk to attach console on\n\n**birsh list** _[base]_  \nList all available qcow2 disk files in `IMAGESFOLDER`. Files in subfolders are excluded.\n\n* **base**: list all images in `IMAGESFOLDER`/base\n\n\nExamples\n--------\n\nI consider you have some bootable disks in your `IMAGESFOLDER`, for example ubuntu.qcow2, exherbo.qcow2 and php.qcow2.\n\nBoot the php virtual machine using `qemu-kvm` with 512 MB of memory:\n\u003e birsh start php -m 512\n\n_Note: this command will output a prompt to the QEMU monitor socket. Typing `quit` in this monitor or powering off the virtual machine will release the socket and destroy the machine._\n\n\nAttach to the php serial console (after `birsh start php`):\n\u003e birsh serial php\n\n\nSpawn a container for the disk exherbo:\n\u003e birsh nspawn exherbo\n\n_Note: this command will mount the disk exherbo.qcow2 in `MOUNTFOLDER`/exherbo and boot it._\n\n\nLicense\n-------\n\nThis tool is released under the [ISC license](http://www.isc.org/software/license \"ISC license\"). See the LICENSE file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdecherf%2Fbirsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkdecherf%2Fbirsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkdecherf%2Fbirsh/lists"}