LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Installing debian 10 onto usb (https://www.linuxquestions.org/questions/linux-newbie-8/installing-debian-10-onto-usb-4175678403/)

larstrier 07-09-2020 01:00 AM

Installing debian 10 onto usb
 
This page from debian.org says 'Debian CD and DVD images can now be written directly to a USB stick, which is a very easy way to make a bootable USB stick'.

If this is true then I should be able to have debian on usb by simply using the following commands:
Code:

# cp debian.iso /dev/sdX
# sync

This is fantastic. Unfortunately the links on the page do not send me to the location for the 'hybrid' debian-10-usb-with-persistance .iso file.
Does anyone know where I can find the appropriate .iso file please? (I will need the non-free version which I think exists)

If it is THIS easy to have debian on usb (which I don't believe) then surely people should be making tutorials of this everywhere to promote Linux distros.
Thank you everyone for reading.

markd81 07-09-2020 03:12 AM

Debian has some unofficial non-free firmware live iso's to download from here.

ondoho 07-09-2020 03:58 AM

^ Yep.
Quote:

Originally Posted by larstrier (Post 6143259)
This page from debian.org says 'Debian CD and DVD images can now be written directly to a USB stick, which is a very easy way to make a bootable USB stick'.

Also please understand that this is not the same as "Installing". You're creating an installation medium.

captain_sensible 07-09-2020 04:11 AM

i think with ventoy you can go one better https://ventoy.net/en/index.html

https://github.com/ventoy/Ventoy/releases

I just drag and dropped a few iso's and have the choice to boot from any one. It doesn't work with all iso
but quite some useful ones. Also it allows persistence via a 1 gig .img file. Again it doesn't work with all. Some tweaks also need to be done but for instance i got Mint Cinnamon 64 bit working with persistence using the img file with label casper-rw. Also slackware current install dvd iso boots fine

larstrier 07-09-2020 06:06 AM

Quote:

Originally Posted by markd81 (Post 6143285)
Debian has some unofficial non-free firmware live iso's to download from here.

Thank you that was exactly the link I was looking for.

I downloaded the .iso file, used the cp command from the debian.org page (above) and it worked!
On booting from the usb the debian-installer loaded and I went through the install process for Debian 10.

My only problem is I can't get past the 'partition' section.
I first choose to partition the whole disk (usb) and the installer creates 2 default partitions:
1. A large primary boot partition labelled 'f' and
2. A small logical swap partition labelled 'F'.

This looks fine to me and I continue on to the next stage.
But the installer says it failed to partition the usb.
I tried deleting the swap partition - but that only resulted in the same partition being labelled 'free space'.

Since I'm using a hybrid debian .iso file for a usb - I'm wondering if I'm supposed to partition the usb differently somehow.

larstrier 07-09-2020 06:11 AM

Quote:

Originally Posted by ondoho (Post 6143303)
^ Yep.

Also please understand that this is not the same as "Installing". You're creating an installation medium.

Does this mean I'm creating the debian-installer onto the usb?

In which case am I supposed to use the debian-installer to install onto a different target usb?

colorpurple21859 07-09-2020 07:00 AM

Quote:

Does this mean I'm creating the debian-installer onto the usb?

In which case am I supposed to use the debian-installer to install onto a different target usb?
Yes, that is what it means
If your want a live iso, with persistance and not a true install, you will need a second partition on the usb for storage. I don't think that can be done from the running usb

larstrier 07-09-2020 07:29 AM

Quote:

Originally Posted by colorpurple21859 (Post 6143367)
Yes, that is what it means
If your want a live iso, with persistance and not a true install, you will need a second partition on the usb for storage. I don't think that can be done from the running usb

Ok that makes sense.

Thank you very much everyone.

larstrier 07-09-2020 11:02 AM

Still having problems with this Debian 10 install.
I used the usb with debian-installer to install Debian 10 onto a seperate usb.
Everything seemed to go smoothly until the last step - where to install grub?

The debian-installer asks whether to install grub bootloader onto the master boot record of my hard disk.
Since the OS is on a portable usb I set the grub bootloader to install onto my target usb instead.
But now after successfully completing the install the target usb will not boot.
What am I doing wrong?

Do I need to re-install grub onto the target usb?
Or do I need to do the install again - only this time installing grub bootloader onto the mbr of my hard disk?

colorpurple21859 07-09-2020 11:37 AM

Quote:

Do I need to re-install grub onto the target usb?
yes that would be a better solution.
The short version:
If you are going to use it on uefi systems the usb will need a 200MB fat32 partition mounted at the usb /boot/efi.
To reinstall grub boot the installer mount the usb roofs partition, mount the efi partition to the usb boot/efi, use mount --bind to mount /dev /proc /sys /run to the same directories of the usb, chroot <mount point of usb>
for efi run
Code:

grub-install --target=x86_64-efi-efi --removable
, for legacy
Code:

grub-install --target=i386-pc /dev/sd?
where ? will the usb letter.
Run update-grub to get a grub menu
I think debian will only install grub-efi or grub-i386pc you will have to use apt to install the missing grub-target.

larstrier 07-09-2020 07:52 PM

Quote:

Originally Posted by colorpurple21859 (Post 6143465)
for legacy
Code:

grub-install --target=i386-pc /dev/sd?
where ? will the usb letter.
Run update-grub to get a grub menu
I think debian will only install grub-efi or grub-i386pc you will have to use apt to install the missing grub-target.

Thank you for your reply.
This is a little bit complicated as I don't know anything about programming.
I have BIOS.

Should I install grub from a working debian OS onto the target usb? Or do I boot debian-installer to do that?

Is it easier if I go through the whole install process again and install grub to the mbr of my harddisk?
In which case, will the usb boot on any other device?

colorpurple21859 07-09-2020 08:10 PM

Quote:

Should I install grub from a working debian OS onto the target usb? Or do I boot debian-installer to do that?
A working debian OS will be easier. To install on a bios system. plug in the usb and as root run
Code:

parted -l
to determine what /dev your usb is and the partitions are. assuming the usb is /dev/sdb and the root partition is /dev/sdb2, for example purposes only(yours may be different and change acordingly) as root
Code:

mount /dev/sdb2 /mnt
grub-install --boot-directory=/mnt/boot /dev/sdb

find the UUID of the /dev/sdb2 with
Code:

lsblk -f
copy the /boot/grub/grub.cfg from debian over to the usb boot/grub.
edit the first debian menu entry and change uuids to match the uuid of /dev/sdb2 and kernel versions numbers of the kernels in the usb /boot.
Boot the usb and run update-grub

colorpurple21859 07-09-2020 08:16 PM

The usb should boot on other similar bios systems and uefi systems that have legacy/csm enabled.

larstrier 07-09-2020 10:05 PM

Quote:

Originally Posted by colorpurple21859 (Post 6143620)
A working debian OS will be easier. To install on a bios system. plug in the usb and as root run
Code:

parted -l
to determine what /dev your usb is and the partitions are. assuming the usb is /dev/sdb and the root partition is /dev/sdb2, for example purposes only(yours may be different and change acordingly) as root
Code:

mount /dev/sdb2 /mnt
grub-install --boot-directory=/mnt/boot /dev/sdb


After running 'parted -l' I get this:
Code:

Model: Samsung Flash Drive (scsi)
Disk /dev/sdg: 64.2GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start  End    Size    Type      File system    Flags
 1      1049kB  56.1GB  56.1GB  primary  ext4
 2      56.1GB  64.2GB  8048MB  extended
 5      56.1GB  64.2GB  8048MB  logical  linux-swap(v1)

I'm guessing the root partition is sdg2. But when I try to mount it I get the following error message:
Code:

# mount /dev/sdg2 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sdg2,
      missing codepage or helper program, or other error

      In some cases useful info is found in syslog - try
      dmesg | tail or so.


colorpurple21859 07-09-2020 10:42 PM

sdg1 is the partition it has an ext4 filessystem
Code:

mount /dev/sdg1 /mnt
grub-install --boot-directory=/mnt/boot /dev/sdg

sdg2 is an extented partition that the swap partition resides inside of.
An extended partition allows an msdos type disk to have more than 4 partitions


All times are GMT -5. The time now is 06:51 AM.