From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Marusich Subject: Re: Hosting a GuixSD server on commodity hosting platforms, a journey Date: Thu, 01 Dec 2016 22:22:38 -0800 Message-ID: <87shq697f5.fsf@gmail.com> References: <878ts212ic.fsf@dustycloud.org> <871sxt1sho.fsf@dustycloud.org> <87shq76kkl.fsf@dustycloud.org> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46820) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cChF8-0003Hq-Le for help-guix@gnu.org; Fri, 02 Dec 2016 01:22:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cChF7-0003SH-Ag for help-guix@gnu.org; Fri, 02 Dec 2016 01:22:46 -0500 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]:36072) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cChF6-0003RU-LG for help-guix@gnu.org; Fri, 02 Dec 2016 01:22:45 -0500 Received: by mail-pg0-x22d.google.com with SMTP id f188so103594789pgc.3 for ; Thu, 01 Dec 2016 22:22:44 -0800 (PST) In-Reply-To: <87shq76kkl.fsf@dustycloud.org> (Christopher Allan Webber's message of "Thu, 01 Dec 2016 22:06:50 -0600") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane.org@gnu.org Sender: "Help-Guix" To: Christopher Allan Webber Cc: help-guix --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi Chris, Sounds like you've been having fun :-) Christopher Allan Webber writes: > Christopher Allan Webber writes: > >> Relatedly! User dvc in #guix on freenode suggests looking at >> https://www.vultr.com/ which looks quite affordable and hey! It has a >> "custom ISO" option. If we can convert our USB boot stick thingy >> (presumably via xorriso) we could try generating a base server image >> from there. I'd prefer to have a workflow where I go from handing off >> something made with "guix system vm-image" to some API, but maybe in the >> meanwhile Vultr would be a lower barrier to entry. > > I decided to explore this a bit more today, figuring converting Guix's > USB image to .iso couldn't be that hard. Well, turns out it's another > rabbit hole, and I didn't reach the end of this one yet either! You can say that again! ISOs and bootable CDs are an area that is often complicated, apparently can be done in multiple ways, and is often misunderstood or glossed over in most Internet discussions. > Assume you've got the USB image handy (and uncompressed); then we want > to mount it via a loopback device, but we need to get the right offset > to find out what byte the root partition starts from. Let's find out > where that is. >=20 > # We need to find out how many bytes the offset is > cwebber@oolong:/tmp$ parted guixsd-usb-install-0.11.0.x86_64-linux=20 > # This switches it to bytes output > (parted) unit B > (parted) print > Model: (file) > Disk /tmp/guixsd-usb-install-0.11.0.x86_64-linux: 943718400B > Sector size (logical/physical): 512B/512B > Partition Table: msdos > Disk Flags:=20 >=20=20=20 > Number Start End Size Type File system Flags > 1 1048576B 934281727B 933233152B primary ext4 boot >=20=20=20 > (parted) quit > > Ok, so we can take that "start" number (be sure to strip the trailing > 'B'): > > $ sudo mount -o ro,loop,offset=3D1048576 guixsd-usb-install-0.11.0.x86_= 64-linux /mnt/tmp FYI, you can also mount the file on a loopback device, like I did in my EC2 example. If you use the -P option to losetup, it'll automatically create a device file for the partition, which you can then mount. That way, there is no need to find/specify the offset. > Now we can write it to the .iso image, packaging up all those files that > appear in the usb image: > > # flags: verbose, Rock Ridge filesystem info, output path, input direct= ory > $ sudo xorrisofs -v -R -o ./guixsd-usb-install-0.11.0.x86_64-linux.iso = /mnt/tmp/ > GNU xorriso 1.4.6 : RockRidge filesystem manipulator, libburnia project. >=20=20=20 > Drive current: -outdev 'stdio:./guixsd-usb-install-0.11.0.x86_64-linux.= iso' > Media current: stdio file, overwriteable > Media status : is blank > Media summary: 0 sessions, 0 data blocks, 0 data, 242g free > xorriso : UPDATE : 27100 files added in 1 seconds > xorriso : UPDATE : 47400 files added in 2 seconds > xorriso : UPDATE : 50200 files added in 3 seconds > [.....] > Written to medium : 351969 sectors at LBA 0 > Writing to 'stdio:./guixsd-usb-install-0.11.0.x86_64-linux.iso' complet= ed successfully. > > Except, oops! This won't boot. We need to put GRUB on it. > > Well here's where I'm stuck for tonight. I don't know exactly what's > needed; maybe either the -b flag, or --grub2-mbr, or some combination. > The man page is a little bit overwhelming (I mean, xorrisofs is clearly > featureful, credit there): > > https://www.gnu.org/software/xorriso/man_1_xorrisofs.html > > But how do I generate the right GRUB stuff to put there? Can I pull it > off the USB image? Generate it separately? > > This web page is very long but appears to have the appropriate info (and > unfortunately requires running arbitrary javascript to even render): > > http://lukeluo.blogspot.com/2013/06/grub-how-to-2-make-boot-able-iso-wi= th.html > > ... so I guess the next steps are following roughly what's described at > the bottom of the page? That is actually the exact webpage I was going to link to you. What you need to do (I think) is make the CD bootable, and the common way to do that, apparently, is to do it via El Torito. I've never done it, myself, but my understanding is that that is what needs to be done. In my opinion, unless the virtualization service provides no other easy way to import an image for booting, I doubt that making a bootable ISO is the simplest solution. But it's good to experiment! =2D-=20 Chris --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJYQRMuAAoJEN1AmhXYIkadCE8P/jT8oUd9JtJC0kQhC5UzGXX+ wv5eUqdI97LsovpMkJSqjL5P5oWg3VfK3dukuOL+xyUfX1N0rU/3FKuvnBS/I1Cj psoEptzvWAJFNCn5SlbtGSx4Ilcc6agu9/w5jGHJqcaNoQFlJnEUZBGgAft39AF/ QiXxEUJ3lzqT5dNGhRUqA44ErFP+Qs285P6acYb8glagmNrQY3UkBwJXPZJQctpc o7MtqXObYqfJbXgEok8+Lxulxlw6Q5RTWW/Nj9AysFdbJQLQ6dyInown4g6ffOxX /1A8qmEn0Ed+mgcOR5EDWC4+ERwkLIa3n7vWCK0FvsTMfBQFXnIeJan8++lKlOQm pV4PSUr/RLPMlg2uXxi2IOqiGAvZgc5SInhefag4Cv3KTy8t4U8S59tiQG8yaI9X tee7sDdZrz26XLUXBF2GO9wkxvcMCz7yCo+IE+wALbW7wzoM2TBq3UqHZ7AxWr5l lW5dTyxKeM4bGSMUdQgLIL9jk7jOA6DJTgpLMxCHxfHqUi47LnymMEEzS8goKTQL 8u/i1hdqZSTXjUNqoNBTCwn/cW16az8k+CfS1t6CAHL/TIYXmFvjiQh4GnmasJ1D ePnc/tnX4KGwShKBdr3vFzqLcwcV5cD4jsJGL1HsiwNiH8bqJ2E20ec7/z1D2fLP oe0Sn1WFDk75OpZKEHs0 =lPXv -----END PGP SIGNATURE----- --=-=-=--