/srv/irclogs.ubuntu.com/2015/12/21/#snappy.txt

=== chihchun_afk is now known as chihchun
=== chihchun is now known as chihchun_afk
=== chihchun_afk is now known as chihchun
dholbachgood morning07:08
=== chihchun is now known as chihchun_afk
fgimenezgood morning08:10
=== chihchun_afk is now known as chihchun
=== beowulf is now known as Guest23806
liuxgdholbach, sorry, my network is not stable. did you see my question?09:00
dholbachliuxg: no, I didn't09:00
liuxgdholbach, do you if there is anyway to create a ramdisk in snappy? for the webcam example, I want to capture the image into memory instead of beng into the disk, which is a slow operation.09:00
dholbachI have no idea09:00
dholbachmaybe lool or asac or somebody else knows?09:01
liuxgdholbach, the above was my question. alright! thanks!09:01
liuxgdholbach, lool asac I have tried to create a ramdisk in the code, but "mount" seems not successful.09:02
dholbachI'm sorry -I have no idea09:02
liuxgdholbach, I have posted it to the mailinglist, hopefully, there is a reply for it :)09:03
dholbachok cool09:03
asacliuxg: in the webcam code? you need special permissions for that i assume due to sandboxing. check syslog for errors related09:25
Guest23806sergiusens: /Volumes/09:31
=== Guest23806 is now known as beowulf
=== chihchun is now known as chihchun_afk
=== plars-off_ is now known as plars-off
=== john-mca` is now known as john-mcaleely
* Chipaca quietly puts the kettle on11:15
kyrofaGood morning everyone12:29
=== verterok` is now known as verterok
* davmor2 changes Chipaca nick to polly (https://en.wikipedia.org/wiki/Polly_Put_the_Kettle_On)12:50
liuxglool, ping13:08
liuxgkyrofa, ping13:08
kyrofaliuxg, pong13:08
liuxgkyrofa, I just saw that you got the fix for the broken symlink. does it mean that I can pull the latest source to get it working?13:09
kyrofaliuxg, if you clone the github repo and use the 1.x branch, yes, that will work like you're used to AND have the bugfix. It'll be officially released soon as well13:10
liuxgkyrofa, ok. then I wait for the fix. by the way, I recently tried the license example, and I found it not working. https://bugs.launchpad.net/snapcraft/+bug/152745313:11
ubottuLaunchpad bug 1527453 in Snapcraft "license text is not prompted during the snappy installation" [Undecided,New]13:11
kyrofaliuxg, don't quote me on this, but I think that's not implemented yet13:11
kyrofaliuxg, but I'll look into it a bit further once I finish backporting a few more things for 1.x13:12
liuxgkyrofa, OK. thanks! I just tried it since it was documented there. By the way, do you if there is any way to mount a ramdisk in snappy system? I find that I/O operation is slow, and I want to use a ramdisk for my webcam picture capturing.13:13
kyrofaliuxg, not sure about that one13:16
liuxgkyrofa, it is OK. thanks for helping13:17
kyrofaliuxg, can you explain the use-case a little more though?13:18
liuxgkyrofa, in the current example https://github.com/ubuntu-core/snapcraft/tree/master/examples/webcam-webui, it saves the picture into disk every 10 second. currently, I implement a client to access the picture to display it on my ubuntu phone. I want to have higher frequency. The I/O to disk is slow compared to the ramdisk.13:19
liuxgkyrofa, a file in the memory is better in this sense. the sample uses fswebcam to capture the picture.13:20
kyrofaliuxg, ah, okay. Agreed that with the way this works putting the picture in memory would be faster, but there are better ways to accomplish what you're wanting without requiring it13:21
liuxgkyrofa, really? I am all your ears :) what is the better solution?13:22
kyrofaliuxg, first of all, I'm assuming that since the webcam demo saves to a directory it does not display video. You need to refresh to see a new picture?13:23
kyrofa(I've not run it myself)13:23
liuxgkyrofa, in its way, it just captures the picture every 10 seconds. In my own implementation, I can initiation a http request to get a picture, and I can control the frequency to get the picture. it13:24
kyrofaliuxg, gotcha, so YOU want video13:24
sturmflutWhy not directly take the webcam picture inside the HTTP request, and never store it13:25
liuxgkyrofa, yeah, some kind of the that effect, like home security though frame rates not so high.13:25
kyrofasturmflut, quit stealing my thunder!13:25
kyrofaliuxg, no streaming video ever caches each frame anywhere, not even in a ramdisk13:25
liuxgsturmflut, the things fswebcam app captures picture into a file. that is what i know. if it captures into memory, that is definitely better.13:26
kyrofaliuxg, you should probably be accessing the camera directly13:26
sturmflutliuxg: The manpage for fswebcam says 'The PNG or JPEG image can be sent to stdio using the filename "-"'13:26
liuxgkyrofa, yes, you are right. video streaming is another option. vlc could be one for the purpose. I have not tried it yet.13:26
kyrofaliuxg, grab a frame from it, and fire the frame off via some UDP-based protocol, e.g. rtp13:27
sturmflutSo have your HTTP server call it like that and pipe the output13:27
liuxgkyrofa, hmm, I have not tried it yet, and I do not know how it goes.13:28
kyrofaliuxg, if you really want to use fswebcam, sturmflut's suggestion would work as well13:28
kyrofaliuxg, but using a ramdisk with your use-case is layering hacks upon hacks13:29
liuxgkyrofa, it seems that "mount" is not supported due to security. http://paste.ubuntu.com/14127715/13:30
kyrofaliuxg, indeed, that doesn't surprise me13:31
liuxgsturmflut, thanks for your tip. in that case, how can the command look like?13:31
kyrofaliuxg, you can exec fswebcam from your app and setup the pipes in code if you want it all in the project rather than a script13:32
liuxgkyrofa, yeah, I can do it in golang to exec fswebcam13:34
kyrofaliuxg, that would probably be the slickest way13:34
kyrofaliuxg, but you can also write your server to read from stdin and pipe them together using the shell as normal13:35
kyrofaliuxg, `command1 | command2`13:35
liuxgkyrofa, sounds interesting though I have never tried it.13:37
loolliuxg: pong13:38
liuxglool, thanks. yeah, just now, discussed with kyrofa about whether it is possible to make a ramdisk in a snap app.13:39
loolit is possible, but if you need the mount() syscall, you'll need an unconfined snap or a custom apparmor policy13:40
loolyou can create ramdisks without the mount syscall though13:40
lool(or if you need chroot())13:40
liuxglool, how can I do that? currently, in my script, I do it like http://paste.ubuntu.com/14127715/, it gives me the error.13:41
liuxglool, how to create a custom policy for an app? it would be good to have an example for it.  thanks13:42
loolliuxg: there are examples, but I'm trying to find a recent one given the syntax has changed a bit in the last months13:42
liuxglool, this example seems to have the one, but it is not based on the snapcraft http://bazaar.launchpad.net/~snappy-dev/snappy-hub/snappy-examples/files/head:/framework-template/. By the way, if an app uses custom apparmor policy, can the app be uploaded to store?13:45
loolliuxg: right exactly13:46
loolliuxg: typically an app with a custom policy is going to trigger manual review, so we'll need some way to audit that it's legit to use these permissions13:46
liuxglool, I do not know how the syntax looks like in the snapcraft syntax.13:46
loolliuxg: in snapcraft, you basically have the package.yaml in the main snapcraft.yaml file13:47
loolliuxg: basically snapcraft.yaml contains the template copied into meta/package.yaml before snappy build13:47
liuxglool, so, the syntax for them are the same?13:47
loolliuxg: well most of the package.yaml is expressed in a subset of the snapcraft.yaml -- snapcraft.yaml also lists e.g. parts13:48
liuxglool, for my case, I need to customize a file like http://bazaar.launchpad.net/~snappy-dev/snappy-hub/snappy-examples/view/head:/framework-template/meta/framework-policy/seccomp/policygroups/client, add the mount system call, right?13:48
loolliuxg: yes13:49
loolliuxg: if you're confident this is the only thing, you can go ahead and do that; if you need to debug, there are snappy-security tools to help you do this (or look in dmesg); if you want to get your app running first, and then tune the permissions, you can set it to unconfined13:49
liuxglool, do you have a complete example for custom security policy based on snapcraft? I think a lot of developers are interested to know this.13:50
loolliuxg: not handy13:50
liuxglool, by the way, how to set an app to "unconfined" in snapcraft.yaml file?13:51
loolliuxg: http://bazaar.launchpad.net/~lool/+junk/quagga-snap/files is a snapcraft based snap which sets custom caps (but no custom apparmor policy)13:51
kyrofaliuxg, remember that anything with custom security policies will require manual review13:51
loolliuxg: instead of "networking", put "unconfined" there13:51
liuxgkyrofa, thanks for reminding that. lool just mentioned that.13:53
liuxglool, do you mean that we can change the "networking" there to "unconfined", then it is done?13:54
liuxglool, I mean this is the file http://bazaar.launchpad.net/~lool/+junk/quagga-snap/view/head:/snapcraft.yaml13:54
loolliuxg: this is just to point you the spot where caps are set13:55
loolliuxg: you can remove all of networking, network-admin etc. and just list unconfined13:55
liuxglool, I know. the snap still uses the default security template, right? for custom one, we need to define something like "unconfined"13:56
sturmflutliuxg: I just did it for fun, but it can even be solved in one line of bash13:56
sturmflutwhile /bin/true; do (echo -ne "HTTP/1.1 200 OK\nContent-type: image/jpeg\n\n"; fswebcam -) | nc -l 12345; done13:56
sturmflutWith a proper version of netcat you can even avoid the short period required to re-open the socket13:57
liuxgsturmflut, sounds an interesting hack. do you try this on your destkop?13:58
sturmflutliuxg: On my notebook13:58
liuxgsturmflut, I have been trying the example on my RaspBerry pi. it may not have a display yet. Anyway, it is good to see it works. I will try to your way to do it in the code.14:00
sturmflutliuxg: It is pretty slow, fswebcam takes a long time to fetch the picture each time14:00
loolliuxg: unconfined is a template which means give me all permissions14:01
liuxgsturmflut, it depends on the resolution as well.14:01
loolliuxg: if you want your own template, you can't use caps; rather you'll have to pass a .apparmor and a .seccomp file under your meta/ dir14:01
loolliuxg: but I haven't done that in snapcraft myself14:01
loolso I can't provide a recent example14:01
liuxglool, thanks. so if I want to make my snap an unconfined, I just do sth like http://paste.ubuntu.com/14127918/, it should be fine, right?14:03
loolliuxg: yeah, seems about right14:03
liuxglool, perfect. It is good to know. I have been reading Snappy Ubuntu Core - Application Developer Manual 15.04, but it is not so clear to me at all :)14:04
loolliuxg: ah, perhaps we need to improve some sections then  :-)14:05
loolliuxg: if you would like to suggest changes, we'd be happy to take them; there is definitely room for improvement14:06
liuxglool, in fact, more working examples will be very beneficial to the developers. Sometimes, it is hard to explain without examples. I have fed back some problems in the documents, and they are corrected!14:06
liuxglool, debugging is important for developing snaps. It would be good to have more contents to show how to debug security issues.14:08
liuxglool, from developers point of view, it would be good to have a graphic tools to generate a useful snapcraft.yaml file. that would be very useful.14:09
loolack; there are specific tools to help debugging security issues14:11
lool"Security policy debugging commands reference" in the manual14:11
liuxglool, in fact, in the ubuntu phone development, I also met the same problem. the log does not say the missing caps. it is hard to interpret the the messages there. I would expect a clear messaging like "networking is missing in your app".14:13
loolliuxg: right, fair point14:14
loolthe latest version for snappy tries to make suggestions, but it's never perfect14:15
liuxglool, in fact, android is doing this way and it is very easy to debug. For us, it is just a kind of try and try.14:16
liuxglool, it could be possible that an app grant all of the caps just purely want to make it work. In fact, maybe some of them are not needed at all.14:17
=== cyphermox_ is now known as cyphermox

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!