I opened Alacarte Menu Editor about 10 minutes ago, and tried to make one of my applications visible by checking the box next to it, and it crashed alacarte, and erased everything from my Applications dropdown box.

Now, whenever I try to run Alacarte from System > Preferences > Menu Editor, it doesn't load, and from a terminal, I get the error:

alex@alex-laptop:~$ alacarte
/usr/lib/python2.5/site-packages/apt/progress.py: inconsistent use of tabs and spaces in indentation
Traceback (most recent call last):
  File "/usr/bin/alacarte", line 36, in <module>
    main()
  File "/usr/bin/alacarte", line 32, in main
    app = MainWindow(datadir, version, sys.argv)
  File "/usr/lib/python2.5/site-packages/Alacarte/MainWindow.py", line 49, in __init__
    self.editor = MenuEditor()
  File "/usr/lib/python2.5/site-packages/Alacarte/MenuEditor.py", line 36, in __init__
    self.__loadMenus()
  File "/usr/lib/python2.5/site-packages/Alacarte/MenuEditor.py", line 46, in __loadMenus
    self.applications.dom = xml.dom.minidom.parse(self.applications.path)
  File "/usr/lib/python2.5/site-packages/_xmlplus/dom/minidom.py", line 1915, in parse
    return expatbuilder.parse(file)
  File "/usr/lib/python2.5/site-packages/_xmlplus/dom/expatbuilder.py", line 926, in parse
    result = builder.parseFile(fp)
  File "/usr/lib/python2.5/site-packages/_xmlplus/dom/expatbuilder.py", line 211, in parseFile
    parser.Parse("", True)
xml.parsers.expat.ExpatError: no element found: line 1, column 0
alex@alex-laptop:~$

Dani AI

Generated

Short summary: this is the classic case where Alacarte fails because the user menu XML is empty or owned by the wrong user. The XML parser error means Alacarte tried to parse your per-user menu file but found nothing valid at the start of the file (a truncated or zero-length file). As discovered, restoring a valid applications.menu and fixing ownership resolves it.

Quick checks and validation:

  • Make sure the file exists and is not zero bytes.
  • Check owner and permissions.
  • Run an XML validator if available.

Example commands (replace placeholders as needed):

# check for a non-empty per-user menu
test -s "$HOME/.config/menus/applications.menu" || echo "missing or empty"

# validate XML (install libxml2-utils if needed)
xmllint --noout "$HOME/.config/menus/applications.menu"

If the file is empty or invalid, restore the system default and fix ownership:

mkdir -p "$HOME/.config/menus"
cp /etc/xdg/menus/applications.menu "$HOME/.config/menus/"
sudo chown yourusername:yourusername "$HOME/.config/menus/applications.menu"
chmod 644 "$HOME/.config/menus/applications.menu"

Notes and cautions:

  • Back up the file before editing (copy it to applications.menu.bak).
  • Avoid running graphical file managers as root (plain sudo nautilus can leave root-owned files in your home). If you must use a GUI as root, prefer a graphical policy wrapper (e.g. gksudo/pkexec) or do file edits from a terminal.
  • The stray message about mixed tabs/spaces in apt/progress.py suggests a corrupted Python package file; if it persists, reinstall the package (for Debian/Ubuntu: sudo apt-get install --reinstall python-apt).

What did (restore a valid menu file + fix ownership) is exactly the safe, repeatable fix for this specific Alacarte crash.

EDIT: I fixed my first issue, by replacing /home/alex/.config/menus/applications.menu with /home/newUser/.config/menus/applications.menu ----

EDIT: While typing this, I ran Alacarte from Terminal, and got a "cannot be written to" error, so I used sudo nautlius and changed the owner of the file from newUser to alex. Everything works perfectly fine now!

I'm getting better at Linux every day.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.