Affichage des articles dont le libellé est grub. Afficher tous les articles
Affichage des articles dont le libellé est grub. Afficher tous les articles

mercredi 20 avril 2016

usb key replicate

* usb key duplicate

* partition table

  manual cgdisk

* rsync partitions

  rsync -auv --progress <source></source> <target>

* rsync caveat : hard links, sparse file

  warning: some sparse files may have huge virtual size
    rsync, will attempt to expand them fully
    i.e: docker devicemapper (60MB on disk, virtually 100G)

  warning: some programs have one fat binary with hard links
    rsync, will attempt to copy them fully
    i.e: git, which has 114 hard links with different names

* BIOS boot (ef02) partition

  dd if=/dev/sdX1 of=/dev/sdY1 bs=1M # simply

* grub

  sudo grub-install --target=i386-pc --debug --boot-directory=/<root-mountpoint>/boot/ /dev/sdY

  warning: do not mess the device names and mountpoint names as it may modify your host system grub config


* grub UUID

  grub menuentry refers to source key UUID

* adjust root UUIDs
  /etc/fstab still refers to source key UUID

  blkid /dev/sdX? &gt;&gt; /etc/fstab
  vi /etc/fstab

  (some sed-fu would be nice)</root-mountpoint></target>

mardi 5 avril 2016

nixos 16.03 live iso boot "directly" from grub

I hate extracting iso images. I prefer to run them through grub loopback. Nixos 16.03 release is a few days old, I couldn't resist. Alas, booting it this way drops me in a rescue shell.

The initrd is set up to only have one layer of virtual fs. So it assumes the squashfs nix-store would be in /mnt-root/iso and complains since it is not.

So after trying to MITM myself and mount the desired FS where they should be, I replicate the final steps of the nixos initrd init script. Kernel panic.

I'm dumbfounded, I need to be more thorough. The init scripts reads a fsinfo file (fstab-like in a different format say) to prepare the new root for the real stage 2 kernel.

btw, my mistake was to simply mount the nix-store squashfs file in /mnt-root/nix/.ro-store and then symlink /mnt-root/nix/store to it. It works only partially as the stage2 kernel find its init and proceed to run systemd but hangs after a few services doing nothing. Only option: CTRL-ALT-DEL. (I even tried to instrument stage2 systemd into booting the rescue target, hoping for a rescue shell to investigate the hang .. no luck). Then I realize that the fsinfo mounts the squashfs in nix/.ro-store BUT, also prepares a unionfs in nix/store ! Maybe stage2 is waiting for a unionfs mount in nix/store and my symlink is confusing things up.

So I insert the missing layer in there. And just sh /init. It fails horribly saying 'cannot stop udev/queue' then 'Killed'. Not thrilled.

I extract the final steps of the init script (populate /mnt-root with proc,sys,run,dev; kill a few things; restore the path for `modprobe` in the new /proc/sys/kernel/modprobe value). And then exec switch_root ...

I can now enjoy nixos 16.03 live booting directly from grub. If you allow directly to allow user intervention .. heh.

jeudi 16 mai 2013

DELL 4500s from the forest - chapter 3 : the install-partying

So that old DELL 4500s runs. I also found an recent (using systemd) archlinux live cd so I can enjoy a more modern driver set and OS utils. But it can't boot usb, so I'll have to find another persistant storage device, namely : a hard drive. No problem, I have a dozen hard drive sleeping under my bed. Except half of them are < 4G or SATA, all but one [ex IBM] Hitachi Deskstar 80GB (you know, the model just after the Hitachi DeathStar 60GB failure generators). One empty slot in the partition table, 7GB+ of capacity, perfect. That doesn't solve the boot issue, I don't have a spare partition for grub. I'll try to bootstrap the boot from the live cd. I'm in the mood for some serious bad idea attempts tonight.