How to choose Debian Installer Option using headless/CLI?

This is for discussing general topics about how to use VirtualBox.
Post Reply
_nobody_
Posts: 25
Joined: 8. Oct 2016, 20:34

How to choose Debian Installer Option using headless/CLI?

Post by _nobody_ »

Hello to everyone,

After some time, I have figured out all the parts of the first two stages of the headless VBox [VMM] configuring headless Debian [VM]! :mrgreen:

But one, very last item, is for me still a mystery?! I could not run both stages:
[First stage] VBox headless configuration;
[Second stage] Preseed configuration!
since I am stuck in between them!

When I run the first stage of the VBox headless, all works perfectly (VBox headless configuration) until I bring up the VBox. After running virtualbox& command, the following GFX menu poped-up (from VBox SATA CD/DVD installer with actual .iso):
Debian GNU/Linux Live (kernel 4.9.0-6-amd64) <<======= Default Option
Debian Live with Localisation Support
Graphical Debian Installer
Debian Installer
Debian Installer with Speech Synthesis
If I bypass headless this phase, the thread of execution will continue uninterruptible from .iso, running preseed.cfg file!

The above menu actually comes from .iso, from /boot/grub/grub.cfg which looks similar (simplified) to this content:

Code: Select all

menuentry "Debian GNU/Linux Live (kernel 4.9.0-6-amd64)" {
  linux  /live/vmlinuz-4.9.0-6-amd64 boot=live components "${loopback}"
  initrd /live/initrd.img-4.9.0-6-amd64
}
menuentry "Debian Live with Localisation Support" {
  linux  /live/vmlinuz-4.9.0-6-amd64 boot=live components "${loopback}"
  initrd /live/initrd.img-4.9.0-6-amd64
}
menuentry "Graphical Debian Installer" {
  linux  /d-i/gtk/vmlinuz append video=vesa:ywrap,mtrr vga=788 "${loopback}"
  initrd /d-i/gtk/initrd.gz
}
menuentry "Debian Installer" {
  linux  /d-i/vmlinuz  "${loopback}"
  initrd /d-i/initrd.gz
}
menuentry "Debian Installer with Speech Synthesis" {
  linux  /d-i/gtk/vmlinuz speakup.synth=soft "${loopback}"
  initrd /d-i/gtk/initrd.gz
}
Question here: how I can choose menuentry "Debian Installer" option using headless VBoxmanage option/command line? Does out there such an opportunity exist??? :idea:

Thank you,
_nobody_
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: How to choose Debian Installer Option using headless/CLI?

Post by Martin »

You probably would need to modify the ISO to set the "Debian Installer" as default in the grub.cfg
_nobody_
Posts: 25
Joined: 8. Oct 2016, 20:34

Re: How to choose Debian Installer Option using headless/CLI?

Post by _nobody_ »

Hello Martin,

This is a correct thinking. I already knew this, but I wanted more elegant solution. Anyway, thank you for an idea, it is very good one!

Actually, I have here much more generic problem?! :mrgreen:

I have in the iso_files directory the following:

Code: Select all

[vuser@localhost iso_files]$ ls -al
total 5216288
drwxr-xr-x. 3 vuser vboxusers       4096 Apr 15 08:43 .
drwxr-xr-x. 8 vuser vboxusers       4096 Apr  3 10:33 ..
-r--------. 1 vuser vboxusers  305135616 Apr  3 12:47 debian-9.4.0-amd64-netinst.iso
-rw-r--r--. 1 vuser vboxusers 2365587456 Apr 15 09:34 debian-live-9.4.0-amd64-gnome.iso
-rw-r--r--. 1 vuser vboxusers 2365587456 Apr  3 13:17 debian-live-9.4.0-amd64-gnome.iso.genesis
-rw-r--r--. 1 vuser vboxusers  305135616 Mar 24 21:09 gparted-live-0.30.0-1-amd64.iso
-rw-r--r--. 1 vuser vboxusers       2416 Apr 15 08:43 README
drwxr-xr-x. 4 vuser vboxusers       4096 Apr 15 09:30 tmp
[vuser@localhost iso_files]$
Now, when I switch to the directory tmp, I have the following:

Code: Select all

[vuser@localhost tmp]$ ls -al
total 2310168
drwxr-xr-x.  4 vuser vboxusers       4096 Apr 15 09:46 .
drwxr-xr-x.  3 vuser vboxusers       4096 Apr 15 09:45 ..
-rw-r--r--.  1 vuser vboxusers 2365587456 Apr 15 08:48 debian-live-9.4.0-amd64-gnome.iso.genesis
drwxr-xr-x.  9 vuser vboxusers       4096 Apr 12 18:37 extracted_main
drwxr-xr-x. 10 vuser vboxusers       4096 Apr 15 09:29 extracted-modified
-rw-r--r--.  1 vuser vboxusers       2416 Apr 15 09:46 README
[vuser@localhost tmp]$
Then I do:

Code: Select all

[vuser@localhost tmp]$ ls -al extracted-modified/
total 8
drwxr-xr-x. 2 vuser vboxusers 4096 Apr 15 09:48 .
drwxr-xr-x. 4 vuser vboxusers 4096 Apr 15 09:48 ..
[vuser@localhost tmp]$ 7z x -oextracted-modified/ debian-live-9.4.0-amd64-gnome.iso.genesis 

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,4 CPUs Intel(R) Core(TM) i5-4300U CPU @ 1.90GHz (40651),ASM,AES-NI)

Scanning the drive for archives:
1 file, 2365587456 bytes (2256 MiB)

Extracting archive: debian-live-9.4.0-amd64-gnome.iso.genesis

WARNINGS:
There are data after the end of archive

--
Path = debian-live-9.4.0-amd64-gnome.iso.genesis
Type = Iso
WARNINGS:
There are data after the end of archive
Physical Size = 2364565504
Tail Size = 1021952
Comment = 
Volume: d-live 9.4.0 gn amd64
Preparer: XORRISO-1.4.6 2016.09.16.133001, LIBISOBURN-1.4.6, LIBISOFS-1.4.6, LIBBURN-1.4.6
Created = 2018-03-10 13:40:06
Modified = 2018-03-10 13:40:06

Everything is Ok                                                              

Archives with Warnings: 1

Warnings: 1
Folders: 299
Files: 705
Size:       2363461865
Compressed: 2365587456
[vuser@localhost tmp]$ 
And the following is true:

Code: Select all

[vuser@localhost tmp]$ ls -al extracted-modified/
total 40
drwxr-xr-x. 10 vuser vboxusers 4096 Apr 15 09:48  .
drwxr-xr-x.  4 vuser vboxusers 4096 Apr 15 09:48  ..
drwx------.  3 vuser vboxusers 4096 Mar 10 12:39  boot
drwx------.  2 vuser vboxusers 4096 Apr 15 09:48 '[BOOT]'
drwx------.  3 vuser vboxusers 4096 Mar 10 12:39  d-i
drwx------.  2 vuser vboxusers 4096 Mar 10 12:40  .disk
drwx------.  3 vuser vboxusers 4096 Mar 10 12:40  dists
drwx------.  2 vuser vboxusers 4096 Mar 10 12:40  isolinux
drwx------.  2 vuser vboxusers 4096 Mar 10 12:39  live
drwx------.  3 vuser vboxusers 4096 Mar 10 12:40  pool
[vuser@localhost tmp]$
Then I do squashing, making AGAIN the same .iso to test it!

Code: Select all

[vuser@localhost tmp]$ mkisofs -lJR -o debian-live-9.4.0-amd64-gnome.iso extracted-modified/
I: -input-charset not specified, using utf-8 (detected in locale settings)
  0.43% done, estimate finish Sun Apr 15 09:51:44 2018
  0.87% done, estimate finish Sun Apr 15 09:51:44 2018
  ...[snap]...
 99.55% done, estimate finish Sun Apr 15 09:51:46 2018
 99.98% done, estimate finish Sun Apr 15 09:51:46 2018    
Total translation table size: 0
Total rockridge attributes bytes: 134286
Total directory bytes: 669696
Path table size(bytes): 5204
Max brk space used 14b000
1155222 extents written (2256 MB)
[vuser@localhost tmp]$ ls -al
total 4620616
drwxr-xr-x.  4 vuser vboxusers       4096 Apr 15 09:51 .
drwxr-xr-x.  3 vuser vboxusers       4096 Apr 15 09:45 ..
-rw-r--r--.  1 vuser vboxusers 2365894656 Apr 15 09:51 debian-live-9.4.0-amd64-gnome.iso
-rw-r--r--.  1 vuser vboxusers 2365587456 Apr 15 08:48 debian-live-9.4.0-amd64-gnome.iso.genesis
drwxr-xr-x.  9 vuser vboxusers       4096 Apr 12 18:37 extracted_main
drwxr-xr-x. 10 vuser vboxusers       4096 Apr 15 09:48 extracted-modified
-rw-r--r--.  1 vuser vboxusers       2416 Apr 15 09:46 README
[vuser@localhost tmp]$ 
Please, do note THE DIFFERENCE in size between original .iso and generated .iso! :shock:

And, when I tried to run the generated .iso, the following message poped-up:
"FATAL: no bootable madia found! System halted!"

What I am doing wrong here??? :roll:

Thank you,
_nobody_
Martin
Volunteer
Posts: 2561
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: How to choose Debian Installer Option using headless/CLI?

Post by Martin »

You are missing a step to keep / make the generated ISO bootable.
I don't have a link at hand but that shouldn't be too difficult to find on the net... ;)
_nobody_
Posts: 25
Joined: 8. Oct 2016, 20:34

Re: How to choose Debian Installer Option using headless/CLI?

Post by _nobody_ »

Martin wrote:You are missing a step to keep / make the generated ISO bootable.
You wanted to say... The Steps! :mrgreen:
Martin wrote:I don't have a link at hand but that shouldn't be too difficult to find on the net... ;)
I do. Here: https://access.redhat.com/discussions/1422213

I do everything as link proposes.

Code: Select all

mount -t iso9660 -o loop ./image.iso /storage/temp/ISO/
cp -Rfp /storage/temp/ISO/ /storage/temp/RWISO/
=======>> I do NOT modify /storage/temp/RWISO/ files
Then I pack it back with:

Code: Select all

mkisofs -o ../new.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -r /storage/temp/RWISO/
The new.iso is bootable and behaves as original, and seems All Good!

But if I do the following:

Code: Select all

mount -t iso9660 -o loop ./image.iso /storage/temp/ISO/
cp -Rfp /storage/temp/ISO/ /storage/temp/RWISO/
=======>> I do modify /storage/temp/RWISO/boot/grub/grub.cfg file... But!?
Then I pack it back with:

Code: Select all

mkisofs -o ../new.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -r /storage/temp/RWISO/
It behaves ss I did NOT modify anything... The GRUB boot screen is the same as from original boot! :shock: :shock: :shock:
_______

Well... There are more (steps) to it, I guess!

_nobody_
Post Reply