FileNotFoundError

Bug #1926618 reported by Mathilde
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
autoinstall-generator
Triaged
High
Unassigned

Bug Description

I try to use autoinstall-generator to convert a preseed file to an autoinstall file.
so i installed the package via snap.
When i. try to use it i enter
autoinstall-generator -d preseed.txt
autoinstall-generator -d preseed.txt
Traceback (most recent call last):
  File "/snap/autoinstall-generator/64/usr/bin/autoinstall-generator", line 56, in <module>
    sys.exit(main())
  File "/snap/autoinstall-generator/64/usr/bin/autoinstall-generator", line 45, in main
    infile = open(args.inpath, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'preseed.txt'

Revision history for this message
Dan Bungert (dbungert) wrote :

I appreciate the feedback, Mathilde.
I attempted to reproduce this issue, and unfortunately I can't see that error.

To be sure, it's a bug if it can't handle a relative path.
If you give it an absolute path to the preseed file, does that help?
In what directory are you running this? $HOME or something under it perhaps?
Anything else you can think of that might help to reproduce the issue?

Changed in autoinstall-generator:
status: New → Incomplete
Revision history for this message
Hithaishi Kushalappa (hithaishi-kushalappa) wrote :

Hi Dan, I'm facing a similar bug too. As recommended by you, I tried using the absolute path but that did not work. And I am running it under /home/<User> dir, The error I get -

Traceback (most recent call last):
  File "/snap/autoinstall-generator/64/usr/bin/autoinstall-generator", line 56, in <module>
    sys.exit(main())
  File "/snap/autoinstall-generator/64/usr/bin/autoinstall-generator", line 47, in main
    out = convert_file(infile, args)
  File "/snap/autoinstall-generator/64/lib/python3.6/site-packages/autoinstall_generator/merging.py", line 206, in convert_file
    directives.append(convert(line.strip('\n'), idx + 1))
  File "/snap/autoinstall-generator/64/lib/python3.6/site-packages/autoinstall_generator/convert.py", line 280, in convert
    return dispatch(line, pkg, key, value, linenumber)
  File "/snap/autoinstall-generator/64/lib/python3.6/site-packages/autoinstall_generator/convert.py", line 251, in dispatch
    return debconf_fragment(value, line, linenumber)
  File "/snap/autoinstall-generator/64/lib/python3.6/site-packages/autoinstall_generator/convert.py", line 163, in debconf_fragment
    key = f'{chunks[0]} {chunks[1]}'
IndexError: list index out of range

Dan Bungert (dbungert)
Changed in autoinstall-generator:
status: Incomplete → Triaged
importance: Undecided → High
Revision history for this message
Bogdan Ilisei (znuff) wrote (last edit ):

Have there been ANY testing on this app? Because it's just hilarious how it fails a basic thing:

root@netboot:~# stat /srv/pxe/ubuntu/20/chroot.preseed
  File: /srv/pxe/ubuntu/20/chroot.preseed
  Size: 3067 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 1580138 Links: 2
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Access: 2022-10-26 16:30:36.216674530 +0300
Modify: 2020-12-17 18:29:12.480162194 +0200
Change: 2020-12-17 18:29:12.480162194 +0200
 Birth: -

root@netboot:~# autoinstall-generator /srv/pxe/ubuntu/20/chroot.preseed /root/moo.file
Traceback (most recent call last):
  File "/snap/autoinstall-generator/104/usr/bin/autoinstall-generator", line 56, in <module>
    sys.exit(main())
  File "/snap/autoinstall-generator/104/usr/bin/autoinstall-generator", line 45, in main
    infile = open(args.inpath, 'r', encoding='utf-8')
FileNotFoundError: [Errno 2] No such file or directory: '/srv/pxe/ubuntu/20/chroot.preseed'

Just to be clear, the only way I was able to get this to work was to install it with pip3:

# pip3 install git+https://github.com/canonical/autoinstall-generator.git

Which then works as expected:

# /usr/local/bin/autoinstall-generator.py /srv/pxe/ubuntu/20/chroot.preseed /root/moo.file

But the snap is clearly not working due to some security confinements.

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.