LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices


Reply
  Search this Thread
Old 02-11-2015, 10:43 AM   #1
nolretou
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 98

Rep: Reputation: Disabled
Question Writing lilo in a nbd mount.


Hi,

I externally installed a Slackware in a Qemu .img, and I would like to write the MBR as the system obviously doesn't boot.

I mounted the drive with :
qemu-nbd -c /dev/nbd0 hd.img
mount /dev/nbd0p1 /mnt/zip/

The partitions are ok :
sfdisk -d /dev/nbd0
# partition table of /dev/nbd0
unit: sectors

/dev/nbd0p1 : start= 63, size= 39070017, Id=83, bootable
/dev/nbd0p2 : start= 39070080, size= 2872960, Id=82
/dev/nbd0p3 : start= 0, size= 0, Id= 0
/dev/nbd0p4 : start= 0, size= 0, Id= 0

I wrote a lilo.conf with some /dev/sda parameters, but I get :
/mnt/zip/sbin/lilo -A /dev/nbd0 -C /mnt/zip/etc/lilo.conf
Fatal: Not a device with partitions '/dev/nbd0'

/mnt/zip/sbin/lilo -M /dev/nbd0 -C /mnt/zip/etc/lilo.conf
Fatal: /dev/nbd0 is not a master device with a primary parition table

Any suggestion ?
 
Old 02-11-2015, 11:38 AM   #2
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Can you show contents of /mnt/zip/etc/lilo.conf file.
 
Old 02-12-2015, 03:05 AM   #3
nolretou
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
# LILO configuration file

append=" vt.default_utf8=1"
boot = /dev/sda
bitmap = /boot/slack.bmp
bmp-colors = 255,0,255,0,255,0
bmp-table = 60,6,1,16
bmp-timer = 65,27,0,255

prompt
timeout = 20

change-rules
reset

vga = normal

image = /boot/vmlinuz
root = /dev/sda1
label = Slack-du-jour
read-only
 
Old 02-12-2015, 07:37 AM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Quote:
Originally Posted by nolretou View Post
# LILO configuration file

append=" vt.default_utf8=1"
boot = /dev/sda
bitmap = /boot/slack.bmp
bmp-colors = 255,0,255,0,255,0
bmp-table = 60,6,1,16
bmp-timer = 65,27,0,255

prompt
timeout = 20

change-rules
reset

vga = normal

image = /boot/vmlinuz
root = /dev/sda1
label = Slack-du-jour
read-only
Try changing
boot = /dev/sda
to
boot = /dev/nbd0

Then run lilo as you did.

In old days I used lilo but not nowadays. May be qemu-nbd is not supported by lilo, not sure.
 
Old 02-12-2015, 07:42 AM   #5
nolretou
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
I have the same errors.
 
Old 02-17-2015, 03:40 AM   #6
nolretou
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Bump.
 
Old 02-23-2015, 03:07 AM   #7
nolretou
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Another bump.
 
Old 02-23-2015, 04:34 AM   #8
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
May you like to use grub 0.98 legacy as bootloader?
 
Old 02-23-2015, 04:41 AM   #9
nolretou
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
I don't care, but at some point, the MBR has to be written so I fear that using grub will change nothing.
 
Old 02-23-2015, 04:50 AM   #10
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
I can provide steps to use grub legacy. But can you give details of how you have setup the slackware partitions, mount points, whether using Lvm, and cryptsetup.
 
Old 02-23-2015, 04:58 AM   #11
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Also provide what filesystems you are using with partitions. And provide how you are going to run that hd.img via e.g. qemu?
 
Old 02-23-2015, 05:01 AM   #12
nolretou
Member
 
Registered: Apr 2014
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: Disabled
Well that would be welcome (hoping that it works), the setup is simple : sda1 ext4 + sda2 swap
 
Old 02-23-2015, 05:04 AM   #13
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Where is /boot present? Is it within sda1. Are the kernel and if using initrd/initramfs present within them - /boot.
 
Old 02-23-2015, 05:23 AM   #14
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Before proceeding with using grub legacy there is another way to boot the slackware with qemu. You can get kernel/initrd/initramfs from /boot and use qemu's '-kernel' and '-initrd' option to boot slackware. After booting it you can install lilo bootloader from within qemu.
 
Old 02-23-2015, 05:39 AM   #15
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
You can make a grub legacy floppy boot disk to boot a system under qemu.

1) Get the binary file from grub-0.97-i386-pc.tar.gz

2) Untar it in a temp dir.

3) Get stage1 and stage2 binary file from it.

And run like this:

Code:
dd if=/dev/zero of=pad.img bs=1372910c count=1
cat stage1 stage2 pad.img > floppy.img
Check that size of floppy.img is exactly 1474560 bytes long.

Now boot the hd.img with:

Code:
qemu-system-i386 -boot a -fda floppy.img -hda xxxxxx ....
You would see grub legacy booted. Use this to boot whatever distro in hard disk file image.

Last edited by veerain; 02-23-2015 at 05:41 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
nbd troubles marco.hahn Linux - Networking 6 06-27-2013 04:50 PM
[SOLVED] lilo unable to mount root-fs , lilo.conf curious95 Linux - Software 4 11-25-2012 08:55 AM
[SOLVED] NBD 2.9.17 - 2010-08-06 release Chuck56 Linux - Server 1 08-09-2010 10:18 AM
Help writing script file to mount / mount hard drive Rustylinux Linux - General 6 06-27-2006 09:34 AM
Lilo - Writing to MBR - Curious Problem streamalot Linux - General 8 04-07-2002 09:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud

All times are GMT -5. The time now is 03:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration