[uc20] auto-import service failed

Bug #1895240 reported by hugh chao
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
In Progress
Medium
Michael Vogt

Bug Description

Reproduce steps:
1. Finish the provision
2. Reboot the system
3. Execute systemctl --system --no-ask-password --no-pager list-units --state=failed and the following result could be observed.

$ systemctl --system --no-ask-password --no-pager list-units --state=failed
Failed units:
  UNIT LOAD ACTIVE SUB DESCRIPTION
● snapd.autoimport.service loaded failed failed Auto import assertions from block devices

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

Revision history for this message
hugh chao (hugh712) wrote :

In 66-snapd-autoimport.rules, auto-import been applied to each drive to find auto-import.assertion.

There are two cases will cause the service failed:

1. If the last block device which checked by the service is an invalid file-system, then the service will be marked as failed due to mount failed.

2. If the partitions already been mounted, so it returns error: cannot create user: device already managed.

Revision history for this message
hugh chao (hugh712) wrote :

below is the log from "sudo journalctl -u snapd.autoimport.service"

-- Logs begin at Tue 2020-09-01 07:19:42 UTC, end at Tue 2020-09-01 07:23:31 UTC. --
systemd[1]: Starting Auto import assertions from block devices...
snap[1358]: cmd_auto_import.go:183: imported /run/mnt/ubuntu-boot/auto-import.assert
snap[1358]: cmd_auto_import.go:183: imported /run/mnt/ubuntu-seed/auto-import.assert
snap[1358]: cmd_auto_import.go:183: imported /var/lib/snapd/seed/auto-import.assert
snap[1358]: cmd_auto_import.go:183: imported /writable/system-data/var/lib/snapd/seed/auto-import.assert
snap[1358]: error: cannot create user: device already managed
systemd[1]: snapd.autoimport.service: Main process exited, code=exited, status=1/FAILURE
systemd[1]: snapd.autoimport.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Auto import assertions from block devices.

Revision history for this message
hugh chao (hugh712) wrote :

although MVO already has a fix[1] on case-2 in of #1,
but still in the case-1 of #1 will cause a failed case.

[1] https://github.com/snapcore/snapd/pull/9293

Zygmunt Krynicki (zyga)
Changed in snapd:
status: New → In Progress
assignee: nobody → Michael Vogt (mvo)
importance: Undecided → Medium
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks @Hugh - I will look into fixing the error from an invalid file-system.

Revision history for this message
Michael Vogt (mvo) wrote :

@Hugh I looked at the auto-import code and it looks like we do ignore errors from devices with incorrect filesystems. Could you please provide the output of:

    $ sudo journal -u snapd.auto-import

for the scenario (1) that the filesystem is invalid? That should help me understand more about this particular issue.

Revision history for this message
hugh chao (hugh712) wrote :

@Michael,

I can't reproduce this issue anymore, I think it's because the user import has been taken care by cloud-init, which meant the failed caused by unmovable device/partition can't be reproduce in our current environment.

So I will try to create another usb sticker which has several partition and file systems, or maybe a non-mountable one to reproduce it, just not sure this is a valid case or not....

Revision history for this message
hugh chao (hugh712) wrote :

I tried to create a usb sticker which with 7 partitions,
and the format them as different fs type,
still can't reproduce this issue, I think we can close this one.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.