The hostname proposed by installer is too long for file sharing to work correctly.

Bug #735072 reported by Johan Fornander on 2011-03-14
28
This bug affects 4 people
Affects Status Importance Assigned to Milestone
One Hundred Papercuts
Low
Unassigned
samba (Ubuntu)
High
Ubuntu Server
Precise
High
Ubuntu Server
ubiquity (Ubuntu)
High
Unassigned
Precise
High
Unassigned

Bug Description

I have an Acer Aspire TimelineX 3820TG notebook running Natty.

When installing Natty the installer wizard proposed the hostname "johan-aspire-3820" (17 characters). This made it impossible for me to share files over the network using a machine running OSX on the other end. Changing the hostname to a shorter (4 characters in my case) made file sharing work again after rebooting. I have been using the sharing option through right-clicking in nautilus and would like to see the following changes:

1. A limit of x (depending on samba?) characters for hostname when performing a fresh install. If the user wants a longer one this could be done using some override setting option.
2. Also, when trying to share files through nautilus, check to see if the hostname does fit withing the limit x or else give the user an option to change this.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: software-center 3.1.23.2
ProcVersionSignature: Ubuntu 2.6.38-6.34-generic 2.6.38-rc7
Uname: Linux 2.6.38-6-generic x86_64
NonfreeKernelModules: wl
Architecture: amd64
Date: Mon Mar 14 17:12:56 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64 (20110119)
ProcEnviron:
 LANGUAGE=en_US:en
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: software-center
UpgradeStatus: No upgrade log present (probably fresh install)

summary: - The hostname proposed by installer is too long file sharing to work
+ The hostname proposed by installer is too long for file sharing to work
correctly.
tags: added: ubiquity
affects: ubuntu → ubiquity (Ubuntu)

Thanks go to the user Morbuis1 on the ubuntu forums for solving this bug. See this post for more info:

http://ubuntuforums.org/showpost.php?p=10556858&postcount=20

Another thread where a user was affected by a too long hostname, seems to be set by ubiquity as well:
http://ubuntuforums.org/showthread.php?t=1531154&page=2

description: updated
Colin Watson (cjwatson) on 2011-03-30
Changed in ubiquity (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Evan (ev) wrote :

I'm moving this to Samba, after conferring with Steve Langasek. The samba package should detect the case where the hostname is longer than the limit set by NetBIOS and truncate it for its own configuration.

Changed in ubiquity (Ubuntu):
status: Confirmed → Invalid
Changed in samba (Ubuntu):
importance: Undecided → High
status: New → Confirmed
Vish (vish) on 2011-03-31
Changed in hundredpapercuts:
importance: Undecided → Low
status: New → Confirmed
Changed in samba (Ubuntu):
assignee: nobody → Canonical Server Team (canonical-server)
Chuck Short (zulcss) wrote :

I dont agree with option number 2 because it would break the netbios protocol.

http://en.wikipedia.org/wiki/NetBIOS#NetBIOS_name

Couldn't ubiquity do something reasonable to limit the hostname to within 16 characters?

chuck

Changed in samba (Ubuntu):
assignee: Canonical Server Team (canonical-server) → nobody
Evan (ev) wrote :

Some commentary from IRC:

zul: ev: ping for the samba bug, couldnt ubiquity do something sensible and not allow more that 16 characters in a hostname?
[18:04] ScottK: Why is a 16 character hostname limit sensible?
[18:04] ev: zul: this is a limitation in netbios, not linux.
[18:05] ev: ScottK: indeed
[18:06] ev: I think this is best solved where the problem arises, in Samba. I can talk to another machine with more than 16 characters in its hostname using every other network protocol I can think of.
[18:06] ev: equally, you can set the hostname outside of the installer, so even if we did this in ubiquity, the problem would remain.
[18:07] zul: ev: right its a problem with netbios...so something like print a warning or something
[18:08] ScottK: RFC 1123 says "Host software MUST handle host names of up to 63 characters and SHOULD handle host names of up to 255 characters."
[18:08] zul: ScottK: right ill get on changing the netbios protocol
[18:09] ScottK: I understand the problem.
[18:09] • ScottK imagines a netbios equivalent for hostnames of 8.3 long/short filenames.

I am firmly against modifying ubiquity to work around limitations in the NetBIOS protocol. This belongs in Samba.

Mac OS X broadcasts the first 15 characters of your hostname via NetBIOS. This works for them so it could be a good solution for Ubuntu as well.

If you have to, you could perhaps set up a truncated hostname alias if the samba hostname must be reachable through /etc/hosts? That way the machine could be reached by both 15 and 63 (or 255) byte names, or am I wrong? If not, just truncate it in the smb.conf and notify user of the shorter NETBIOS name to browse for just like in OSX? I'm for the second option.

BTW, make sure that you use 15 and not 16 characters as the limit for samba hosts... From wikipedia:

"The NetBIOS name is 16 ASCII characters, however Microsoft limits the hostname to 15 characters and reserves the 16th character as a NetBIOS Suffix."

C de-Avillez (hggdh2) on 2011-04-11
Changed in samba (Ubuntu):
assignee: nobody → Canonical Server Team (canonical-server)
status: Confirmed → Triaged
C de-Avillez (hggdh2) wrote :

Ah well. Dear LP lost my comments on the change above.

Setting Triaged for the Samba (Ubuntu) task: this is clearly something to be adjusted there; reassigning to the Canonical Server Team.

We could, pretty much, do the same as OSX: truncate the hostname to 15 characters, document it, and go from there.

Changed in samba (Ubuntu):
assignee: Canonical Server Team (canonical-server) → Ubuntu Server Team (ubuntu-server)

The source code in the official samba git (source/lib/util.c) seems to use HOST_NAME_MAX and I found an inconsistency in the code base:

source/lib/replace/replace.h:
 384 #ifndef HOST_NAME_MAX
 385 #define HOST_NAME_MAX 255

source/lib/replace/system/network.h
 269 #ifndef HOST_NAME_MAX
 270 #define HOST_NAME_MAX 256

Which one is used?

Then here is what I think my problem is:

The function get_myname() in util.c uses
char hostname[HOST_NAME_MAX];

Another function in the same file, set_netbios_aliases(), blindly uses this hostname through helper functions without checking its boundaries to match those of a valid NetBIOS name.

Now I could be wrong since I just took 5 minutes to check the source code while also skimming this link:
http://www.tech-faq.com/netbios-names.html

How this is supposed to work out of the box when windows machines, or osx for that matter, only recognizes NetBIOS names of length 15 is beyond me. Can this really have been overlooked since the inception of samba or am I missing something here?

On Mon, 2011-04-25 at 17:02 +0000, Johan Fornander wrote:
> The source code in the official samba git (source/lib/util.c) seems to
> use HOST_NAME_MAX and I found an inconsistency in the code base:
>
> source/lib/replace/replace.h:
> 384 #ifndef HOST_NAME_MAX
> 385 #define HOST_NAME_MAX 255
>
> source/lib/replace/system/network.h
> 269 #ifndef HOST_NAME_MAX
> 270 #define HOST_NAME_MAX 256
>
> Which one is used?
Neither would/should be used as the Linux system headers already define
HOST_NAME_MAX. These defines are only for platforms that don't have
HOST_NAME_MAX.

Cheers,

Jelmer

  • unnamed Edit (2.5 KiB, text/enriched; charset=WINDOWS-1252)

I'm out of the office until 1st August.

On 25 Apr 2011, at 19:26, Jelmer Vernooij <email address hidden>
wrote:

> On Mon, 2011-04-25 at 17:02 +0000, Johan Fornander wrote:
> The source code in the official samba git (source/lib/util.c) seems to
> use HOST_NAME_MAX and I found an inconsistency in the code base:
>
> source/lib/replace/replace.h:
> 384 #ifndef HOST_NAME_MAX
> 385 #define HOST_NAME_MAX 255
>
> source/lib/replace/system/network.h
> 269 #ifndef HOST_NAME_MAX
> 270 #define HOST_NAME_MAX 256
>
> Which one is used?
> Neither would/should be used as the Linux system headers already
> define
> HOST_NAME_MAX. These defines are only for platforms that don't have
> HOST_NAME_MAX.
>
> Cheers,
>
> Jelmer
>
> --
> You received this bug notification because you are a member of
> Papercutters, which is subscribed to One Hundred Paper Cuts.
> https://bugs.launchpad.net/bugs/735072
>
> Title:
>  The hostname proposed by installer is too long for file sharing to
>  work correctly.
>
> Status in One Hundred Paper Cuts:
>  Confirmed
> Status in “samba” package in Ubuntu:
>  Triaged
> Status in “ubiquity” package in Ubuntu:
>  Invalid
>
> Bug description:
>  I have an Acer Aspire TimelineX 3820TG notebook running Natty.
>
>  When installing Natty the installer wizard proposed the hostname
>  "johan-aspire-3820" (17 characters). This made it impossible for me
> to
>  share files over the network using a machine running OSX on the other
>  end. Changing the hostname to a shorter (4 characters in my case)
> made
>  file sharing work again after rebooting. I have been using the
> sharing
>  option through right-clicking in nautilus and would like to see the
>  following changes:
>
>  1. A limit of x (depending on samba?) characters for hostname when
> performing a fresh install. If the user wants a longer one this
> could be done using some override setting option.
>  2. Also, when trying to share files through nautilus, check to see
> if the hostname does fit withing the limit x or else give the user
> an option to change this.
>
>  ProblemType: Bug
>  DistroRelease: Ubuntu 11.04
>  Package: software-center 3.1.23.2
>  ProcVersionSignature: Ubuntu 2.6.38-6.34-generic 2.6.38-rc7
>  Uname: Linux 2.6.38-6-generic x86_64
>  NonfreeKernelModules: wl
>  Architecture: amd64
>  Date: Mon Mar 14 17:12:56 2011
>  InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha amd64
> (20110119)
>  ProcEnviron:
>   LANGUAGE=en_US:en
>   LANG=en_US.UTF-8
>   SHELL=/bin/bash
>  SourcePackage: software-center
>  UpgradeStatus: No upgrade log present (probably fresh install)

jorge (rivocop-66) on 2011-10-11
Changed in samba (Ubuntu):
status: Triaged → New
Changed in samba (Ubuntu):
status: New → Triaged
tags: added: rls-mgr-p-tracking
Dave Walker (davewalker) on 2011-10-26
Changed in samba (Ubuntu):
assignee: Ubuntu Server Team (ubuntu-server) → nobody
Scott Kitterman (kitterman) wrote :

Looks like something that should be upstreamed to samba.

Am 18/11/11 17:36, schrieb Scott Kitterman:
> Looks like something that should be upstreamed to samba.
This doesn't affect upstream. The way in which the netbios name is
generated is specific to Debian/Ubuntu.

Cheers,

Jelmer

Sebastien Bacher (seb128) wrote :

setting as a target for precise, it's bitting quite some users it seems and is the sort of things we should to handle better in a lts

Changed in samba (Ubuntu Precise):
assignee: nobody → Ubuntu Server Team (ubuntu-server)

still there in 13.04

Changed in samba (Ubuntu):
status: Triaged → Incomplete
Changed in hundredpapercuts:
status: Confirmed → Incomplete
status: Incomplete → Confirmed
Changed in samba (Ubuntu):
status: Incomplete → Fix Committed
Changed in hundredpapercuts:
status: Confirmed → Fix Committed
Changed in samba (Ubuntu Precise):
status: Triaged → Fix Committed
snoop foo (snoopfoo19) on 2018-02-21
Changed in ubiquity (Ubuntu):
status: Invalid → New
Changed in ubiquity (Ubuntu Precise):
status: Invalid → Confirmed
status: Confirmed → Fix Released
Changed in ubiquity (Ubuntu):
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions