How to change hostname

Asked by pablo Caron

Dear developers,

First I would like to thank you for this software, It makes the building of a custom Ubuntu a very easy task.

I managed to add a custom user "student" and the live pendrive logs in into this user by default. Everything is ok about this.
Now I have to change the hostname to "student". How can I change it?

Regards

Pablo

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
PJSingh5000
Solved:
Last query:
Last reply:
Revision history for this message
PJSingh5000 (pjsingh5000) said :
#1

You want to change the hostname in the Live environment, when you boot into the pen drive?

Revision history for this message
pablo Caron (pablocaron) said :
#2

Hi,

Yes, you're right. I managed to force the hostname by setting the "Volume ID" as the username. I think there should be "a correct way" of doing this.

Revision history for this message
Best PJSingh5000 (pjsingh5000) said :
#3

An easy way to do this is to add the hostname boot parameter to your boot configurations files.

-----------------------------------
Approach
-----------------------------------

(a) For UEFI boot in Ubuntu 20.04...

    Edit boot/grub/grub.cfg
    Note that the section 'menuentry "Ubuntu"' is used for the default option

(b) For Legacy BIOS boot in Ubuntu 20.04...

    Edit isolinux/txt.cfg
    Note that the section 'label live' is used for the default option

(c) However, to keep things simple, just add this parameter to all default (filtered) boot configuration files listed on Boot tab of Cubic's Options page.

Note: The files you see on the Boot tab may be different depending on your flavor or version of Ubuntu. For example, for XUbuntu 20.04, only has /isolinux/txt.cfg.

-----------------------------------
Steps
-----------------------------------

On the Boot tab of Cubic's Options page...

1. Select boot/grub/grub.cfg

    Add the hostname=STUDENT parameter to the line(s) that start with liunx

2. Select boot/grub/loopback.cfg

    Add the hostname=STUDENT parameter to the line(s) that start with liunx

3. Select isolinux/txt.cfg

    Add the hostname=STUDENT parameter to the line(s) that start with append

-----------------------------------
Example
-----------------------------------

Here is an example of what the isolinux/txt.cfg should look like. In Ubuntu 20.04, this file is used for Legacy BIOS boot.

default live
label live
  menu label ^Try Ubuntu without installing
  kernel /casper/vmlinuz
  append boot=casper hostname=STUDENT file=/cdrom/preseed/ubuntu.seed initrd=/casper/initrd.lz quiet splash ---
label live-nomodeset
  menu label ^Try Ubuntu without installing (safe graphics)
  kernel /casper/vmlinuz
  append boot=casper hostname=STUDENT file=/cdrom/preseed/ubuntu.seed initrd=/casper/initrd.lz quiet splash nomodeset ---
label live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz
  append boot=casper hostname=STUDENT file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/casper/initrd.lz quiet splash ---
label live-install-nomodeset
  menu label ^Install Ubuntu (safe graphics)
  kernel /casper/vmlinuz
  append boot=casper hostname=STUDENT file=/cdrom/preseed/ubuntu.seed only-ubiquity initrd=/casper/initrd.lz quiet splash nomodeset ---
label memtest
  menu label Test ^memory
  kernel /install/mt86plus
label hd
  menu label ^Boot from first hard disk
  localboot 0x80

Revision history for this message
pablo Caron (pablocaron) said :
#4

Thanks PJSingh5000, that solved my question.