/srv/irclogs.ubuntu.com/2016/05/17/#ubuntu-kernel.txt

cagmzis it safe to statically allocate 256k bytes in my kernel module?00:50
=== yuning-afk is now known as yuning
=== Guest11953 is now known as alvesadrian
=== alvesadrian is now known as adrian
=== yuning is now known as yuning-afk
=== mamarley_ is now known as mamarley
=== Guest48104 is now known as adrian
=== tinoco is now known as tinocoff
=== alvesadrian is now known as adrian
=== tinocoff is now known as tinoco
cinchwhere can i get a CK enabled kernel for 16.04?19:13
cinchwith the BFQ scheduler19:13
TJ-anyone around? got a sysadmin 'on the line' with a server that is failing to install the kernel package for ubuntu-server 16.04, we're in the /target/ and have managed to narrow it down to a problem with the linux-image-4.4.0-21-generic postinst script19:16
DJVGHi :-)19:17
TJ-DJVG: now we know we can manually cause the initrd.img to be generated, it makes it possible to remove it and rerun the postinst script with -x and try to capture the error. Let's wait 5 minutes see if apw or timg or someone is interested in this. If you want to set up the ssh shell in the meantime that'd be really useful19:19
DJVGTJ-: Do you prefer a shell inside or outside the chroot?19:20
TJ-DJVG: outside :)19:20
cinchTJ-, any idea what might cause the problem?19:28
cinchodd that a kernel fails to install19:28
TJ-cinch: yes, the postinst script is calling the initrd script with incorrect arguments. 19:29
cincha-ha!19:30
TJ-DJVG: its 20:30 here and I need to go to dinner. I'll return in ~20 minutes if you want to wait around. If not, no worries, I can still write up a bug report although we won't have an identified cause19:33
DJVGTJ-: I've got the time, no worries!19:34
DJVGTJ-: Took me a while to put this machine in a different vlan and compile dropbear static but it's working now :)19:48
DJVGTJ-: You can ssh as root to 91.148.253.252 without a password (I know dangerous but it's a tmp solution) :-)19:49
DJVGAnd ofcourse I monitor haha19:49
cinchoh cool ill login ;)19:50
DJVGcinch: Seeing anything interesting? ;)19:52
cinchi see systemd and a debian installer ^.^19:52
DJVGcinch: Great! ;) Hopefully the kernel devs can figure out later why the installer does not pass the right parameters to update-initramfs19:54
cinchthe kernel sources are unpacked in /usr/src19:54
TJ-I'm back. DJVG you could relay me through a shared tmux if you wanted :)19:59
DJVGTJ-: Meh, I know, but this way you can do whatever you want. This machine is not in production and has no data on it20:01
DJVGTJ-: So it's fine20:01
DJVGTJ-: I had to compile dropbear anyway20:02
TJ-DJVG: I was thinking more along the lines of 'more eyes' 20:02
TJ-I thought dropbear was in the repos :)20:02
DJVGTJ-: Maybe it is but I'm sure I had to change my PATH to get the libs etc...20:02
DJVGTo be able to run it outside the chroot20:03
TJ-ahhh, yes it is DLed, I thought it was static. Must have been thinking about busybox for initrd20:04
TJ-Right, I'll connect now20:04
DJVGTJ-: 10-420:06
TJ-ok, little problem... dropbear seems to be limiting what I can get. no "which" no "chroot" :D20:06
TJ-oh, PATH :)20:07
DJVGYeah20:07
TJ-I'm in a chroot now, will mess with the installer postinst script now20:08
DJVGTJ-: Go ahead, she's all yours ;)20:10
TJ-interesting! since we generated a good initrd.img it won't fail20:11
TJ-So, some flag is expected to exist but doesn't on first install, breaks it20:12
DJVGTJ-: If you want I can re-run the install to the point it fails and give you access again20:12
TJ-DJVG: I'm just reading the postinst Perl script, see if I can spot anything obvious20:13
cinchreading perl 20:16
DJVGTJ-: Quite funny to see it fails in a virtualbox machine too with the same error20:17
cinchperl -> deobfuscator -> brain20:17
TJ-going to focus on the core error from the original syslog: "mkinitramfs: failed to determine device for /" 20:17
DJVGTJ-: I'm getting the idea that there's something wrong with the installer itself. Not sure though, I'm not really into the inner workings of the installer20:19
TJ-looking at /usr/share/initramfs-tools/hook-functions:386:          echo "mkinitramfs: failed to determine device for $dir" >&220:20
cinchlet's say i want to log each process that was started (with its command line parameters), how would i go about it20:22
TJ-damn! the UUIDs are different20:23
TJ-see http://paste.ubuntu.com/16481625/20:24
DJVGTJ-: That's interesting20:25
TJ-and the code in hook-functions:dep_add_modules_mount() relies on the /dev/disk/by-uuid/ symlinks 20:25
TJ-which explains why it failed with the error "failed to determine device for /"20:25
cinchwhy is the uuid different?20:25
DJVGTJ-: Yes, it was trying to use the old(?) UUID20:26
DJVGTJ-: That's quite weird20:26
DJVGTJ-: Wasn't it refreshed after a mkfs?20:26
TJ-DJVG: there were existing partitions on /dev/sda and you replaced them?20:28
TJ-DJVG: were they the same (3 parts, same size) ?20:28
DJVGTJ-: It might be possible yes, I can't be entirly sure because I tried to install it multiple times and it's possible I didn't re-init the part. table20:28
TJ-but whatever, if you repartitioned then partprobe should have been called, and that should have triggered udev to re-do the symlinks20:30
TJ-let me see if there's a hidden udev dlog file20:30
TJ-hmmm, nothing I can find, so that doesn't help. I wonder if there's some clue in syslog though20:36
TJ-when it booted: 17:32:31 kernel: [    2.576702]  sda: sda1 sda2 sda320:38
DJVGTJ-: It's possible that I didn't remove the part. table and only assigned the right mountpoints + mkfs on thos part's20:39
DJVGparts*20:39
TJ-right, but if that's all you did then the UUIDs would be correct. This looks as if there were partitions on sda, udev creates the symlinks, the installer re-partitions and/or re-formats the file-systems in sda1 and sda2 but udev doesn't get informed and therefore the /dev/disk/by-uuid/ symlink names are not updated20:44
TJ-so, when allocating existing partitions/file-systems for mountpoints maybe if you set to 'format' it doesn't cause/trigger the symlinks to be updated20:45
TJ-that sounds like a scenario that could be reproduced easily, too20:45
TJ-I'll pull in the -server ISO and try it in a VM here20:46
DJVGTJ-: Yes, if you want me to do anything let me know. I might need to grab some sleep soon but I can keep this machine running if you want. Again, no important data on that thing20:47
TJ-the bit that has me stumped right now though, is why it now works since the UUIDs are the same20:47
TJ-DJVG: if you could keep it as-is that would be great, I can hopefully pull some more diagnostics off it into a bug report20:47
DJVGTJ-: I don't know how how the installer performs the kernel thing but I can suspect a change in behaviour if you want to run it inside or outside the chroot20:48
TJ-DJVG: and I'll try to reproduce here in a VM too, once its reproducable you can get on with completing the install on that machine :)20:48
DJVGTJ-: That's fine, I can keep it up as long as you want :)20:49
TJ-DJVG: let me open a bug report now and give you the ref. so you can check on progress if you need to go sleep20:50
DJVGTJ-: If I get disconnected from this you can alway reach me at djvg@djvg.net (pgp: 213FEC83)20:50
DJVGSure20:51
cinchso why didnt initrd get its params20:53
cinchwhat was the issue, uuids not matching?20:53
TJ-bug 158289920:57
ubot5bug 1582899 in base-installer (Ubuntu) "in-target: mkinitramfs: failed to determine device for /" [Undecided,New] https://launchpad.net/bugs/158289920:57
cinchso the installer failed to detect new UUIDs21:01
TJ-well that's udev's job, when a device is added/changed21:02
cinchkinda obvious bug... could have been easily avoided21:03
TJ-but the reformat didn't repartition so presumably it needs triggering manually to update the UUID link names21:03
TJ-Still got to be able to reproduce it to be sure this is the cause, it's only a hypothesis for now21:03
TJ-DJVG: I've copied off syslog and partman and attached them to the bug report. I'll look for other useful logs that might help21:04
DJVGTJ-: Sure, no problem. I'm going to get some rest now. Thanks for all your help and I've subscribed to the bug to keep me posted. Thanks again!21:05
DJVGTJ-: Btw, if you want to le me know something just touch something in /tmp or you can always contact me by e-mail (like if you're done with the server).21:06
TJ-DJVG: I'll use the email if it's none public none-bug related21:08
DJVGTJ-: Perfect!21:08
TJ-DJVG: I've added your key to my keyring21:09
TJ-Time for a strong coffee I think :)21:09
TJ-great time for launchpad to start generating errors - can't attach files now21:14
cinchstrong coffee? what timezone, we sleep here21:15
TJ-UK here21:17
cagmzfor character device modules, what does the file * in ssize_t (*read) (struct file *, char *, size_t, loff_t *); refer to? i see calls to these methods with an file descriptor to the device file itself21:18
apwcagmz, right, they should have a kernel file descriptor which points to the chacter device21:21
cagmzwhy does the device need to be referenced, though? does the kernel find the device using the fd given in read(), write(), etc?21:21
apwcagmz, because these are file operations against a file, passed file* representst the kernel view of teh file21:25
apwthat file* is pointed to by the fd numbers given in read/write21:25
cagmzah!! because the kernel doesn't differentiate between devices and files, right? i keep making them distinct but linux treats them the same21:25
apwthe are "files" in the strictest sense in the kernel view21:26
cagmzim supposed to be writing a device that reads/write to an internal data structure in the kernel using IOCTL(). so far, I have created a struct that is passed from user space to kernel space with the # of bytes to write, but I also need to pass the actual string to write. would it be ok to use 2 separate ioctl calls? 1 to set the control register for the device (with # of bytes to write), and ioctl() with a pointer to th21:55
cagmze actual string?21:55
mjg59Why not include all of that in the struct?22:00
cagmzah, true! I have a control struct with * of bytes to write/read. I could use a union to store a pointer to the message. but if I do this, will the kernel be able to access the char *?22:01
mjg59It'll need to do copy_from_user()22:02
mjg59You can't directly dereference userspace pointers in the kernel22:02
cagmzfor example, in user space, i could have char msg[] = "cat". then I do ctrl.data.message = &msg. if I use copy_from_user, will the kernel copy the message or just a pointer to it?22:02
mjg59The kernel will get a pointer22:03
cagmzah ok, so I would need to use strcpy to store the message in teh struct first, right?22:03
mjg59No22:03
cagmzhow about passing in ctrl.data.message = &msg, using copy_from_user to copy that whole struct, then using copy_from_user on cmd.data.msg ptr to copy to the module?22:05
mjg59Yes22:06
mjg59That'll work22:06
mjg59But remember that someone could submit a structure with an invalid length22:07
mjg59Don't assume that the length passed in corresponds to the real length of the string22:07
mjg59You'll want to null terminate it yourself before doing anything with it22:07
mjg59Also probably set some upper bound on the size, otherwise someone can DoS you by just allocating huge quantities of kernel memory22:07
cagmzthe data structure inside the device is 256k bytes, so I will check that the ctrl.num_bytes < 256k. and while writing to teh device, I will stop before 256k. this is just academic though22:08
cagmzmjg59: do you think something like this would work? https://bpaste.net/show/6b4b9ff894e8 can i declare a char * alongside bits in a struct?22:16
=== JanC is now known as Guest42191
=== JanC_ is now known as JanC

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