Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User on #raspbian reported that he can't login #45

Closed
hifi opened this issue Apr 16, 2014 · 30 comments
Closed

User on #raspbian reported that he can't login #45

hifi opened this issue Apr 16, 2014 · 30 comments
Assignees
Labels

Comments

@hifi
Copy link
Contributor

hifi commented Apr 16, 2014

A regular user of raspbian-ua-netinst reported on the IRC channel that he couldn't log in with the latest installer. Even if he did specify the root password the login was refused on first boot.

@diederikdehaas
Copy link
Member

I've just tested it (again), with no configuration file, and it 'works for me'.
So without further info, I can't do much.
So if there were error msg, if (s)he use one or more configuration files for installation, those things could all help to narrow it down.

@hifi
Copy link
Contributor Author

hifi commented Apr 17, 2014

"the openssh server is causing the login problem as it's disabling the password authentication when it gets installed." was reported last night. Could be a jessie issue? Apparently he could reproduce this with a full Raspbian image as well by upgrading openssh which effectively disabled password authentication for him.

@diederikdehaas
Copy link
Member

diederikdehaas commented Apr 17, 2014

On Wednesday 16 April 2014 21:29:53 Toni Spets wrote:

"the openssh server is causing the login problem as it's disabling the
password authentication when it gets installed." was reported last night.

From https://metadata.ftp-master.debian.org/changelogs//main/o/openssh/unstable_changelog (openssh (1:6.6p1-1)):

  • Change to "PermitRootLogin without-password" for new installations, and
    ask a debconf question when upgrading systems with "PermitRootLogin yes"
    from previous versions (closes: #298138).

Could be a jessie issue?

To say it simple, yes.
It's a change in Debian's default configuration of openssh-server since
1:6.6p1-1. From that version onward, root login is disabled by default.
Therefor, since 20140328, it does affect jessie based builds, but wheezy based
builds are still unaffected.

@hifi
Copy link
Contributor Author

hifi commented Apr 17, 2014

In the scope of the project, it should most definitely be "fixed" in raspbian-ua-netinst installer script to switch that to "yes" with sed or something during installation. If someone has the time of course.

@diederikdehaas
Copy link
Member

On Thursday 17 April 2014 00:07:50 Toni Spets wrote:

In the scope of the project, it should most definitely be "fixed" in
raspbian-ua-netinst installer script to switch that to "yes" with sed or
something during installation.

Wouldn't it make more sense to fix it by creating a normal user instead?

Another way to fix this would be to implement debconf preseeding. It's at the
top of my agenda for new features, see also
http://www.raspberrypi.org/forums/viewtopic.php?p=536290#p536290

It should be fixed, but I'm more inclined to solve it in another way then to
still allow root-with-password login. Another solution would also make it
future proof (and I think the new default for openssh-server is the right
one).

@hifi
Copy link
Contributor Author

hifi commented Apr 17, 2014

Maybe have the option to do so in the config then possibly? I don't always want any normal user during installation and I later secure ssh by changing sshd_config and removing root password if I so feel like.

Though, you don't need to do everything according to my likings. It seems there are enough users that care that their voice is much more important.

@diederikdehaas
Copy link
Member

On Thursday 17 April 2014 00:07:50 Toni Spets wrote:

it should most definitely be "fixed" in raspbian-ua-netinst installer script
to switch that to "yes" with sed or something

I am in favor of doing this as a quick hack for now, so that raspbian-ua-
netinst becomes usuable again for ppl who want jessie now.

I still think my previous answer is the right one, but since it requires some
infrastructure work, it's more suited for the 'long' term.

@diederikdehaas
Copy link
Member

The 'sed' hack can probably done in post-install.txt ... which would be the quickest way to fix it ...

@diederikdehaas
Copy link
Member

Workaround for jessie:
Place the following line in post-install.txt:

sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/' /rootfs/etc/ssh/sshd_config

and then you can login as root on a jessie system.

I'll leave this issue open, so the workaround is found more easily and until a proper fix is found and implemented.

@johr
Copy link

johr commented May 10, 2014

As a had problems to login after a fresh install, i tried your suggestions.
To get the lastest fixes I downloaded the 'current' snapshot (from 2014-05-04).

I added the post-install PermitRootLogin workaround, but that had no effect, in the snapshot this was already set the right way.

I still could not login.
So I checked the root pw (mounted the SD-card on another system) resp. replaced it with a pw-hash that 'really' corrsponds to 'raspbian'.
After this change the login was possible :-)

So it seems that some wrong pw is set during installation:
The code doing the pw-setting for root (rcS):
echo -n root:$rootpw | chroot /rootfs /usr/sbin/chpasswd || fail

Maybe this produces the wrong pw.
I didn't check this further, so maybe you have suggestions or a fix for this issue.


Workaround:

After all. As a workaround for not being able to login as Root:

