How to add to the boot order?

Chrome

New Member
Mar 15, 2015
7
0
1
Proxmox users,

I have recently stumbled upon Proxmox, and it seems to work really well so far, I've been playing with it on a spare machine... and I have to say I am pretty impressed, recently being fed up with ESXI and the limitations for everything! All that aside, I've created a VM...and I've been able to passthrough the USB key that I would like to boot from to the VM. See this SS:

PM - Boot Menu.PNG

And when select option 4, to boot from the USB, it works absolutely perfectly... boots right up and quick. However, I always, want to boot from the USB key.. (its an UNraid v5.06 USB Key), automatically, I don't have to have to go to the boot menu each time. So, how do I add the USB key to the "Boot Order" in the VM options menu, so, I can boot from the USB Key each and every time?

PM - Boot Order.PNG

I tried using PLOP to get the job done...but PLOP doesn't seem to work well, with Proxmox, KVM, environments... it works nicely with ESXI.

Any ideas? or work arounds?

TIA, Chrome
 
Hi Chrome,

As far as the manpage goes, it is not possible yet.

Another idea maybe: Do not use USB Passthrough. Try to add the USB-Stick as harddisk. This works and abstracts the fact that it is a usb stick. You have to deal with changing device names of the stick, so you should add an udev rule for your stick, yet you can do it by adding a new hard disk drive and use the device as backend device:

-drive file=/dev/sdaa,if=ide,index=0,media=disk

Maybe not as elegant as the usb solution, yet it gets the job done.

Best,
LnxBil
 
Hi LnxBil,

Thanks very much for the direction. I will dive in and let you know how it goes. Agreed, it might not be elegant, but it will be pretty if it works. :)



Hi Chrome,

As far as the manpage goes, it is not possible yet.

Another idea maybe: Do not use USB Passthrough. Try to add the USB-Stick as harddisk. This works and abstracts the fact that it is a usb stick. You have to deal with changing device names of the stick, so you should add an udev rule for your stick, yet you can do it by adding a new hard disk drive and use the device as backend device:

-drive file=/dev/sdaa,if=ide,index=0,media=disk

Maybe not as elegant as the usb solution, yet it gets the job done.

Best,
LnxBil
 
LnxBil,

I've never used udev rules before...trying to figure them out...but not getting too far. So, far, I've removed the passthrough from the 100.conf file.

Here is the output from: udevadm info -a -n /dev/sde1

looking at device '/devices/pci0000:00/0000:00:1d.7/usb2/2-8/2-8:1.0/host19/ta rget19:0:0/19:0:0:0/block/sde/sde1':
KERNEL=="sde1"
SUBSYSTEM=="block"
DRIVER==""
ATTR{partition}=="1"
ATTR{start}=="32"
ATTR{size}=="3932128"
ATTR{alignment_offset}=="0"
ATTR{discard_alignment}=="0"
ATTR{stat}==" 151 17 1344 79 0 0 0 0 0 79 79"
ATTR{inflight}==" 0 0"


looking at parent device '/devices/pci0000:00/0000:00:1d.7/usb2/2-8/2-8:1.0/ho st19/target19:0:0/19:0:0:0/block/sde':
KERNELS=="sde"
SUBSYSTEMS=="block"
DRIVERS==""
ATTRS{range}=="16"
ATTRS{ext_range}=="256"
ATTRS{removable}=="1"
ATTRS{ro}=="0"
ATTRS{size}=="3948544"
ATTRS{alignment_offset}=="0"
ATTRS{discard_alignment}=="0"
ATTRS{capability}=="53"
ATTRS{stat}==" 174 29 1624 211 0 0 0 0 0 211 211"
ATTRS{inflight}==" 0 0"


Not really sure where to go from here.

I am a bit surprise that Proxmox hasn't added this in yet... The USB boot option is available in KVM with OpenSuse.. I've tried it and it works. So, while I am really digging proxmox, if I can't get this working, looks like KVM and Suse is my only option.
 
Hi Chrome,

can you elaborate with version is used in OpenSuse and compare it to the stock Proxmox KVM? Maybe it'll be solved in Jessie's kvm when Proxmox 5 will be released.

Regarding your udev question:

udevadm info --query=all --attribute-walk --name=/dev/sde | grep -i serial | head -n 1

Get the serial and create a rule like this in /etc/udev/rules.d/50-my-usb-disk.rules


KERNEL=="sd?1", SUBSYSTEMS=="usb", ATTRS{serial}=="MYSERIAL", SYMLINK+="vm_100_usb_disk"

then reload and retrigger

reload udev
udevadm trigger


Afterwards, the device should be symlinked in /dev/vm_100_usb_disk (at least for my quick test it does)

Best,
LnxBil
 
Hey LnxBil,

I'll grab the version info from OpenSuse's KVM when I get that machine going again, (should be soon after this issue is put to bed one way or another. :) ) Anyway, I just downloaded it, OpenSuse 13.2 and updated it. So, whatever that version is. :) But, I will still grab you the version info.

Proxmox is running: 2.6.32-37-pve SMP mod_unload modversions

Ok. So, I follow your direction and we're good. The file has been created in /dev as vm_100_usb_disk.

Now what's the best way to add it to the VM?

In case you can't tell, I'm new to proxmox. :p :D

I didn't know about udev before... but it will solve an issue that I was having with OpenSuse, if I have to go back that way. The VM I created in OpenSuse, wouldn't boot correctly, if I kept removing/adding USB devices, because it couldn't find the 'correct' USB device. Now, with udev, and your direction, I know how to avoid that issue. So, at the very least, I've learn something. Thanks.
 
