classic-snap icon indicating copy to clipboard operation
classic-snap copied to clipboard

Using classic clobbers /dev/pts on ubuntu-core 16 systems

Open zyga opened this issue 6 years ago • 2 comments

tl;dr; installation and usage of classic changes the permission of /dev/pts as follows:

-7 4 2:3 / /dev/pts rw,nosuid,noexec,relatime shared:6 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
+7 4 2:3 / /dev/pts rw,nosuid,noexec,relatime shared:6 - devpts devpts rw,mode=666,ptmxmode=666

This can be reproduced by running spread -shell-before google:ubuntu-core-16-64:tests/main/ubuntu-core-classic and then following with those commands:

State before

google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# mountinfo-tool /dev/pts
22 21 0:14 / /dev/pts rw,nosuid,noexec,relatime shared:49 - devpts devpts rw,gid=5,mode=620,ptmxmode=000

Installation & startup of classic

google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# sudo snap install --devmode --beta classic
classic (beta) 16.04 from Canonical✓ installed
google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# mountinfo-tool /dev/pts
22 21 0:14 / /dev/pts rw,nosuid,noexec,relatime shared:49 - devpts devpts rw,gid=5,mode=620,ptmxmode=000
google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# classic
Creating classic environment
(redacted for brevity)
(classic)test@jul251846-303208:~$ exit
logout

State after

At this point /dev/pts is changed, even after you remove the snap.

google:ubuntu-core-16-64 .../tests/main/ubuntu-core-classic# mountinfo-tool /dev/pts
22 21 0:14 / /dev/pts rw,nosuid,noexec,relatime shared:49 - devpts devpts rw,mode=666,ptmxmode=666

zyga avatar Jul 25 '19 19:07 zyga

The working theory based on the old behaviour of devpts being somehow magically shared unless newinstance mount option is used has been defeated. Since 2016 this behaviour is gone and all mounts are independent. See: https://github.com/torvalds/linux/commit/eedf265aa003b4781de24cfed40a655a664457e6

zyga avatar Jul 26 '19 06:07 zyga

Does the xenial kernel have that patch backported to it? It looks like it was introduced 2 months after xenial was released and you mentioned this is on uc16.

jdstrand avatar Jul 26 '19 17:07 jdstrand