Advertisement
Guest User

lxc gui container

a guest
Jan 8th, 2020
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 9.36 KB | None | 0 0
  1. [colt@fallback-os ~]$ lxc launch ubuntu:18.04 --profile default --profile x11 mycontainer
  2. Creating mycontainer
  3. Starting mycontainer
  4. Error: Error occurred when starting proxy device: Error: Failed to listen on /home/ubuntu/pulse-native: listen unix /home/ubuntu/pulse-native: bind: no such file or directory
  5. Try `lxc info --show-log local:mycontainer` for more info
  6. [colt@fallback-os ~]$ lxc info --show-log local:mycontainer
  7. Name: mycontainer
  8. Location: none
  9. Remote: unix://
  10. Architecture: x86_64
  11. Created: 2020/01/08 19:44 UTC
  12. Status: Stopped
  13. Type: persistent
  14. Profiles: default, x11
  15.  
  16. Log:
  17.  
  18. lxc mycontainer 20200108194432.557 WARN     cgfsng - cgroups/cgfsng.c:chowmod:1525 - No such file or directory - Failed to chown(/sys/fs/cgroup/unified//lxc.payload/mycontainer/memory.oom.group, 1000000000, 0)
  19. [colt@fallback-os ~]$ lxc profile assign mycontainer default
  20. Profiles default applied to mycontainer
  21. [colt@fallback-os ~]$ lxc start mycontainer
  22. [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
  23. To run a command as administrator (user "root"), use "sudo <command>".
  24. See "man sudo_root" for details.
  25.  
  26. ubuntu@mycontainer:~$ sudo apt update
  27. Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
  28. Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
  29. Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
  30. Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
  31. Reading package lists... Done                      
  32. Building dependency tree      
  33. Reading state information... Done
  34. All packages are up to date.
  35. ubuntu@mycontainer:~$ sudo apt install pulseaudio
  36. Reading package lists... Done
  37. Building dependency tree      
  38. Reading state information... Done
  39. pulseaudio is already the newest version (1:11.1-1ubuntu7.4).
  40. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
  41. ubuntu@mycontainer:~$ ls -la
  42. total 16
  43. drwxr-xr-x 1 ubuntu ubuntu  138 Jan  8 19:50 .
  44. drwxr-xr-x 1 root   root     12 Jan  8 19:48 ..
  45. -rw------- 1 ubuntu ubuntu    5 Jan  8 19:49 .bash_history
  46. -rw-r--r-- 1 ubuntu ubuntu  220 Apr  4  2018 .bash_logout
  47. -rw-r--r-- 1 ubuntu ubuntu 3771 Apr  4  2018 .bashrc
  48. -rw-r--r-- 1 ubuntu ubuntu  807 Apr  4  2018 .profile
  49. drwx------ 1 ubuntu ubuntu   30 Jan  8 19:48 .ssh
  50. -rw-r--r-- 1 ubuntu ubuntu    0 Jan  8 19:50 .sudo_as_admin_successful
  51. ubuntu@mycontainer:~$ mkdir pulse-native
  52. ubuntu@mycontainer:~$ exit
  53. logout
  54. [colt@fallback-os ~]$ lxc profile assign mycontainer default,x11
  55. Profiles default,x11 applied to mycontainer
  56. [colt@fallback-os ~]$ lxc restart mycontainer
  57. [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
  58. ubuntu@mycontainer:~$ glx
  59. glxdemo   glxgears  glxheads  glxinfo  
  60. ubuntu@mycontainer:~$ pu
  61. pulseaudio         purge-old-kernels  pushd              
  62. ubuntu@mycontainer:~$ exit
  63. ubuntu@mycontainer:~$ ls -la
  64. total 16
  65. drwxr-xr-x 1 ubuntu ubuntu  162 Jan  8 19:51 .
  66. drwxr-xr-x 1 root   root     12 Jan  8 19:48 ..
  67. -rw------- 1 ubuntu ubuntu   80 Jan  8 19:51 .bash_history
  68. -rw-r--r-- 1 ubuntu ubuntu  220 Apr  4  2018 .bash_logout
  69. -rw-r--r-- 1 ubuntu ubuntu 3771 Apr  4  2018 .bashrc
  70. -rw-r--r-- 1 ubuntu ubuntu  807 Apr  4  2018 .profile
  71. drwx------ 1 ubuntu ubuntu   30 Jan  8 19:48 .ssh
  72. -rw-r--r-- 1 ubuntu ubuntu    0 Jan  8 19:50 .sudo_as_admin_successful
  73. srwxrwxrwx 1 ubuntu ubuntu    0 Jan  8 19:51 pulse-native
  74. ubuntu@mycontainer:~$ ls -la /tmp/.X11-unix/
  75. total 0
  76. drwxrwxrwt 1 root root   0 Jan  8 19:51 .
  77. drwxrwxrwt 1 root root 254 Jan  8 19:53 ..
  78. ubuntu@mycontainer:~$ exit
  79. logout
  80. [colt@fallback-os ~]$ xauth add ubuntu/unix:0 . 7a2ce90a55eea0c195a05666ba3d9f3a
  81. [colt@fallback-os ~]$ xauth list
  82. fallback-os/unix:0  MIT-MAGIC-COOKIE-1  7a2ce90a55eea0c195a05666ba3d9f3a
  83. ubuntu/unix:0  MIT-MAGIC-COOKIE-1  7a2ce90a55eea0c195a05666ba3d9f3a
  84. [colt@fallback-os ~]$ lxc restart mycontainer
  85. [colt@fallback-os ~]$ lxc config device add mycontainer X0 disk path=/tmp/.X11-unix/X0 source=/tmp/.X11-unix/X0
  86. Device X0 added to mycontainer
  87. [colt@fallback-os ~]$ lxc config device add mycontainer Xauthority disk path=/home/ubuntu/.Xauthority source=${XAUTHORITY}
  88. Device Xauthority added to mycontainer
  89. [colt@fallback-os ~]$ lxc config device add mycontainer mygpu gpu
  90. Device mygpu added to mycontainer
  91. [colt@fallback-os ~]$ lxc config device set mycontainer mygpu uid 1000
  92. Error: Invalid key=value configuration: 1000   <- why i get this?
  93. [colt@fallback-os ~]$ lxc config device set mycontainer mygpu gid 1000
  94. Error: Invalid key=value configuration: 1000
  95. [colt@fallback-os ~]$ lxc config device set mycontainer gpu gid 1000
  96. Error: The device doesn't exist
  97. [colt@fallback-os ~]$ lxc config device set mycontainer mygpu gid 1000
  98. [colt@fallback-os ~]$ lxc config device set mycontainer mygpu uid 1000
  99. [colt@fallback-os ~]$ lxc restart mycontainer
  100. [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
  101. ubuntu@mycontainer:~$ id
  102. uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(lxd),114(netdev)
  103. ubuntu@mycontainer:~$ ls -la
  104. total 20
  105. drwxr-xr-x 1 ubuntu ubuntu   184 Jan  8 20:12 .
  106. drwxr-xr-x 1 root   root      12 Jan  8 19:48 ..
  107. -rw------- 1 nobody nogroup  271 Jan  8 19:56 .Xauthority
  108. -rw------- 1 ubuntu ubuntu   115 Jan  8 19:55 .bash_history
  109. -rw-r--r-- 1 ubuntu ubuntu   220 Apr  4  2018 .bash_logout
  110. -rw-r--r-- 1 ubuntu ubuntu  3771 Apr  4  2018 .bashrc
  111. -rw-r--r-- 1 ubuntu ubuntu   807 Apr  4  2018 .profile
  112. drwx------ 1 ubuntu ubuntu    30 Jan  8 19:48 .ssh
  113. -rw-r--r-- 1 ubuntu ubuntu     0 Jan  8 19:50 .sudo_as_admin_successful
  114. srwxrwxrwx 1 ubuntu ubuntu     0 Jan  8 20:12 pulse-native
  115. ubuntu@mycontainer:~$ exit
  116. logout
  117. [colt@fallback-os ~]$ printf "uid $(id -u) 1000\ngid $(id -g) 1000" | sudo lxc config set mycontainer raw.idmap -
  118. [sudo] password for colt:
  119. [colt@fallback-os ~]$ lxc restart mycontainer
  120. [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
  121. ubuntu@mycontainer:~$ id
  122. uid=1000(ubuntu) gid=1000(ubuntu) groups=1000(ubuntu),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),108(lxd),114(netdev)
  123. ubuntu@mycontainer:~$ ls -la
  124. total 20
  125. drwxr-xr-x 1 ubuntu ubuntu  184 Jan  8 20:14 .
  126. drwxr-xr-x 1 root   root     12 Jan  8 19:48 ..
  127. -rw------- 1 ubuntu ubuntu  271 Jan  8 19:56 .Xauthority
  128. -rw------- 1 ubuntu ubuntu  130 Jan  8 20:12 .bash_history
  129. -rw-r--r-- 1 ubuntu ubuntu  220 Apr  4  2018 .bash_logout
  130. -rw-r--r-- 1 ubuntu ubuntu 3771 Apr  4  2018 .bashrc
  131. -rw-r--r-- 1 ubuntu ubuntu  807 Apr  4  2018 .profile
  132. drwx------ 1 ubuntu ubuntu   30 Jan  8 19:48 .ssh
  133. -rw-r--r-- 1 ubuntu ubuntu    0 Jan  8 19:50 .sudo_as_admin_successful
  134. srwxrwxrwx 1 ubuntu ubuntu    0 Jan  8 20:14 pulse-native
  135. ubuntu@mycontainer:~$ ls -la /tmp/.X11-unix/X0
  136. srwxrwxrwx 1 nobody nogroup 0 Jan  8 06:06 /tmp/.X11-unix/X0
  137. ubuntu@mycontainer:~$ echo $DISPLAY
  138. :0
  139. ubuntu@mycontainer:~$ glxinfo -B
  140. name of display: :0
  141. display: :0  screen: 0
  142. direct rendering: Yes
  143. Extended renderer info (GLX_MESA_query_renderer):
  144.    Vendor: X.Org (0x1002)
  145.    Device: Radeon RX 580 Series (POLARIS10, DRM 3.32.0, 5.2.11-arch1-1-ARCH, LLVM 8.0.0) (0x67df)
  146.    Version: 19.0.8
  147.    Accelerated: yes
  148.    Video memory: 8192MB
  149. ...
  150. ubuntu@mycontainer:~$ pactl info
  151. Connection failure: Connection refused
  152. pa_context_connect() failed: Connection refused
  153. ubuntu@mycontainer:~$ echo export PULSE_SERVER="tcp:`ip route show 0/0 | awk '{print $3}'`" >> ~/.profile
  154. ubuntu@mycontainer:~$ mkdir -p ~/.config/pulse/
  155. ubuntu@mycontainer:~$ echo export PULSE_COOKIE=/home/ubuntu/.config/pulse/cookie >> ~/.profile
  156. ubuntu@mycontainer:~$ exit
  157. logout
  158. [colt@fallback-os ~]$ lxc config device add guiapps PACookie disk path=/home/ubuntu/.config/pulse/cookie source=/home/${USER}/.config/pulse/cookie
  159. Device PACookie added to guiapps
  160. [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --login --user ubuntu
  161.  
  162. ubuntu@mycontainer:~$ pactl info
  163. Connection failure: Connection refused
  164. pa_context_connect() failed: Connection refused
  165. ubuntu@mycontainer:~$ ls -la .config/
  166. total 0
  167. drwxr-xr-x 1 ubuntu ubuntu  10 Jan  8 21:04 .
  168. drwxr-xr-x 1 ubuntu ubuntu 210 Jan  8 21:04 ..
  169. drwxr-xr-x 1 ubuntu ubuntu  12 Jan  8 21:06 pulse
  170. ubuntu@mycontainer:~$ ls -la .config/pulse/cookie
  171. -rw------- 1 ubuntu ubuntu 256 Jan  8 21:06 .config/pulse/cookie
  172. ubuntu@mycontainer:~$ sha1sum ~/.config/pulse/cookie
  173. af2fbe6e936be1a5d63a02af0312a9c1770a1dcf  /home/ubuntu/.config/pulse/cookie
  174. ubuntu@mycontainer:~$ sha1sum ~/.config/pulse/cookie
  175. af2fbe6e936be1a5d63a02af0312a9c1770a1dcf  /home/ubuntu/.config/pulse/cookie
  176. ubuntu@mycontainer:~$ sha1sum ~/.config/pulse/cookie
  177. af2fbe6e936be1a5d63a02af0312a9c1770a1dcf  /home/ubuntu/.config/pulse/cookie
  178. ubuntu@mycontainer:~$ pactl info
  179. Connection failure: Access denied
  180. ubuntu@mycontainer:~$ cat .profile
  181. ...
  182. export PULSE_SERVER=tcp:192.168.100.165
  183. export PULSE_COOKIE=/home/ubuntu/.config/pulse/cookie
  184. ubuntu@mycontainer:~$ pactl info
  185. Server String: unix:/home/ubuntu/pulse-native <- change PULSE_SERVER to this one
  186. Library Protocol Version: 32
  187. Server Protocol Version: 32
  188. Is Local: yes
  189. Client Index: 28
  190. Tile Size: 65472
  191. User Name: colt
  192. Host Name: fallback-os
  193. Server Name: pulseaudio
  194. Server Version: 12.2
  195. Default Sample Specification: s16le 2ch 44100Hz
  196. Default Channel Map: front-left,front-right
  197. Default Sink: alsa_output.pci-0000_09_00.3.analog-stereo
  198. Default Source: alsa_output.pci-0000_09_00.3.analog-stereo.monitor
  199. Cookie: 98e5:d11b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement