/srv/irclogs.ubuntu.com/2017/11/18/#ubuntu-server.txt

drabany idea why an iso that would boot just fine locally (in virtualbox) would not boot over the network? I get an error about root device not being found and get dropped into initramfs18:03
TJ-drab: sharing it via NFS ?18:08
drabTJ-: no, I'm loading the whole iso via memdisk, boot over http, and I think I figured out the problem18:17
drabI removed quiet splash and I can see the error /init: line 7: can't open /dev/sr0: no medium found18:17
drabwhich makes sense, when I test with virtualbox it's mounted as the cdrom18:17
drabwhen it's pulled in via network it's not... and I've no idea where it is18:17
drabI wonder why other isos work, like UBCD18:18
drabbut not ubuntu liveCD18:18
TJ-right. I recall a similar issue about 10 years ago whereby on certain Dell PowerEdge servers with SCSI CD-ROM, the installer would boot and then fail trying to mount /dev/sr0 - in that case the initrd didn't contain the correct scsi drivers18:19
drabnot sure it's a driver issue, I think it's a path issue, like I said it works just fine with UBCD or even systemrescueCD18:24
drabso the approach to use memdisk + iso raw works if the iso is setup in a certain way, just not sure what way that is18:24
TJ-yeah, I was just pointing out another failure mode that might be related18:24
drabfair enough, will keep that in mind, thanks18:24
TJ-could it be the path on the kernel command-line?18:24
TJ-if you're dropped to shell in the initrd, you can examine the state of the system18:25
drabyeah I'm trying to, cant figure out how, initramfs has no fdisk18:25
drabnot sure how to list the available drives and stuff18:25
TJ-"cat /proc/partitions"18:25
TJ-also /dev/block/18:26
draboh, right, forgot about /proc, will try that, rebooting into it, was just testing UBCD again18:26
TJ-I'm trying to figure out why your error report is /init line 7 ... that isn't from the standard initramfs-tools/init18:27
TJ-which ISO image is it so I can check?18:27
drabit's the ubuntu desktop 64bit, I then mounted the squash file and removed all bunch of porgram to slim it down, but didn't touch any of the init/kernel stuff so that should be intact18:29
drab16.0418:29
TJ-OK, 16.04 (the original) or 16.04.1, .2, .3 ?18:34
drab.318:34
drabI see running casper-premount script, then the flood begins18:36
drabstdin: not a typewriter18:37
drab /init: line 7: can't open /dev/sr0: No medium found18:37
drabrepeats that about a hundred times and then drops me in initramfs saying "unable to find a medium cotaining a live file system"18:37
drabwhich looking at /proc/partitions I guess makes sense, I don't see any place where the iso has been mounted in memory, but maybe I'm misunderstnding how memdisk works18:40
drabhttp://www.syslinux.org/wiki/index.php?title=MEMDISK18:40
TJ-drab: OK, it's not about the /init! just extracted it and it is the /usr/share/initramfs-tools/init file. Line 7 is "[ -d /dev ] || mkdir -m 0755 /dev" ... so it must be referring to some file being sourced or called18:40
drabthe thing tho, ubcd and systemrescuecd work, so somehow it's possible to boot the iso just fine over http18:40
TJ-right, but need to know which bit of code is failing so as to know what to give as parameters to fix it18:44
TJ-what's the actual kernel command line? (cat /proc/cmdline) ... does it include boot=caper18:51
drabTJ-: I think I'm gonna try a diff route, with squashfs booting, because this way even if I get it to work I'm still ending up with a much larger image than I need and a two stages boot18:52
drabTJ-: yeah it does18:52
drabboot=cascpe initrd=/casper/initrd.lz --- priority=low18:52
drabcasper*18:52
drabthat's the whole cmdline18:52
TJ-drab: ok, so we know ./scripts/casper should be executed18:52
TJ-the only thing 'cd' related was line 7 of that file: "scripts/casper:7:mountpoint=/cdrom "18:53
TJ-but that wouldn't cause the line 7 error you reported18:53
drabyeah that's probably it, since it's trying to mount /dev/sr0, the cdroom, to access the install medium18:53
drabwhy not?18:53
drabit seems to make sense to me18:53
TJ-because it's only a variable assignment, not a command18:53
drabinitrd has booted and is trying to mount the installation  medium on /cdrom18:53
draboh, I see18:53
TJ-can't open /dev/sr0: no medium found suggests a "mount" command18:54
drabright18:54
TJ-one thing I just noticed in ./scripts/casper::mountroot() is it writes to "./casper.log" ... might be something useful in there19:13
TJ-Got it!19:24
drabTJ-: ?19:26
drabin the meantime I failed badly at squashfs :(19:26
drabI gues sI don't understand the boot process enough19:26
draband this seems mighty hard, much harder than I thought it'd be at least19:26
drabin theory it seems pretty damn simple... fetch a file containing a root filesystem and mount it in ram, point init to that as the root device19:27
drabbut that seems asking for too much19:27
drabat most I got an installer session going with a debootstrapped squashfs19:27
drabbut I can't get it to boot into it as if it was a normal root19:28
TJ-./scripts/casper::mountroot() calls ./scripts/casper::find_livefs() which iterates over /sys/block/ then calls ./scripts/casper-helpers::get_fstype() which calls ./bin/fstype (from the klibc-utils package (/usr/lib/klibc/bin/fstype on an installed system), which returns "No medium found" - try it locally with an empty CD/DVD drive and you get: "/usr/lib/klibc/bin/fstype /dev/sr0" >> "/dev/sr0: No19:28
TJ-medium found"19:28
drabwow that's cool that you figured it out19:28
TJ-:)19:28
drabI'm still stuck with an unbootable system tho :(19:29
TJ-so, the upshot is, this is a warning as such not an error :)19:29
drabheh19:29
TJ-as in, it would be OK for CD-ROM drive to be empty (might be more than one in the system)19:29
drabmakes sense19:29
TJ-however, if that fs_type binary returns non-zero as well as reporting it, the scripts may exit if they're running with "set -e" (means shell will exit on any error status returns) Not sure ./init is doing that but it's worth considering19:30
TJ-so if you want to retry this method and it drops into the initrd shell again, the first thing I'd do would be to "cat ./casper.log" in case there's clues there19:31
drabI tried that, didn't see anything interesting19:31
TJ-were there messages in it? those can be valuable since tey indicate HOW FAR the execution got, and from which it is possible to figure out where the scripts died19:32
TJ-there's a fingerprint like line numbers19:32
TJ-s/there's/they're/19:32
drabnope, just the repetition of the stuff I typed above, but will look again19:32
drabthe thing is, looking at /proc/partitions, I don't know there the root OS is19:33
drabI thought the syslinux memdisk would have loaded the iso in ram19:33
draband the root be available at something like /dev/ram019:33
drabbut I didn't see anything like that19:33
TJ-it's in casper/filesystem.squashfs19:33
drabI give up... don't get why it's so damn hard, all the tech is there, ramdisks, fetching squashfs, mounting, root pivot20:40
drabbut I've tried about 2 dozen combinations and scripts and always end up with some problem or another20:40
TJ-what are you doing? local boot, or network?20:40
drabnetwork boot from iso or squashfs, not using nfsroot20:41
TJ-PXE then?20:41
drabso I can get a rescue system going to fix systems on the lan20:41
drabyeah, PXE20:41
drabI already pxe install stuff all the time, so the sever/dhcp and so on is in good shape20:41
draband like I said systemrescueCD or UBCD pxe boot from the iso work20:41
drabbut I want ubuntu/apt20:42
drabfor some reason there's no ubuntu based rescue CD, don't know why20:42
TJ-that's because the LiveCd is used for such things20:43
drabI found this in one of my last attempts, but it also fails: https://www.slax.org/en/20:44
drabin a very similar way... can't mount the root fs and drops me into a initramfs shell20:44
drabit's even got a slack ipxe fetching an iso from http/the internet, so you'd think that'd work, but fails in the same way20:45
TJ-have you considered it's your network?20:46
drabI have not, if it was why would: 1) pxe installs normally work 2) pxe boot of UBCD and systemrescueCD work ?20:47
drabisn't that enough to rule out it's my network?20:47
drabI can even pxe boot a squash filesystem I custom made20:47
drabthe only problem is that it boots into the installer20:47
drabinstead of booting a usable system20:47
TJ-we had a very similar issue in #maas where the network seemed to be dropping packets20:47
TJ-how is the rootfs being provided? what protocol?20:48
drabhttp20:48
drabfrom local server, same pxe is running on20:48
TJ-you're using PXE > memdisk > ISO ?20:49
drabthat was the hope, yes20:49
TJ-what's the PXE/TFTP config for the Ubuntu menu entry?20:50
draband if I use nfsroot that also works, booting the liveCD "Try without installing"20:50
drabsec20:50
drabhttp://dpaste.com/305NG8W20:51
drabthe iso is a straightdownload from ubuntu.com20:51
TJ-Question: for the working ISO boots, are they all contained within their initrd.img files? no additional rootfs to be fetched?21:06
TJ-The thing is memdisk uses x86 real-mode interrupts, and loads the image into RAM. But once Linux starts it switches to protected mode which no longer has access to the real-mode access. There are workarounds involving finding the ISO image in RAM and loading a kernel module that maps/mounts it as a memory block device21:07
drabTJ-: http://dpaste.com/0C7EP8J it's all the same for all ISOs21:08
drabthat's a straight iso download from http://www.ultimatebootcd.com/21:08
drabTJ-: I also found this, but could not get it to work either: https://github.com/medallia/ramroot21:10
drabit sounded exactly like what I wanted (and motivated by the same reason - avoiding nfs)21:10
TJ-the reason UBCD works is it has a self-contained squashfs inside the initrd.img21:33
drabfair enough, I guess it makes not much of a diff to me, maybe I'll look how to back the squashfs into the initrd21:44
drabrootram tho looks lik eit's doing the right thing, ie what would logically make sense to me21:45
drabcreate a ramdisk and wget the root fs and untar it to it21:45
drabhowever I'm stuck on "tar: applet not found"21:45
drabhttps://github.com/medallia/ramroot/blob/master/initramfs-tools/scripts/ramdisk#L4621:45
drabwhich seems to be happenig there21:45
drabno clue why busybox tar would fail like that...21:45
TJ-not sure why we can't just add a simple http client fetch inside initrd for these boots. it'd be relatively small and simple21:51
TJ-I wonder... there's tricks with bash that could do that :)21:59
TJ-drab: you've given me a challenge now. the ubuntu intrd has ./bin/wget provided by busybox so it's possible to fetch the ISO into a tmpfs, loop mount it, and mount the squashfs22:04
drabTJ-: dude if you got that working it'd be the best early xmas present anybody ever game me :P22:11
TJ-just trying to think if it could be done without needing special arguments on the command line :D22:11
TJ-in *theory* it could be the last-ditch fallback if the other methods fail, before the final drop to shell22:12
drabanother random question as I'm trying to make ramroot work at the same time... if possible22:13
drabI found out that for whatever fun reason the busybox shipped in ubuntu does not come with tar... hence the fail22:13
drabI apt-get'ed the source for busybox-initramfs22:14
drabbut it's not obvious to me wwhere the applets are enabled (normally it seems you'd run make menuconfig and pick)22:14
TJ-drab: did you try telling memdisk it's a "hardisk" image not "iso" - after all, the ISOs are hybrid22:16
drabTJ-: yes, I saw that and tried that too, made no diff22:16
TJ-OK.. it got into the initrd though?22:16
drabbecause indeed fdisk -l showed it was a disk like in the example they gave22:16
drab?22:16
drablost you there, what got into the initrd?22:16
TJ-I mean it booted as far as the initrd then failed the same way it does with 'iso' method - dropping to shell22:17
drabyeah22:17
TJ-right, that really does confirm the problem there is the switch from real-mode to protected 'loses' access to the im-memory image22:17
TJ-That ramroot project is OK, but misses the point. It could easily work with the existing ISO/squashfs images rather than enforcing having to repack it as tar.xz22:25
drabTJ-: I can't get that to work either... recompiling busybox now, seems a rather wacky choice to ship busybox without tar...22:26
drabI don't even know why/how it worked for him to begin with22:26
drabmaybe it used to ship it in 14.0422:26
TJ-we want it small as possible, and don't need tar in the initrd22:27
drabyeah, I guessed as much, which makes sense22:28
drabjust been a long saturday... and thank you for helping, really appreciate it22:29
TJ-I did all this stuff years ago; got scripts that automatically configure the PXE server for ISOs so it's simple to deploy, but I use NFS.22:31
TJ-in case there's any nuggets in it, this is it from 10 years ago: http://tjworld.net/wiki/Linux/Ubuntu/NetbootPxeLiveCDMultipleReleases22:32
drabTJ-: yeah, I have that working (with nfs), the whole problem started when trying to do this over http22:33
drabnfs based stuff is no issue, works pretty well22:33
TJ-yes, I understand22:33
TJ-the end of the article deals with patching the ISO initrd22:34
drabthanks, checking it out22:34
TJ-back then the network modules weren't built-in to the kernel nor included in the initrd, so I had to modify it for getting netconsole22:35
drabbah, got past the tar issue but now getting a whole new bunch of errors I can't even see because it scrolls too fast and then I can't page up, it's all locked up22:35
TJ-failures during extraction maybe?22:35
TJ-one per file in the image maybe?22:35
TJ-you repacked the rootfs as a tar.xz I assume?22:36
drabyeah22:36
drabcan't see where it's erroring first, scrolls real fast and dies, I see errors can't create /root/lib/firmware, can't mount /dev on /root/dev and eventually tar fs doesn't have /sbin/init22:36
drabso it does sound like untarring an setting up failed somehow22:37
drabI wonder why it all locks up, normally the initramfs prompt is usable and I can at least scroll up22:37
TJ-did you increase the memtotal size to account for the size of your rootfs when uncompressed?22:58
drabTJ-: for rootmem? no I didn't think of it, it wasn't in the instructions and I thoguht tmpfs was dynamic these days (and would have worst errored if no more space was not available)23:02
drabbut I have 4Gbs and the img is 100MB so I thought it wasn't a problem23:03
TJ-look at the ramroot script, line 29. it defaults to 500MB which must take the uncompressed image. if not you have to set memtotal= on tha kernel command-line23:07
drabTJ-: the unextracted/before tar ramroot is 400MB, but I will try23:22
drabalso I realized that earlier I tarred chroot, ie the tar would have chroot/{etc,var...} and maybe that's also no good23:23
drabso retarring with the tar straight into the root23:23
TJ-haha yes that'd be a problem23:24
TJ-tar needs to start in the root of the rootfs :)23:24
drabholy cow23:27
drabthere's good news and bad news23:27
drabthe good news, it booted \o/23:28
TJ-lol23:28
drabthe bad news, I guess it's missing some usb module because the usb keyword plugged doesn't work23:28
TJ-check for usb_hid I think it is (human interface device)23:28
drabcheck where?23:29
drabI'd thought everything like that was included in the stock kernel I installed in the chroot (and loaded), but maybe not23:29
TJ-it should be in the kernel image itself23:29
TJ-i've had that previously where it needed some specific USB chipset driver to bring up the USB side23:30
TJ-check "find /sys/bus/usb/ " see what's there23:31
drabcant' type so can't check :)23:31
drabbut I'm looking in the chroot23:31
drabto see if the module is there, I used linux-virtual-image which installs a minimal kernel23:32
draband doing /lib/modules/4.4.0-21-generic/kernel# sudo find . -name "*usb*" returns nothing23:32
drabso they may not be there after all23:32
drabyeah on my desktop that returns a lot of stuff, including usbhid.ko23:33
drabtrying again adding a diff kernel in the chroot23:33
TJ-right; virtual-image doesn't need USB23:35
drabit's gonna make the img fat tho...23:35
* drab scratches his head23:35
drabalso seems I've recompiled busybox I'm thinking I could also make the root tar bz2 instead of xz23:36
drabshould make it much smaller23:36
TJ-if you want to boot bare hardware it's better to have it builtin - in case the initrd fails :)23:36
TJ-you could, but ramroot only supports xz as far as I noticed23:36
drabyeah, well, in theory I guess I should just compile a static kernel23:36
drabTJ-: I think it's just the code, to make it more portable as most busyboxes prolly aren't compiled with bzip223:37
drabbut maybe have xz, so I can prolly just change that part of the code to uncompress the tar23:37
TJ-it's using pixz for decompressing; you'll need to add code to ramroot script if you're going to use bz223:38
drabyeah23:38
drabthat's about 200MB more of modules... kinda whack, but let's see if it works23:50
drabI guess if it does then I'll spend time compiling a kernel statically and adding a whole bunch of stuff, but avoiding modules I don't really need, like sound23:51
drabcomes to 180Mb vs 100MB it wa before23:52
drabyep, bingo! got keyboard and even a nice framebuffer and it was up and running pretty quickly overall23:54
TJ-:) well done23:58

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