Skip to content

Instantly share code, notes, and snippets.

@soasme
Created December 19, 2020 22:22
Show Gist options
  • Select an option

  • Save soasme/d5270fd05fad1d66ebd7fa3a529c0803 to your computer and use it in GitHub Desktop.

Select an option

Save soasme/d5270fd05fad1d66ebd7fa3a529c0803 to your computer and use it in GitHub Desktop.
vagrant@ubuntu-groovy:~$ sudo unshare --mount bash
root@ubuntu-groovy:/home/vagrant# ls /proc
1 115 1324 157 180 21 26 29 373 473 490 556 606 629 66620 682 83 9 97 bus devices fb irq kpagecgroup meminfo net scsi sys uptime
10 116 1325 16 195 22 27 3 387 474 52538 558 617 635 66621 79 84 91 98 cgroups diskstats filesystems kallsyms kpagecount misc pagetypeinfo self sysrq-trigger version
101 12 1398 17 196 229 273 30 39529 475 52557 56868 618 64015 66632 792 85 92 99 cmdline dma fs kcore kpageflags modules partitions slabinfo sysvipc version_signature
102 121 1399 173 197 23 274 31 39530 476 54058 6 619 643 674 80 86 94 acpi consoles driver interrupts keys loadavg mounts pressure softirqs thread-self vmallocinfo
11 13 14 176 2 24 275 32 4 487 54171 601 621 65694 676 81 87 95 bootconfig cpuinfo dynamic_debug iomem key-users locks mpt sched_debug stat timer_list vmstat
112 1321 15 18 20 25 28 348 472 489 54490 604 62436 66077 677 82 89 96 buddyinfo crypto execdomains ioports kmsg mdstat mtrr schedstat swaps tty zoneinfo
root@ubuntu-groovy:/home/vagrant# umount -l /proc
root@ubuntu-groovy:/home/vagrant# ls /proc
root@ubuntu-groovy:/home/vagrant# /bin/mount
mount: failed to read mtab: No such file or directory
root@ubuntu-groovy:/home/vagrant# /bin/mount -rbind rootfs rootfs
/bin/mount: invalid option -- 'b'
Try 'mount --help' for more information.
root@ubuntu-groovy:/home/vagrant# /bin/mount --rbind rootfs rootfs
root@ubuntu-groovy:/home/vagrant# mkdir -p rootfs/oldroot
root@ubuntu-groovy:/home/vagrant# pivot_root rootfs rootfs/oldroot/
root@ubuntu-groovy:/home/vagrant# cd /
root@ubuntu-groovy:/# umount -lR /oldroot
bash: /usr/bin/umount: No such file or directory
root@ubuntu-groovy:/# /bin/umount -lR /oldroot
umount: failed to parse /proc/self/mountinfo: No such file or directory
root@ubuntu-groovy:/# /bin/mount -t proc none /proc
root@ubuntu-groovy:/# /bin/mount
proc on /proc type proc (rw)
proc on /proc type proc (rw)
none on /proc type proc (rw)
root@ubuntu-groovy:/# /bin/umount -a
root@ubuntu-groovy:/# /bin/mount -t proc none /proc
root@ubuntu-groovy:/# /bin/mount
proc on /proc type proc (rw)
proc on /proc type proc (rw)
none on /proc type proc (rw)
none on /proc type proc (rw)
root@ubuntu-groovy:/# /bin/umount /oldroot
umount: /oldroot: target is busy
(In some cases useful info about processes that
use the device is found by lsof(8) or fuser(1).)
root@ubuntu-groovy:/# /bin/umount -l /oldroot
root@ubuntu-groovy:/# /bin/mount
proc on /proc type proc (rw)
proc on /proc type proc (rw)
none on /proc type proc (rw)
none on /proc type proc (rw)
root@ubuntu-groovy:/# ls /oldroot
bash: /usr/bin/ls: No such file or directory
root@ubuntu-groovy:/# /bin/ls /oldroot
root@ubuntu-groovy:/# rmdir /oldroot
root@ubuntu-groovy:/# ls
bash: /usr/bin/ls: No such file or directory
root@ubuntu-groovy:/# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
root@ubuntu-groovy:/# export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
root@ubuntu-groovy:/# ls
bin boot dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@ubuntu-groovy:/# ls /oldroot
ls: cannot access /oldroot: No such file or directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment