PDA

View Full Version : Making the Persistence option default with USB install



raesene
2013-04-07, 16:25
I've followed the instructions at http://docs.kali.org/installation/kali-linux-live-usb-install which all seemed to work fine to get a persistent Kali install on USB.

What I was wondering is, what would be the best way to make that the default option when booting off that USB device, to save from having to manually add "persistence" at the end of the line on each boot?

Thanks

raesene
2013-04-08, 15:14
So to provide one potential answer to my own question.

It's possible to create a custom kali distribution with this specified in the options. Following the kali instructions at http://docs.kali.org/live-build/live-build-a-custom-kali-iso and then using the debian instructions at http://live.debian.net/manual/current/html/live-manual/customizing-binary.en.html , I copied over the isolinux directory and then modified live.cfg.in to add "persistence" to the append line. Then just followed the standard USB install instructions with the new iso file generated and it seems to work ok :)

muffinman
2013-04-10, 06:23
Your 'best' option is to install your live Kali onto another USB device. USB 1 contains the live boot ISO and USB 2 is like a hard drive to install to.

Go through all the options and select USB 2 as your target media. Make sure when you get to the boot loader option to select <NO> you don't want the boot loader on the MBR of the first HDD on the system. It will then prompt you to enter the location where you want it.
Select the location (ie. /dev/sdb etc) and it will install grub loader there. You will have a FULL persistent install and you can run encryption as well if you want to.
The ONLY thing I would change with the standard setup is to remove the SWAP option at the partitioning stage. You should have enough memory on your system anyway. If not, leave it there but be aware that the life of your USB disk may only be a couple of years instead of 8-10

Snayler
2013-04-10, 06:49
You'll have to edit /boot/grub/grub.cfg and add the persistence setting.

maverik35
2013-04-10, 17:38
Do not touch the grub.cfg, you have templates to alter the boot options, then run udpate-grub, which will read those templates, create the grub.cfg with all changes you made..

The grub.cfg is not to be modified directly (stated in the grub homepage) and is one of the BASIC concepts to keep in mind.

Snayler
2013-04-11, 12:11
Do not touch the grub.cfg, you have templates to alter the boot options, then run udpate-grub, which will read those templates, create the grub.cfg with all changes you made..

The grub.cfg is not to be modified directly (stated in the grub homepage) and is one of the BASIC concepts to keep in mind.
Although I've edited grub.cfg multiple times and never had a problem, you're right. Thank you for correcting me.
@OP: Editing grub.cfg directly may be dangerous if you don't know what you're doing. Typos/syntax mistakes can prevent your OS from booting.

raesene
2013-04-18, 13:43
Thanks for the info. That does sound like a good idea, although I may have to go with the liveCD modification approach this time as it looks like a full Kali install takes more space than is available on a 8GB USB key.

lund99
2013-05-02, 12:38
According to the GRUB documentation, the template file should be located at /etc/default/grub - however I can't find it in Kali 1.0.3
It does not seem like the update-grub command is available there either..

However, in a VM I have running of Kali 1.0.1 both the template file and update-grub command is available.

Does anyone know how to solve this, I'm guessing there is a package available that will sort it out but I'm wary about installing something that might mess up my current GRUB setup

maverik35
2013-05-02, 13:43
One template is /etc/default/grub, just use nano or any other editor.

The other templates are under /etc/grub.d, here you can change the boot options, the OS to boot as default, add manually other OS in case os-prober do not detect it, etc..You have many templates:
00_header, 05_debian_theme, 10_linux, 20_linux_xen, 30_os-prober, 40_custom, 41_custom

After modifiying the templates, you use grub-update, this will cause the grub to read all templates and will form the new grub.cfg.

Luck...

lund99
2013-05-02, 13:52
Thanks, the thing is though, that the /etc/default/grub template does not exist in the 1.0.3 version of Kali

maverik35
2013-05-03, 16:09
Thanks, the thing is though, that the /etc/default/grub template does not exist in the 1.0.3 version of Kali

Do you have the /etc/grub.d folder?

ok2play
2013-11-02, 22:21
Ok, I was wondering same and was also having problems with installing Nvida driver since Kali docs says:

"sed 's/quiet/quiet nouveau.modeset=0/g' -i /etc/default/grub"

On VMware VM the /etc/default/grub is there but like said above, in the Kali live it is not?

Other quick questons while here, what .ISO is suggested or should be used for USB? In the kali docs for how to persistence when formatting the patition for persistence it shows his /dev/sdb1 Kali Live only being 832.97 MiB - mine ended up being 2.35 GiB.

What is the MINI (22MB) version?

acesso
2015-10-09, 16:43
Okay this maight be quit bit old, in any case.
In Live Kali linux 2, after you burn the iso on the stick the partition table may look like this:

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 1615871 1615808 789M 17 Hidden HPFS/NTFS
/dev/sdb2 1615872 1770431 154560 75.5M 1 FAT12

You may be able to mount /dev/sdb2 , let say on /mnt

"mount /dev/sdb2 /mnt"

And edit boot files directly at /mnt/EFI/BOOT/live.cfg (whichi is the cfg file for the main menu) you just need to change the "menu default" line to the block you want to be the default boot option. you may also look at other .cfg files and edit them as well.

brunoaduarte
2015-12-12, 19:52
Okay this maight be quit bit old, in any case.
In Live Kali linux 2, after you burn the iso on the stick the partition table may look like this:

Device Boot Start End Sectors Size Id Type
/dev/sdb1 * 64 1615871 1615808 789M 17 Hidden HPFS/NTFS
/dev/sdb2 1615872 1770431 154560 75.5M 1 FAT12

You may be able to mount /dev/sdb2 , let say on /mnt

"mount /dev/sdb2 /mnt"

And edit boot files directly at /mnt/EFI/BOOT/live.cfg (whichi is the cfg file for the main menu) you just need to change the "menu default" line to the block you want to be the default boot option. you may also look at other .cfg files and edit them as well.

I edited live.cfg and put "menu default" on persistence option



label live-persistence
menu label ^Live USB Persistence (check kali.org/prst)
menu default
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live noconfig=sudo username=root hostname=kali persistence


but it didnt worked... it doesn't auto select this option on boot

mete777
2015-12-30, 20:10
I edited live.cfg and put "menu default" on persistence option



label live-persistence
menu label ^Live USB Persistence (check kali.org/prst)
menu default
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live noconfig=sudo username=root hostname=kali persistence


but it didnt worked... it doesn't auto select this option on boot

Hi You must Edit isolinux.cfg with notepad++ in the same directory as live.cfg on the USB drive and set "timeout 0" to "timeout 30" or 50 to make it Autoload 3 sec or 5 seconds Load the Deafault Kali option that you made

Thats It!
Have a Nice Day

brunoaduarte
2016-01-03, 15:06
Hi You must Edit isolinux.cfg with notepad++ in the same directory as live.cfg on the USB drive and set "timeout 0" to "timeout 30" or 50 to make it Autoload 3 sec or 5 seconds Load the Deafault Kali option that you made

Thats It!
Have a Nice Day

Didn't worked @mete777

live.cfg


label live-686-pae
menu label ^Live (686-pae)
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live username=root hostname=kali

label live-686-pae-failsafe
menu label ^Live (686-pae failsafe)
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal

label live-forensic
menu label Live (^forensic mode)
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live noconfig=sudo username=root hostname=kali noswap noautomount

label live-persistence
menu label ^Live USB Persistence (check kali.org/prst)
menu default
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live noconfig=sudo username=root hostname=kali persistence

label live-encrypted-persistence
menu label ^Live USB Encrypted Persistence (check kali.org/prst)
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live persistent=cryptsetup persistence-encryption=luks noconfig=sudo username=root hostname=kali persistence


isolinux.cfg


include menu.cfg
default vesamenu.c32
prompt 0
timeout 30

St0ner1995
2016-02-07, 02:47
Any update on this?

i have edited the files but there is no change

menu.cfg

menu hshift 0
menu width 82

menu title EFI Boot menu
include stdmenu.cfg
include live.cfg
menu begin advanced
menu title Advanced options
include stdmenu.cfg
label mainmenu
menu label ^Back..
menu exit
include advanced.cfg
menu end

menu clear


live.cfg

label live-persistence
menu label ^Live USB Persistence
menu default
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live noconfig=sudo username=root hostname=kali persistence

label live-forensic
menu label Live (^forensic mode)
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live noconfig=sudo username=root hostname=kali noswap noautomount

label live-amd64
menu label ^Live (amd64)
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live username=root hostname=kali

label live-amd64-failsafe
menu label ^Live (amd64 failsafe)
linux /live/vmlinuz
initrd /live/initrd.img
append boot=live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal



isolinux.cfg

include menu.cfg
default vesamenu.c32
prompt 0
timeout 0

ForumKali2016
2016-06-03, 20:25
Any update on this? Editing .cfg files doesn't change any grub options. It must have load from another place.

Seems like it's in iso9660 read-only image in /isolinux/ dir, so there's no way to change it, except regenerating .iso image and writing it on flash again.