-) mount the SD-card on another (linux-) system
-) copy a known pw-hash to /etc/shadow (for the root-user) and save it
-) edit /etc/fake-hwclock.data with a future date so fdisk would not complain during startup
(it does, if the this date does not correspond to some degree with the date of last filesystem change)
-) unmount

With this changed system, a root Login should be possible.

@diederikdehaas
Copy link
Member

On Saturday 10 May 2014 00:59:45 johr wrote:

As a had problems to login after a fresh install, i tried your suggestions.
To get the lastest fixes I downloaded the 'current' snapshot (from
2014-05-04).

I added the post-install PermitRootLogin workaround, but that had no effect,
in the snapshot this was already set the right way.

Can you explain to me what you mean by 'current snapshot (from 2014-05-04)'?
Because the code of raspbian-ua-netinst does not (yet?) change the
PermitRootLogin value.

@johr
Copy link

johr commented May 10, 2014

I did a wget on 'https://github.com/hifi/raspbian-ua-netinst/archive/master.tar.gz' .
Started build.sh immediately after (update.sh contained release=jessie, so I suspect the jessie repository was used).
Result was: raspbian-ua-netinst-20140504-git.zip .

Details:
But the problem with the login persisted .... so I tried the suggestions.
After I made it work by resetting the root-pw manually, I reverted all changes (post-install.txt with the sed-command) and copied the files on the SD-card, put it in the Raspi, and let the installer do its job. And after that, set the root-pw manually: root login was possibly (so this was the only change needed).
Looked in /etc/ssh/sshd_conf ... already contained 'PermitRootLogin yes'.

@diederikdehaas
Copy link
Member

update.sh does indeed pull stuff from jessie, but unless you specify jessie in 'installer-config.txt', you're installing wheezy.
Can you try with the official release: https://github.com/hifi/raspbian-ua-netinst/releases/tag/v1.0 to see whether that works (or not)?
In installer-config.txt you can specify a root password, does that work?
See https://github.com/hifi/raspbian-ua-netinst#installer-customization for details.

@johr
Copy link

johr commented May 11, 2014

OK. So packages from jessie are pulled during the build of the installer, but when running the installer (if release is not specified) the system is built using wheezy?

The official release was my first try, but login was not possible.
--> I will try again with the workaround I described and report the results.

I specified the root-pw in the installer-config.txt but it seemed to be not used the correct way.
Here my installer-config.txt:

preset=server
packages=screen # comma separated list of extra packages
hostname=raspiserver
domainname=raspiserver.local
rootpw=raspbian
rootsize=+1024M # to keep the used space small

@johr
Copy link

johr commented May 11, 2014

Using the official release:
-) root Login not possible with root/raspbian
-) check: 'PermitRootLogin yes' in /etc/ssh/sshd_conf --> OK.
-) change root-pw (as described)
-) login possible with 'raspian'

So as it seems the workaround works for both the release and the current code (from my point fo view).

@diederikdehaas
Copy link
Member

On Sunday 11 May 2014 01:32:20 johr wrote:

OK. So packages from jessie are pulled during the build of the installer,
but when running the installer (if release is not specified) the system is
built using wheezy?

Correct. To build the system cdebootstrap is used and the cdebootstrap package
from wheezy doesn't know jessie, therefor building the installer uses the
packages from jessie, so jessie can be installed as well.

The official release was my first try, but login was not possible.
--> I will try again with the workaround I described and report the results.

Thanks for testing and reporting back. It's a good thing the results are
consistent; not so good it's a constant fail.
But I am rather puzzled as to why it's failing with you and consistantly
working with me (and others).
The only thing that I can think of at the top of my head is trying a different
keyboard. But if it would work then, I'd still have no idea as to how to fix
it.
In the meantime I'll test it with your exact config to see whether your specific
config may have been the trigger.

@diederikdehaas
Copy link
Member

I've just tested using the official v1.0 installer (.img.xz file) with your config ... and I'm able to login without any issues or applying workarounds.
I've now also tested it with the .zip file and again I have no problems installing and after the install logging in as root.

On what OS are you transferring the image to your SD card and creating/modifying the installer-config.txt file? Someone has reported differences between linux and windows.
Since I don't have a windows system I do everything on linux (Debian).

@johr
Copy link

johr commented May 11, 2014

Cause it works if I'm setting the password manually there has to be a problem during the install at the point when the root-pw is set.

You might be right, that the issue is caused by using a windows-system. I created the installer-config.txt on windows and set the root-pw there. Then I copied the files to the SD-card. As a know window encodes a 'newline' as 'carriage-return'+'line-feed'. Maybe the additional character causes the pw to be used 'raspbian'+'line-feed'?

A simple test would be:
-) to not set the pw in the installer-config.txt
-) addtionally: check what happens if the installer-config.txt is edited on a linux system
--> does it work?
--> I will test this tomorrow and report.

If this is the reason that the login does not work and windows (resp. Mac) should be supported too, there has to be some conversion of the install-config.txt, post-install.txt to make them work on a linux-system. Regardless where the files come from (windows, linux).

@diederikdehaas
Copy link
Member

On Sunday 11 May 2014 12:42:50 johr wrote:

You might be right, that the issue is caused by using a windows-system. I
created the installer-config.txt on windows and set the root-pw there.
A simple test would be:
-) to not set the pw in the installer-config.txt
-) addtionally: check what happens if the installer-config.txt is edited on
a linux system --> does it work?
--> I will test this tomorrow and report.

Awesome, thanks :-)

Have you always specified the root-pw in installer-config.txt?
Because if that's the case, it is quite likely that that has caused it
(combined with windows-linux differences).
The root-pw setting is the most likely to suffer from even a small difference.

If this is the reason that the login does not work and windows (resp. Mac)
should be supported too, there has to be some conversion of the
install-config.txt, post-install.txt to make them work on a linux-system.
Regardless where the files come from (windows, linux).

The goal is to support windows, mac and linux.
I don't expect issues with mac, since it's basically also a *nix system.
I may be able to setup a windows(xp) system, but that is gonna take (quite
some) time.

@johr
Copy link

johr commented May 12, 2014

The first test:
-) on windows not setting the root-pw
--> after install, login with raspbian was possible

So my proposed workaround reduces to:
"If you are using windows to edit the installer-config.txt don't set the rootpw but rely on the default one."

The next test (post-process installer-config.txt on a linux system) will follow.

@diederikdehaas
Copy link
Member

Phew, that's quite a relief!
So it seems to be the same (or at least very similar) to #46 (comment)

@johr
Copy link

johr commented May 12, 2014

I added the root-pw again (on a windows system),
opened the file on linux with vi:


preset=server^M
packages=screen # comma separated list of extra packages^M
hostname=raspiserver^M
domainname=raspiserver.local^M
rootpw=raspbian^M
rootsize=+1024M # / partition size, leave empty to use all free space


Then I deleted the ^M and put the SD-Card in the Raspi.
--> Installing ....
--> Login with root/raspbian was possible

So if the installer-config.txt is edited on windows than there are 3 possibilities:
a) don't provide a root-pw
b) post-process it on linux to remove the trailing charcter
c) if Windows is available only, putting a comment at the end of every line will put
the additonal character further away from the value, so it cannot disturb it.

@diederikdehaas
Copy link
Member

This is awesome, thank you very much 👍

diederikdehaas added a commit to diederikdehaas/raspbian-ua-netinst that referenced this issue May 13, 2014
unix.

Hopefully this fixes the issues reported by johr in issue debian-pi#45 and issue debian-pi#50
reported by Limpster.
@diederikdehaas
Copy link
Member

@johr Can you ran a new test for me?
Build a new installer image, but this time take this URL:
https://github.com/diederikdehaas/raspbian-ua-netinst/archive/fix-windows-configs.zip

And then create your config files on windows like you did before and install the system. With a little luck this should fix the issue.

(I use my own fork to mess around. When I think the changes are good enough, I commit them to the official repo)

@johr
Copy link

johr commented May 13, 2014

I did the test (using the built installer): 👍

My next steps for building the system is installing various packages and then removing the installer files. So if you don't mind I would like to ask you (in this thread) which files I need to remove, so no 'accidentally' reinstallation can happen.

@diederikdehaas
Copy link
Member

On Tuesday 13 May 2014 12:08:42 johr wrote:

I did the test (using the built installer): 👍

Awesome :-)

My next steps for building the system is installing various packages and
then removing the installer files. So if you don't mind I would like to ask
you (in this thread) which files I need to remove, so no 'accidentally'
reinstallation can happen.

I actually have no idea how to trigger a reinstall.
@hifi: do you know how to trigger a reinstall and how to prevent that?

@diederikdehaas
Copy link
Member

Hi @johr,
As described in https://github.com/hifi/raspbian-ua-netinst#reinstalling-or-replacing-an-existing-system the way to trigger a reinstallation would be by moving/copying /boot/config-reinstall.txt to /boot/config.txt and then rebooting.
That doesn't sounds like something that can happen accidentally and it needs to be done as root.
Since root can do with the system whatever he/she wants, there is no way to prevent it other then being careful with the root account, which you should always do anyway.

@johr
Copy link

johr commented May 18, 2014

OK, thanks. I read the docs and looked at the installed system.
I think the the following are installation artefacts and could be removed if no re-installation is needed:

in /boot:
-) kernel_install.img
-) config-reinstall.txt
-) installer.cpio
-) maybe: installer-config.txt ( contains the custom settings for the install)

@diederikdehaas
Copy link
Member

That sounds about right :-)

hoehnp pushed a commit to hoehnp/raspbian-ua-netinst that referenced this issue Jul 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants