Skip to content

deltreey/chroot-lvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chroot-lvm

A tool to chroot on an LVM system in ONE command.

Installation

curl -fsSLO https://github.com/deltreey/chroot-lvm/releases/latest/download/chroot-lvm
curl -fsSLO https://github.com/deltreey/chroot-lvm/releases/latest/download/chroot-lvm.sha256
sha256sum -c chroot-lvm.sha256
sudo mv chroot-lvm /usr/local/sbin/chroot-lvm
sudo chmod +x /usr/local/sbin/chroot-lvm

Generally, I don't really want to install something like this, but use it in an emergency. Here's how you can pull and run it in one line.

One-Shot execution

curl -fsSLO https://github.com/deltreey/chroot-lvm/releases/latest/download/chroot-lvm \
  && sudo bash chroot-lvm <filesystem, e.g. /dev/ubuntu-vg/ubuntu-lv>

Example Use Case

curl -fsSLO https://github.com/deltreey/chroot-lvm/releases/latest/download/chroot-lvm && sudo bash chroot-lvm /dev/ubuntu-vg/ubuntu-lv
ls /home # just to verify the username
passwd admin # then type a new password since I forgot it
exit

Why?

It's a multistep process to chroot on an LVM system. See this gist.

When I needed to rescue computer recently, I realized that the steps were somewhat arbitrary, and it would be nice to abstract it to a simpler command (akin to the way things were done before LVM). So I did that, here.

Packaging notes: this is a single-file script with no external runtime dependencies beyond bash, mount, and lvm2.

About

A tool to chroot in an LVM environment in ONE command

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors