Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

ChromeOS LXC

crosh

ctrl + alt + t

Use ctrl + alt + t to open the browser/crosh

start stop termina

start or force stop a container

crosh> vmc start termina
crosh> vmc stop termina

lxc list


(termina) chronos@localhost ~ $ lxc list
+---------+---------+-----------------------+------+-----------+-----------+
|  NAME   |  STATE  |         IPV4          | IPV6 |   TYPE    | SNAPSHOTS |
+---------+---------+-----------------------+------+-----------+-----------+
| penguin | RUNNING | 100.115.92.197 (eth0) |      | CONTAINER | 0         |
+---------+---------+-----------------------+------+-----------+-----------+

Interface Info

(termina) chronos@localhost ~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: dummy0: <BROADCAST,NOARP> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 2a:81:32:15:6f:73 brd ff:ff:ff:ff:ff:ff
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d2:0d:02:ed:aa:d2 brd ff:ff:ff:ff:ff:ff
    inet 100.115.92.26/30 brd 100.115.92.27 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::d00d:2ff:feed:aad2/64 scope link 
       valid_lft forever preferred_lft forever
4: lxdbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:16:3e:84:41:82 brd ff:ff:ff:ff:ff:ff
    inet 100.115.92.193/28 scope global lxdbr0
       valid_lft forever preferred_lft forever
    inet6 fe80::216:3eff:fe84:4182/64 scope link 
       valid_lft forever preferred_lft forever
6: veth110ca088@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue master lxdbr0 state UP group default qlen 1000
    link/ether e6:d5:ed:ae:38:3e brd ff:ff:ff:ff:ff:ff link-netnsid 0

Sudo (to container)

You can probably already just open the terminal client and get this access. There is no sudo in termina (crosh does have sudo though). You can access the root of a container like this:

(termina) chronos@localhost ~ $ lxc exec penguin -- /bin/bash
root@penguin:~# 

Launching Other Containers

https://images.linuxcontainers.org/

lxc launch images:alpine/edge c3
lxc launch ubuntu:18.04 c1

#lxc file pull c1/usr/bin/lxc /tmp/lxc
#lxc file push /tmp/lxc penguin/usr/local/bin/

#lxc start c1
#lxc exec c1 -- lsb_release -a