You should now be able add the disk via the kvm parameter:

-drive file=/dev/vm_100_usb_disk,if=virtio

BTW: I just found by chance the line that said that booting from usb disk is currently not working:

...
} elsif ($drive->{interface} eq 'usb') {
die "implement me";
} ...

So it's not implemented right now.
 
LnxBil,

Unfortunately, I need bit more hand holding. :( Regarding, the kvm parameter... :confused:

I am assuming that you mean the CLI... so, I've started the VM with this command:

/usr/bin/kvm -id 100 -chardev socket,id=qmp,path=/var/run/qemu-server/100.qmp,server,nowait -mon chardev=qmp,mode=control -vnc unix:/var/run/qemu-server/100.vnc,x509,password -pidfile /var/run/qemu-server/100.pid -daemonize -smbios type=1,uuid=38aa55aa-6e6c-4c29-bd5b-4e99334949b5 -name UNRAID -smp 1,sockets=1,cores=1,maxcpus=1 -nodefaults -boot menu=on,strict=on,reboot-timeout=1000 -vga cirrus -cpu kvm64,+lahf_lm,+x2apic,+sep -m 1024 -k en-us -device piix3-usb-uhci,id=uhci,bus=pci.0,addr=0x1.0x2 -device usb-tablet,id=tablet,bus=uhci.0,port=1 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 -iscsi initiator-name=iqn.1993-08.org.debian:01:47a82de4fb -drive file=/dev/vm_100_usb_disk,if=virtio -netdev type=tap,id=net0,ifname=tap100i0,script=/var/lib/qemu-server/pve-bridge,downscript=/var/lib/qemu-server/pve-bridgedown,vhost=on -device virtio-net-pci,mac=3E:41:46:1D:1E:DC,netdev=net0,bus=pci.0,addr=0x12,id=net0,bootindex=200

The VM starts, doesn't boot to the correct drive, its looking for a bootable CD... and the new "hard" drive is not added to the "hardware" section of the web interface.

I am sure I am doing something wrong...can't figure out what...
 
You have to use the args flag in the configuration file for your VM in /etc/pve/qemu-server/100.conf. You can also set the bootindex for drive to a very low value. I have currently no setup to replicate the usb stick, so I cannot say for sure how the args parameters looks like.
 
Hey LnxBil,

Good News. I got it... Its up and running...and for the benefit of anyone that might stumble upon this threat, I am going to document everything that I did to get it going. I had to modify the udev rule slightly...

Proxmox version: 3.4-1

1. Get the serial number of the usb key,
Code:
udevadm info -a -n /dev/sde1 | grep '{serial}' | head -n1

"/dev/sde1" will have to match the usb key. I also used the "fdisk -l" command to help me find the right device to put into the udevadm command.

2. Once I had the serial, I was ready to create the rule and the file for the rule. I used the following name for the rule file: 8-persistaent-usb.rules but it really can be name anything, I believe.
Code:
nano /etc/udev/rules.d/8-persistaent-usb.rules

Once, I was in the file, here's my rule:
Code:
KERNEL=="sd?", SUBSYSTEMS=="usb", ATTRS{serial}=="aae6c3b31da031", SYMLINK+="vm_100_usb_disk"
Here's where I made a change, instead of, KERNEL=="sd?1" I used, KERNEL=="sd?" to get the whole USB stick (including the boot partition), instead of just a particular partition on the USB stick.
ATTRS{serial}=="xxxxxxxxxxxxx" The serial came from the udevadm command in step 1.
SYMLINK+="vm_100_usb_disk" The "vm_100_usb_disk" you can call whatever you want, eg abc123 or 321cba whatever floats your boat.

3. I know you suggested to use,
Code:
[COLOR=#333333][FONT=courier new]reload udev[/FONT][/COLOR]
[COLOR=#333333][FONT=courier new]udevadm trigger[/FONT][/COLOR]
but they just didn't work on my box... so, I just restarted the machine, not the most efficient way, but got the job done.

4. Then I had to edit the conf of the virtual machine, since UNraid, is the 1st VM on this box, I edited the 100.conf file located at: /etc/pve/qemu-server/100.conf
Code:
nano /etc/pve/qemu-server/100.conf

5. I added/modified two entries depending how your conf is setup:
first change,
Code:
bootdisk: sata0
second change,
Code:
sata0: /dev/vm_100_usb_disk

Some notes: I tried using ide0 instead of sata0, however, I found the ide0 to be really slow booting from the USB key.
I tried using virtio0 instead of ide0 or sata0, however, when unraid was booting, it was throwing some strange error and the web interface wouldn't come up.

So, sata0 seems like it worked the best.

So, in conclusion, had to jump through some hoops to get Proxmox to boot from a USB key to have a VM of UNraid, Plop boot manager wouldn't work, and I don't like the idea of creating a vmdk file of UNRaid and having it boot that way. I want to be able to boot directly from the USB key itself.

Hopefully, Proxmox will implement the boot from USB feature...since they are pretty much there... I can boot from USB by using the F12 key to get the boot menu during a VM boot (with USB passthrough configured)... so, having the option of USB in the boot order can't be far away but it would be REALLLLLLY useful! :)

LnxBil, thank you very much for all your help and pointing me in the right direction... hopefully this thread will help someone else get their machine booting from USB with Proxmox. The Udev rule can be used on other flavours of Linux as well.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!