Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [colt@fallback-os ~]$ lxc launch ubuntu:18.04 --profile default --profile x11 mycontainer
- Creating mycontainer
- Starting mycontainer
- 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
- Try `lxc info --show-log local:mycontainer` for more info
- [colt@fallback-os ~]$ lxc info --show-log local:mycontainer
- Name: mycontainer
- Location: none
- Remote: unix://
- Architecture: x86_64
- Created: 2020/01/08 19:44 UTC
- Status: Stopped
- Type: persistent
- Profiles: default, x11
- Log:
- 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)
- [colt@fallback-os ~]$ lxc profile assign mycontainer default
- Profiles default applied to mycontainer
- [colt@fallback-os ~]$ lxc start mycontainer
- [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
- To run a command as administrator (user "root"), use "sudo <command>".
- See "man sudo_root" for details.
- ubuntu@mycontainer:~$ sudo apt update
- Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease
- Hit:2 http://security.ubuntu.com/ubuntu bionic-security InRelease
- Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease
- Hit:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- All packages are up to date.
- ubuntu@mycontainer:~$ sudo apt install pulseaudio
- Reading package lists... Done
- Building dependency tree
- Reading state information... Done
- pulseaudio is already the newest version (1:11.1-1ubuntu7.4).
- 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
- ubuntu@mycontainer:~$ ls -la
- total 16
- drwxr-xr-x 1 ubuntu ubuntu 138 Jan 8 19:50 .
- drwxr-xr-x 1 root root 12 Jan 8 19:48 ..
- -rw------- 1 ubuntu ubuntu 5 Jan 8 19:49 .bash_history
- -rw-r--r-- 1 ubuntu ubuntu 220 Apr 4 2018 .bash_logout
- -rw-r--r-- 1 ubuntu ubuntu 3771 Apr 4 2018 .bashrc
- -rw-r--r-- 1 ubuntu ubuntu 807 Apr 4 2018 .profile
- drwx------ 1 ubuntu ubuntu 30 Jan 8 19:48 .ssh
- -rw-r--r-- 1 ubuntu ubuntu 0 Jan 8 19:50 .sudo_as_admin_successful
- ubuntu@mycontainer:~$ mkdir pulse-native
- ubuntu@mycontainer:~$ exit
- logout
- [colt@fallback-os ~]$ lxc profile assign mycontainer default,x11
- Profiles default,x11 applied to mycontainer
- [colt@fallback-os ~]$ lxc restart mycontainer
- [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
- ubuntu@mycontainer:~$ glx
- glxdemo glxgears glxheads glxinfo
- ubuntu@mycontainer:~$ pu
- pulseaudio purge-old-kernels pushd
- ubuntu@mycontainer:~$ exit
- ubuntu@mycontainer:~$ ls -la
- total 16
- drwxr-xr-x 1 ubuntu ubuntu 162 Jan 8 19:51 .
- drwxr-xr-x 1 root root 12 Jan 8 19:48 ..
- -rw------- 1 ubuntu ubuntu 80 Jan 8 19:51 .bash_history
- -rw-r--r-- 1 ubuntu ubuntu 220 Apr 4 2018 .bash_logout
- -rw-r--r-- 1 ubuntu ubuntu 3771 Apr 4 2018 .bashrc
- -rw-r--r-- 1 ubuntu ubuntu 807 Apr 4 2018 .profile
- drwx------ 1 ubuntu ubuntu 30 Jan 8 19:48 .ssh
- -rw-r--r-- 1 ubuntu ubuntu 0 Jan 8 19:50 .sudo_as_admin_successful
- srwxrwxrwx 1 ubuntu ubuntu 0 Jan 8 19:51 pulse-native
- ubuntu@mycontainer:~$ ls -la /tmp/.X11-unix/
- total 0
- drwxrwxrwt 1 root root 0 Jan 8 19:51 .
- drwxrwxrwt 1 root root 254 Jan 8 19:53 ..
- ubuntu@mycontainer:~$ exit
- logout
- [colt@fallback-os ~]$ xauth add ubuntu/unix:0 . 7a2ce90a55eea0c195a05666ba3d9f3a
- [colt@fallback-os ~]$ xauth list
- fallback-os/unix:0 MIT-MAGIC-COOKIE-1 7a2ce90a55eea0c195a05666ba3d9f3a
- ubuntu/unix:0 MIT-MAGIC-COOKIE-1 7a2ce90a55eea0c195a05666ba3d9f3a
- [colt@fallback-os ~]$ lxc restart mycontainer
- [colt@fallback-os ~]$ lxc config device add mycontainer X0 disk path=/tmp/.X11-unix/X0 source=/tmp/.X11-unix/X0
- Device X0 added to mycontainer
- [colt@fallback-os ~]$ lxc config device add mycontainer Xauthority disk path=/home/ubuntu/.Xauthority source=${XAUTHORITY}
- Device Xauthority added to mycontainer
- [colt@fallback-os ~]$ lxc config device add mycontainer mygpu gpu
- Device mygpu added to mycontainer
- [colt@fallback-os ~]$ lxc config device set mycontainer mygpu uid 1000
- Error: Invalid key=value configuration: 1000 <- why i get this?
- [colt@fallback-os ~]$ lxc config device set mycontainer mygpu gid 1000
- Error: Invalid key=value configuration: 1000
- [colt@fallback-os ~]$ lxc config device set mycontainer gpu gid 1000
- Error: The device doesn't exist
- [colt@fallback-os ~]$ lxc config device set mycontainer mygpu gid 1000
- [colt@fallback-os ~]$ lxc config device set mycontainer mygpu uid 1000
- [colt@fallback-os ~]$ lxc restart mycontainer
- [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
- ubuntu@mycontainer:~$ id
- 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)
- ubuntu@mycontainer:~$ ls -la
- total 20
- drwxr-xr-x 1 ubuntu ubuntu 184 Jan 8 20:12 .
- drwxr-xr-x 1 root root 12 Jan 8 19:48 ..
- -rw------- 1 nobody nogroup 271 Jan 8 19:56 .Xauthority
- -rw------- 1 ubuntu ubuntu 115 Jan 8 19:55 .bash_history
- -rw-r--r-- 1 ubuntu ubuntu 220 Apr 4 2018 .bash_logout
- -rw-r--r-- 1 ubuntu ubuntu 3771 Apr 4 2018 .bashrc
- -rw-r--r-- 1 ubuntu ubuntu 807 Apr 4 2018 .profile
- drwx------ 1 ubuntu ubuntu 30 Jan 8 19:48 .ssh
- -rw-r--r-- 1 ubuntu ubuntu 0 Jan 8 19:50 .sudo_as_admin_successful
- srwxrwxrwx 1 ubuntu ubuntu 0 Jan 8 20:12 pulse-native
- ubuntu@mycontainer:~$ exit
- logout
- [colt@fallback-os ~]$ printf "uid $(id -u) 1000\ngid $(id -g) 1000" | sudo lxc config set mycontainer raw.idmap -
- [sudo] password for colt:
- [colt@fallback-os ~]$ lxc restart mycontainer
- [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --user ubuntu --login
- ubuntu@mycontainer:~$ id
- 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)
- ubuntu@mycontainer:~$ ls -la
- total 20
- drwxr-xr-x 1 ubuntu ubuntu 184 Jan 8 20:14 .
- drwxr-xr-x 1 root root 12 Jan 8 19:48 ..
- -rw------- 1 ubuntu ubuntu 271 Jan 8 19:56 .Xauthority
- -rw------- 1 ubuntu ubuntu 130 Jan 8 20:12 .bash_history
- -rw-r--r-- 1 ubuntu ubuntu 220 Apr 4 2018 .bash_logout
- -rw-r--r-- 1 ubuntu ubuntu 3771 Apr 4 2018 .bashrc
- -rw-r--r-- 1 ubuntu ubuntu 807 Apr 4 2018 .profile
- drwx------ 1 ubuntu ubuntu 30 Jan 8 19:48 .ssh
- -rw-r--r-- 1 ubuntu ubuntu 0 Jan 8 19:50 .sudo_as_admin_successful
- srwxrwxrwx 1 ubuntu ubuntu 0 Jan 8 20:14 pulse-native
- ubuntu@mycontainer:~$ ls -la /tmp/.X11-unix/X0
- srwxrwxrwx 1 nobody nogroup 0 Jan 8 06:06 /tmp/.X11-unix/X0
- ubuntu@mycontainer:~$ echo $DISPLAY
- :0
- ubuntu@mycontainer:~$ glxinfo -B
- name of display: :0
- display: :0 screen: 0
- direct rendering: Yes
- Extended renderer info (GLX_MESA_query_renderer):
- Vendor: X.Org (0x1002)
- Device: Radeon RX 580 Series (POLARIS10, DRM 3.32.0, 5.2.11-arch1-1-ARCH, LLVM 8.0.0) (0x67df)
- Version: 19.0.8
- Accelerated: yes
- Video memory: 8192MB
- ...
- ubuntu@mycontainer:~$ pactl info
- Connection failure: Connection refused
- pa_context_connect() failed: Connection refused
- ubuntu@mycontainer:~$ echo export PULSE_SERVER="tcp:`ip route show 0/0 | awk '{print $3}'`" >> ~/.profile
- ubuntu@mycontainer:~$ mkdir -p ~/.config/pulse/
- ubuntu@mycontainer:~$ echo export PULSE_COOKIE=/home/ubuntu/.config/pulse/cookie >> ~/.profile
- ubuntu@mycontainer:~$ exit
- logout
- [colt@fallback-os ~]$ lxc config device add guiapps PACookie disk path=/home/ubuntu/.config/pulse/cookie source=/home/${USER}/.config/pulse/cookie
- Device PACookie added to guiapps
- [colt@fallback-os ~]$ lxc exec mycontainer -- sudo --login --user ubuntu
- ubuntu@mycontainer:~$ pactl info
- Connection failure: Connection refused
- pa_context_connect() failed: Connection refused
- ubuntu@mycontainer:~$ ls -la .config/
- total 0
- drwxr-xr-x 1 ubuntu ubuntu 10 Jan 8 21:04 .
- drwxr-xr-x 1 ubuntu ubuntu 210 Jan 8 21:04 ..
- drwxr-xr-x 1 ubuntu ubuntu 12 Jan 8 21:06 pulse
- ubuntu@mycontainer:~$ ls -la .config/pulse/cookie
- -rw------- 1 ubuntu ubuntu 256 Jan 8 21:06 .config/pulse/cookie
- ubuntu@mycontainer:~$ sha1sum ~/.config/pulse/cookie
- af2fbe6e936be1a5d63a02af0312a9c1770a1dcf /home/ubuntu/.config/pulse/cookie
- ubuntu@mycontainer:~$ sha1sum ~/.config/pulse/cookie
- af2fbe6e936be1a5d63a02af0312a9c1770a1dcf /home/ubuntu/.config/pulse/cookie
- ubuntu@mycontainer:~$ sha1sum ~/.config/pulse/cookie
- af2fbe6e936be1a5d63a02af0312a9c1770a1dcf /home/ubuntu/.config/pulse/cookie
- ubuntu@mycontainer:~$ pactl info
- Connection failure: Access denied
- ubuntu@mycontainer:~$ cat .profile
- ...
- export PULSE_SERVER=tcp:192.168.100.165
- export PULSE_COOKIE=/home/ubuntu/.config/pulse/cookie
- ubuntu@mycontainer:~$ pactl info
- Server String: unix:/home/ubuntu/pulse-native <- change PULSE_SERVER to this one
- Library Protocol Version: 32
- Server Protocol Version: 32
- Is Local: yes
- Client Index: 28
- Tile Size: 65472
- User Name: colt
- Host Name: fallback-os
- Server Name: pulseaudio
- Server Version: 12.2
- Default Sample Specification: s16le 2ch 44100Hz
- Default Channel Map: front-left,front-right
- Default Sink: alsa_output.pci-0000_09_00.3.analog-stereo
- Default Source: alsa_output.pci-0000_09_00.3.analog-stereo.monitor
- Cookie: 98e5:d11b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement