Skip to content

Commit

Permalink
Update 03.ProxmoxLXC.md
Browse files Browse the repository at this point in the history
add Place of the LXC File
Add numbers
add reboot after correct ACL..
  • Loading branch information
jay-jey committed Mar 28, 2021
1 parent eb2fa82 commit fde04a9
Showing 1 changed file with 33 additions and 22 deletions.
55 changes: 33 additions & 22 deletions src/languages/en/BasicSetup/03.ProxmoxLXC.md
Expand Up @@ -11,15 +11,15 @@ The runtime costs for containers is low, usually negligible. However, there are

## Basic setup

### Download LXC-Template
### 1 Download LXC-Template
First we need an LXC-Template, there are several distributions (Ubuntu, debian etc) available to download
1) Select your storage area on the left ![storageIMG](./img/LXC/storageIMG.png)
2) Select ![templateButton](./img/LXC/templateButton.png), a popup box will open
3) Choose the linux distribution of your choice, i advice the latest LTS of Ubuntu or Debian
![templateDownload](./img/LXC/templateDownload.png)
4) Hit the download button, the template will be downloaded to your system

### Create LXC container
### 2 Create LXC container
1) Create new LXC-Container ![createLXC](./img/LXC/createLXC.png)
2) The following main settings are required
* ID : Proxmox will automatically choose the firsst available, you can change this if wanted
Expand All @@ -38,16 +38,16 @@ First we need an LXC-Template, there are several distributions (Ubuntu, debian
![networkSettingsLXC.png](./img/LXC/networkSettingsLXC.png)
8) You can leave the DNS servers empty to use the default and finish you steps to create the container

## Mount USB-Devices
To ensure USB-DEvinces (like zigbee stick) can be used within the LXC, we need to:
## 3 Mount USB-Devices
To ensure USB-Devices (like zigbee stick) can be used within the LXC, we need to:
1) Ensure the device is always mounted into the sae directory
2) Ensure the mount directly is writable
3) Forward the ports to the LXC container

To accomplish 1 & 2 we will use udev-rules to assign un-mutable TTY names to USB devices by creating symbolic links of physical devices.
As last step we modify the container configuration to accomplish mount the host symbolic link into the container.

### Creating symbolic links of physical devices
### 3.1 Creating symbolic links of physical devices
1) Identify the vendor and product id, assuming the device is currently mounted to ```/dev/ttyACM0``` use the following commmmand
```
udevadm info -a -p $(udevadm info -q path -n /dev/ttyACM0) | grep "ATTRS{idVendor}" && udevadm info -a -p $(udevadm info -q path -n /dev/ttyACM0) | grep "ATTRS{idProduct}"
Expand All @@ -71,29 +71,40 @@ Replace the following items with the previous retrieved values and choose a SYML
- idProduct ```Retrieved in step 2```
- SYMLINK ```The wanted mounting point, usually ttyACM0```

### Ensure correct ACL on mounted drive
### 3.2 Ensure correct ACL on mounted drive
1) Open the previous created udev-rule
```nano /etc/udev/rules.d/49-custom.rules```
2) Add the following line to ensure the ACL is set to 0666
```
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="16c8", GROUP="users", MODE="0666"
```
Ensure **idVendor** and **idProduct** is provided correctly (See previous step), reboot your machine or reload ```udev``` rules:
```
udevadm control --reload
```
Ensure **idVendor** and **idProduct** is provided correctly (See step 3.1, previous section). Reload the configuration and check if the new device is present:
```
udevadm control --reload
ls -l /dev/
```
if not: try a reboot of Proxmox

### 4 Mount device into LXC
Mount the new created symlink into your lxc dev container
1) Get the ACL group ID of created symlink
```
ls -l /dev/ttyZigbee
lrwxrwxrwx 1 root root 7 Mar 10 13:40 /dev/ttyZigbee -> ttyACM0
```

in my case the ID is **7**, see the number between user and date

### Mount device into LXC
3) Mount the new created symlink into your lxc dev container
1) Get the ACL group ID of created symlink ```ls -l /dev/ttyZigbee```
in my case the ID is **7**, see the number between user and date
```lrwxrwxrwx 1 root root 7 Mar 10 13:40 /dev/ttyZigbee -> ttyACM0```
2) Open the LXC configuration file
3) add the following lines, replace **7** with the number in step 1 and ensure proper symlink directory
```
lxc.cgroup.devices.allow: c 7:* rwm
lxc.mount.entry: /dev/ttyZigbee dev/ttyZigbee none bind,optional,create=file
```
2) Open the LXC configuration file
```
nano /etc/pve/lxc/XXX.conf
```
4) add the following lines, replace **7** with the number in step 1 and ensure proper symlink directory
```
lxc.cgroup.devices.allow: c 7:* rwm
lxc.mount.entry: /dev/ttyZigbee dev/ttyZigbee none bind,optional,create=file
```

## NodeJS
ioBroker is build as NodeJS project and needs the NodeJS framework (not part of ioBroker) to be able to run.
Expand All @@ -106,4 +117,4 @@ sudo apt install -y nodejs
sudo reboot
```

If you receive an error message ```bash: curl: command not found``` you can install curl by entering ```apt install curl```
If you receive an error message ```bash: curl: command not found``` you can install curl by entering ```apt install curl```

0 comments on commit fde04a9

Please sign in to comment.